Skip to content
Snippets Groups Projects
Commit a51a462b authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Spot montage: added multi-detector support

parent b4f5b235
No related branches found
No related tags found
No related merge requests found
function selected = gtGuiGrainMontage(gr, selected, use_blobs) function selected = gtGuiGrainMontage(gr, selected, use_blobs, det_ind)
% GUIGTMONTAGE % GUIGTMONTAGE
% selected = gtGuiGrainMontage(gr, selected, use_blobs) % selected = gtGuiGrainMontage(gr, selected, use_blobs, det_ind)
% -------------------------------------------------------------------------- % --------------------------------------------------------------------------
% %
if (~exist('selected', 'var') || isempty(selected)) if (~exist('selected', 'var'))
selected = gr.selected; selected = [];
end end
if (~exist('use_blobs', 'var') || isempty(use_blobs)) if (~exist('use_blobs', 'var') || isempty(use_blobs))
use_blobs = false; use_blobs = false;
end end
if (~exist('det_ind', 'var'))
det_ind = 1;
end
% Init the GUI % Init the GUI
gui_data = gtGuiGrainMontage_init(gr, selected, use_blobs); gui_data = gtGuiGrainMontage_init(gr, selected, use_blobs, det_ind);
while (1) while (1)
% Wait for the application to close % Wait for the application to close
...@@ -32,10 +36,39 @@ function selected = gtGuiGrainMontage(gr, selected, use_blobs) ...@@ -32,10 +36,39 @@ function selected = gtGuiGrainMontage(gr, selected, use_blobs)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Private functions %%% Private functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function gui_data = gtGuiGrainMontage_init(gr, selected, use_blobs) function gui_data = gtGuiGrainMontage_init(gr, selected, use_blobs, det_ind)
gui_data = []; gui_data = [];
% Coping with different versions of FwdSim
if (isempty(selected))
if (isfield(gr.proj(det_ind), 'selected'))
selected = gr.proj(det_ind).selected;
else
selected = gr.selected;
end
end
if (isfield(gr.proj(det_ind), 'included'))
included = gr.proj(det_ind).included;
ondet = gr.proj(det_ind).ondet;
else
included = gr.included;
ondet = gr.ondet;
end
if (use_blobs && ~isfield(gr.proj(det_ind), 'bl'))
gr.proj(det_ind).bl = gr.bl;
end
if (isfield(gr, 'spotid'))
spot_ids = gr.spotid(included);
else
spot_ids = zeros(numel(included), 1);
end
if (isfield(gr, 'intensity'))
intensities = gr.intensity;
else
intensities = zeros(numel(included), 1);
end
% Condition to exit from the gui % Condition to exit from the gui
gui_data.close = false; gui_data.close = false;
...@@ -100,10 +133,7 @@ function selected = gtGuiGrainMontage(gr, selected, use_blobs) ...@@ -100,10 +133,7 @@ function selected = gtGuiGrainMontage(gr, selected, use_blobs)
% Let's store the selected images vector in input % Let's store the selected images vector in input
gui_data.selected = selected; gui_data.selected = selected;
spot_ids = gr.spotid(gr.included); omegas_th = gr.allblobs.omega(ondet(included));
intensities = gr.intensity;
omegas_th = gr.allblobs.omega(gr.ondet(gr.included));
% hack to make it display the images: may be a matlab bug % hack to make it display the images: may be a matlab bug
% related to flushing % related to flushing
...@@ -114,17 +144,13 @@ function selected = gtGuiGrainMontage(gr, selected, use_blobs) ...@@ -114,17 +144,13 @@ function selected = gtGuiGrainMontage(gr, selected, use_blobs)
% Sorting by Omegas % Sorting by Omegas
[~, order] = sort(omegas_th); [~, order] = sort(omegas_th);
if (use_blobs && ~isfield(gr.proj, 'bl'))
gr.proj.bl = gr.bl;
end
for ii = 1:length(selected) for ii = 1:length(selected)
index = order(ii); index = order(ii);
if (use_blobs) if (use_blobs)
img = sum(gr.proj.bl(index).intm, 3)'; img = sum(gr.proj(det_ind).bl(index).intm, 3)';
else else
img = squeeze(gr.proj.stack(:, index, :))'; img = squeeze(gr.proj(det_ind).stack(:, index, :))';
end end
% hack to make it display the images: may be a matlab bug % hack to make it display the images: may be a matlab bug
......
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