Commit a4d45bd0 authored by Wolfgang Ludwig's avatar Wolfgang Ludwig
Browse files

add interactive mode for correlation


Signed-off-by: Wolfgang Ludwig's avatarWolfgang Ludwig <wolfgang.ludwig@esrf.fr>
parent 99487d46
function [grain, sim_proj, corr] = gtAlignAndNormalizeProjections(grain_vol, grain, det_ind, varargin)
conf = struct(...
'align_blobs', true, ...
'dilate_mask', 15 ...
'dilate_mask', 15, ...
'interactive', false, ...
'log_width', 15, ...
'log_std', 10 ...
);
se = strel('disk', conf.dilate_mask);
......@@ -9,17 +12,23 @@ num_proj = size(grain.proj(det_ind).stack, 2);
sim_proj = gtAstraCreateProjections(grain_vol, grain.proj(det_ind).geom, [grain.proj(det_ind).num_rows grain.proj(det_ind).num_cols]);
f = fspecial('prewitt');
f = fspecial('log', conf.log_width, conf.log_std);
stack = zeros(size(sim_proj));
for ii = 1: num_proj
sim = squeeze(sim_proj(:,ii,:));
sim = sim./mean(sim(:));
mask = imdilate(sim > 0, se);
proj = squeeze(grain.proj(det_ind).stack(:,ii,:));
proj = proj./mean(proj(:));
blob = grain.proj(det_ind).bl(ii).intm;
simf = abs(imfilter(sim, f) + imfilter(sim, f'));
projf = abs(imfilter(proj, f) + imfilter(proj, f'));
corr(ii,:) = correlate(simf, projf);
simf = abs(imfilter(sim, f)); % + imfilter(sim, f'));
projf = abs(imfilter(proj, f)); % + imfilter(proj, f'));
corr(ii,:) = correlate(simf, projf)
if conf.interactive
shift = gtFindShifts(sim, interpolatef(proj, corr(ii,1), corr(ii, 2)), 'clims', [-5 5], 'climt', [-1 20], 'block', 'on');
corr(ii, :) = corr(ii, :) + shift;
end
proj = interpolatef(proj, corr(ii, 1), corr(ii, 2));
stack(:,ii,:) = proj .* mask;
intensity = gtMathsSumNDVol(stack(:,ii,:));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment