Skip to content
Snippets Groups Projects
Commit 6a786a2c authored by Wolfgang Ludwig's avatar Wolfgang Ludwig
Browse files

Some additional fixes related to sample shifting / absorption volume vertial center

parent 9dcb47f1
No related branches found
No related tags found
No related merge requests found
......@@ -74,7 +74,7 @@ totproj = prep.totproj;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% check preprocessing parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
parameters = gtCheckParameters(parameters, 'prep', 'verbose', true);
%parameters = gtCheckParameters(parameters, 'prep', 'verbose', true);
save(parameters_name,'parameters');
check = inputwdefault('Do you want to verify/change the (default) preprocessing parameters? [y/n]', 'n');
......@@ -198,9 +198,10 @@ else
check = inputwdefault(['Do you want to (re)-calculate the Rotation Axis position (currently ' sprintf('%0.1f',rot) ')? [y/n]'], 'n');
end
if strcmpi(check,'y')
parameters.acq.rotu = gtFindRotationAxis(parameters.acq,bbdir);
parameters.acq.rotu = gtFindRotationAxis(parameters.acq, bbdir);
parameters.acq.rotx = parameters.acq.rotu;
parameters.detgeo.detrefpos(2) = -(parameters.acq.rotu - parameters.acq.xdet / 2) * parameters.detgeo.pixelsizeu;
parameters.detgeo.detrefpos(2) = -(parameters.acq.rotu - parameters.acq.xdet / 2 - 0.5) * parameters.detgeo.pixelsizeu;
parameters.detgeo.detrefpos(3) = 0; % Here we define the LabZ = 0 position as the center of the detector
end
save(parameters_name,'parameters');
......
......@@ -10,8 +10,12 @@ function [blob, bb, mask, bint] = gtFwdSimBuildBlob(candidateID, parameters, det
end
base_dir = fullfile(parameters.acq(det_index).dir, '2_difblob');
[blob, bb, mask] = gtReadBlobFromHDF5(base_dir, candidateID);
try
[blob, bb, mask] = gtReadBlobFromHDF5(base_dir, candidateID);
catch
[blob, bb] = gtReadBlobFromHDF5(base_dir, candidateID);
mask = true(size(blob));
end
% Let's filter NaNs out
mask(isnan(blob)) = false;
......
function verts = gtFwdSimComputeCircumscribingPolyhedron(gr_center, projvecs, omegas, bb, parameters, det_index, criterion, display_figure)
function verts = gtFwdSimComputeCircumscribingPolyhedron(gr_center, projvecs, omegas, bb, gr_shift_lab, parameters, det_index, criterion, display_figure)
% verts = gtFwdSimComputeCircumscribingPolyhedron(gr_center, d_beam_dirs, omegas, bb, parameters, det_index, display_figure)
%
% bb is [x_origin, y_origin, x_size, y_size]
......@@ -39,10 +39,10 @@ function verts = gtFwdSimComputeCircumscribingPolyhedron(gr_center, projvecs, om
% Taking the four corners: ctl = corner top left, cbr = corner bottom
% right, ...
% Here we compute their positions in the lab coordinates
ctl_pos_lab = gtGeoDet2Lab([bb(:, 1), bb(:, 2)], detgeo, false);
ctr_pos_lab = gtGeoDet2Lab([(bb(:, 1) + bb(:, 3)), bb(:, 2)], detgeo, false);
cbl_pos_lab = gtGeoDet2Lab([bb(:, 1), (bb(:, 2) + bb(:, 4))], detgeo, false);
cbr_pos_lab = gtGeoDet2Lab([(bb(:, 1) + bb(:, 3)), (bb(:, 2) + bb(:, 4))], detgeo, false);
ctl_pos_lab = gtGeoDet2Lab([bb(:, 1), bb(:, 2)], detgeo, false) - gr_shift_lab;
ctr_pos_lab = gtGeoDet2Lab([(bb(:, 1) + bb(:, 3)), bb(:, 2)], detgeo, false) - gr_shift_lab;
cbl_pos_lab = gtGeoDet2Lab([bb(:, 1), (bb(:, 2) + bb(:, 4))], detgeo, false) - gr_shift_lab;
cbr_pos_lab = gtGeoDet2Lab([(bb(:, 1) + bb(:, 3)), (bb(:, 2) + bb(:, 4))], detgeo, false) - gr_shift_lab;
% positions in the reconstruction coordinates
ctl_pos_rec = gtGeoLab2Sam(ctl_pos_lab, rot_s2l_w, labgeo, recgeo, false);
......@@ -135,22 +135,24 @@ function verts = gtFwdSimComputeCircumscribingPolyhedron(gr_center, projvecs, om
grid(ax, 'on');
scatter3(ax, 0, 0, 0, 30, 'r', 'filled');
for ii = 1:numel(omegas)
disp(ii)
quiver3(ax, 0, 0, 0, projvecs_rec(ii, 1), projvecs_rec(ii, 2), projvecs_rec(ii, 3));
scatter3(ax, ctl_pos_rec(ii, 1), ctl_pos_rec(ii, 2), ctl_pos_rec(ii, 3), 20, 'b');
scatter3(ax, ctr_pos_rec(ii, 1), ctr_pos_rec(ii, 2), ctr_pos_rec(ii, 3), 20, 'b');
quiver3(ax, 0, 0, 0, pv_t_rec(ii, 1), pv_t_rec(ii, 2), pv_t_rec(ii, 3));
% pause
% quiver3(ax, 0, 0, 0, pv_t_rec(ii, 1), pv_t_rec(ii, 2), pv_t_rec(ii, 3));
% pause
scatter3(ax, cbl_pos_rec(ii, 1), cbl_pos_rec(ii, 2), cbl_pos_rec(ii, 3), 20, 'b');
scatter3(ax, cbr_pos_rec(ii, 1), cbr_pos_rec(ii, 2), cbr_pos_rec(ii, 3), 20, 'b');
quiver3(ax, 0, 0, 0, pv_b_rec(ii, 1), pv_b_rec(ii, 2), pv_b_rec(ii, 3));
% pause
% pause
quiver3(ax, 0, 0, 0, pu_l_rec(ii, 1), pu_l_rec(ii, 2), pu_l_rec(ii, 3));
quiver3(ax, 0, 0, 0, pu_r_rec(ii, 1), pu_r_rec(ii, 2), pu_r_rec(ii, 3));
pause
end
hold(ax, 'off');
end
......
......@@ -23,10 +23,9 @@ function [candidateIDs, cands_info] = gtFwdSimFindCandidates(spot_props, gr, spo
dist_v_pix = abs(spots_info.BoundingBoxYorigin + spots_info.BoundingBoxYsize / 2 - uvw(2));
dist_w_im = abs(spots_info.CentroidImage - uvw(3));
dist_u_ok = dist_u_pix < (spots_info.BoundingBoxXsize - spot_props.XsizeMin / 2) / 2;
dist_v_ok = dist_v_pix < (spots_info.BoundingBoxYsize - spot_props.YsizeMin / 2) / 2;
% dist_u_ok = dist_u_pix < (spot_props.XsizeMax / 2);
% dist_v_ok = dist_v_pix < (spot_props.YsizeMax / 2);
dist_u_ok = dist_u_pix < (spots_info.BoundingBoxXsize - spot_props.XsizeAvg / 2) / 2;
dist_v_ok = dist_v_pix < (spots_info.BoundingBoxYsize - spot_props.YsizeAvg / 2) / 2;
dist_w_ok = dist_w_im <= spot_props.max_w_offset_im;
if (isfield(spot_props, 'max_n_offset') && ~isempty(spot_props.max_n_offset))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment