diff --git a/zUtil_Deformation/gt6DCreateProjDataFromTwinnedGrainFwdProj.m b/zUtil_Deformation/gt6DCreateProjDataFromTwinnedGrainFwdProj.m index f6bb06f118702630f59ab206c68fe26e4b0c196d..9647001700e434b1da5105282703b2e35c203500 100644 --- a/zUtil_Deformation/gt6DCreateProjDataFromTwinnedGrainFwdProj.m +++ b/zUtil_Deformation/gt6DCreateProjDataFromTwinnedGrainFwdProj.m @@ -216,12 +216,18 @@ function [samp_ors, estim_space_bbox_pix, estim_orient_bbox] = gt6DCreateProjDat fprintf('Determining UVW bounding boxes..') c = tic(); - if (conf.use_raw_images) + if (numel(conf.use_raw_images) == 1) + conf.use_raw_images = conf.use_raw_images(ones(num_grains, 1)); + end + + if (any(conf.use_raw_images)) uvw_tab = cell(num_grains, 1); img_bboxes = cell(num_grains, 1); img_sizes = cell(num_grains, 1); + end - for ii_g = 1:num_grains + for ii_g = 1:num_grains + if (conf.use_raw_images(ii_g)) local_ondet = extended_projs(ii_g).ondet; local_included = extended_projs(ii_g).included; local_inc_refl = local_ondet(local_included); @@ -251,9 +257,7 @@ function [samp_ors, estim_space_bbox_pix, estim_orient_bbox] = gt6DCreateProjDat fprintf('%02d)du %8d, dv %8d, dw %8d, eta: %7.3f <- used: %d, u: [%4d %4d], v: [%4d %4d], w: [%4d %4d]\n', ... [(1:numel(refor_ns))', img_sizes{ii_g}, refor_ns, ~inconvenient_etas{ii_g}, img_bboxes{ii_g}(:, [1 4 2 5 3 6]) ]'); end - end - else - for ii_g = 1:num_grains + else max_img_sizes(ii_g, :) = [ ... size(grs(ii_g).proj(conf.det_index).stack, 1), ... size(grs(ii_g).proj(conf.det_index).stack, 3), ]; @@ -270,7 +274,7 @@ function [samp_ors, estim_space_bbox_pix, estim_orient_bbox] = gt6DCreateProjDat num_blobs = numel(extended_projs(ii_g).included); c = tic(); - if (conf.use_raw_images) + if (conf.use_raw_images(ii_g)) fprintf(' - Loading raw images: ') blobs = gtFwdSimBlobDefinition('blob', num_blobs); @@ -401,7 +405,14 @@ end function [u_size, v_size] = get_stack_UV_size(img_sizes, p, conf) max_img_sizes = [max(img_sizes(:, 1)), max(img_sizes(:, 2))]; - stack_imgs_oversize = min(p.fsim.oversize, conf.stack_oversize); + if (any(conf.use_raw_images)) + % Because in this case we saturate the volume field of view from + % the spots already, and we only make up for what will probably be + % used as oversize later on for the volume + stack_imgs_oversize = p.rec.grains.options.rspace_oversize; + else + stack_imgs_oversize = min(p.fsim.oversize, conf.stack_oversize); + end u_size = round(max_img_sizes(1) * stack_imgs_oversize); v_size = round(max_img_sizes(2) * stack_imgs_oversize); @@ -539,14 +550,14 @@ function produce_beam_intensity_renorm_figure(refgr, p, ref_ondet, ref_included, hold(ax, 'off') end -function s = get6DExtendedProjDefinition(num_structs) +function eproj = get6DExtendedProjDefinition(num_structs) if (~exist('num_structs', 'var') || isempty(num_structs)) num_structs = 1; end repl_cell = cell(num_structs, 1); - s = struct(... + eproj = struct(... 'ondet', repl_cell, ... 'included', repl_cell, ... 'selected', repl_cell, ... @@ -558,7 +569,7 @@ function s = get6DExtendedProjDefinition(num_structs) 'shared_refl_included_pos', repl_cell ); end -function s = find_matches_with_refor(refor, twingr, refl_matches, conf) +function eproj = find_matches_with_refor(refor, twingr, refl_matches, conf) size_refl_list = size(refor.allblobs.omega); refor_proj = refor.proj(conf.det_index); @@ -617,24 +628,24 @@ function s = find_matches_with_refor(refor, twingr, refl_matches, conf) % If the parent enables it, we enable it as well bool_twin_sel = bool_twin_sel | (shared_refl & bool_ref_sel); - s = get6DExtendedProjDefinition(); + eproj = get6DExtendedProjDefinition(); % We now find the blobs in the old twin bl structure that are % shared with the parent - s.shared_refl_included_pos = bool_twin_inc_redundant(twin_ondet(twin_inc)); + eproj.shared_refl_included_pos = bool_twin_inc_redundant(twin_ondet(twin_inc)); twin_inc = find(bool_twin_inc(twin_ondet)); twin_sel = bool_twin_sel(twin_ondet(twin_inc)); shared_refl_pos_in_parent = bool_ref_inc & shared_refl; - s.shared_refl_pos_in_parent = shared_refl_pos_in_parent(ref_ondet(ref_included)); + eproj.shared_refl_pos_in_parent = shared_refl_pos_in_parent(ref_ondet(ref_included)); % We cut it down to the size of the included - s.shared_refl = shared_refl(twin_ondet(twin_inc)); + eproj.shared_refl = shared_refl(twin_ondet(twin_inc)); - s.ondet = twin_ondet; - s.included = twin_inc; - s.selected = twin_sel; + eproj.ondet = twin_ondet; + eproj.included = twin_inc; + eproj.selected = twin_sel; end function blob = load_blob(img_bboxes, img_sizes, stackUSize, stackVSize, p, conf)