Skip to content
Snippets Groups Projects
Commit 504c9b8d authored by Nicola Viganò's avatar Nicola Viganò
Browse files

6D-reconstruction-num_interp: Removed the shrinking of the blobs

parent ca72c3eb
No related branches found
No related tags found
No related merge requests found
......@@ -102,30 +102,10 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
volume_size = ceil(volume_size / self.volume_downscaling);
end
% This vector will tell us where we will find in the blobs, the
% ones that were selected among the included, because the
% information we have in the twins about the spots that
% coincide are about the included and not the selected
included_pos_in_selected = zeros(size(proj.included));
included_pos_in_selected(proj.selected) = 1:numel(find(proj.selected));
blobs_to_not_shrink = cell(num_grains, 1);
blobs_to_not_shrink{1} = false(size(included_pos_in_selected));
for ii_g = 2:num_grains
temp_gr = sampler(ii_g).get_reference_grain();
shared = temp_gr.proj.shared_parent(sampler(ii_g).selected) > 0;
shared_pos = temp_gr.proj.shared_parent(sampler(ii_g).selected);
blobs_to_not_shrink{ii_g} = false(size(shared_pos));
blobs_to_not_shrink{ii_g}(shared) = true;
blobs_to_not_shrink{1}(included_pos_in_selected(shared_pos(shared))) = true;
end
for ii_g = 1:num_grains
gr = sampler(ii_g).get_reference_grain();
fprintf('%d) Grainid %d:\n', ii_g, gr.id)
algo_params(ii_g) = self.get_algorithm_params_num_interp(sampler(ii_g), num_interp, blobs_to_not_shrink{ii_g}); %#ok<AGROW>
algo_params(ii_g) = self.get_algorithm_params_num_interp(sampler(ii_g), num_interp); %#ok<AGROW>
fprintf('\n')
end
......@@ -138,6 +118,13 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
geometries = cat(1, algo_params(:).geometries);
geometries_ss = cat(1, algo_params(:).geometries_ss);
% This vector will tell us where we will find in the blobs, the
% ones that were selected among the included, because the
% information we have in the twins about the spots that
% coincide are about the included and not the selected
included_pos_in_selected = zeros(size(proj.included));
included_pos_in_selected(proj.selected) = 1:numel(find(proj.selected));
offsets = algo_params(1).offsets;
offsets_ss = algo_params(1).offsets_ss;
base_offset_shift = numel(algo_params(1).blobs);
......@@ -214,7 +201,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
end
methods (Access = protected)
function algo_params = get_algorithm_params_num_interp(self, sampler, num_interp, blobs_to_not_shrink)
function algo_params = get_algorithm_params_num_interp(self, sampler, num_interp)
fprintf('Extracting blobs on detector: ')
c = tic();
sel_bls = sampler.selected;
......@@ -223,10 +210,6 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
tot_blobs = numel(bl);
sel_incl_indx = find(sel_bls);
if (~exist('blobs_to_not_shrink', 'var') || isempty(blobs_to_not_shrink))
blobs_to_not_shrink = false(size(bl));
end
% Should be decided automatically
padding = 10;
......@@ -370,23 +353,16 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
round(lims_tot(ii, :)), slice_lims_tot(ii, :), ...
size(sub_blob_slices{ii}, 3))
blobs{ii} = sub_blob_slices{ii};
if (~blobs_to_not_shrink(ii))
blobs{ii} = blobs{ii}(:, :, slice_lims_tot(ii, 1):slice_lims_tot(ii, 2));
end
blobs{ii} = permute(blobs{ii}, [1 3 2]);
blobs{ii} = permute(sub_blob_slices{ii}, [1 3 2]);
intensIncl = sum(sum(sum(blobs{ii}, 2)));
intensExcl = sum(sum(sum(sub_blob_slices{ii}(:, :, [1:(slice_lims_tot(ii, 1)-1), (slice_lims_tot(ii, 2)+1):end]), 2)));
fprintf('-> Intensity: included %3.3f, excluded %3.3f\n', ...
intensIncl, intensExcl);
fprintf('-> Intensity: %3.3f\n', gtMathsSumNDVol(blobs{ii}));
end
fprintf('Computing blobs <-> sinograms coefficients: ')
c = tic();
[geometries, offsets] = self.makeSubBlobGeometries( ...
grains_props, proj_coeffs, extreemes_blobs_w_tot, ...
w_tab, abs_lims_tot, slice_lims_tot, blobs_to_not_shrink);
w_tab, abs_lims_tot);
fprintf('Done (%f s).\n', toc(c));
num_geoms = numel(geometries);
......@@ -407,7 +383,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
[geometries_ss{ii_o}, offsets_ss{ii_o}] = self.makeSubBlobGeometries( ...
orient_props_ss, proj_coeffs, extreemes_blobs_w_tot, ...
w_tab_oss, abs_lims_tot, slice_lims_tot, blobs_to_not_shrink);
w_tab_oss, abs_lims_tot);
% merging all the orientation-space super-sampling
% projection coefficients into one structure per
......@@ -777,7 +753,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
end
function [geometries, offsets] = makeSubBlobGeometries( self, ...
grains_props, proj_coeffs, extreemes_blobs_w, w_tab, abs_lims, slice_lims, blobs_to_not_shrink)
grains_props, proj_coeffs, extreemes_blobs_w, w_tab, abs_lims)
% ASTRA Geometry
if (isfield(grains_props, 'detector'))
geometries = arrayfun(@(x){x.detector(self.det_index).proj_geom}, grains_props);
......@@ -846,11 +822,6 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
coeffs = [coeffs_1, coeffs_2];
end
% Correcting w-slices indices for blob truncation
if (~blobs_to_not_shrink(n))
slices = slices - slice_lims(n, 1) +1;
end
offsets{ii}.proj(jj) = struct( ...
'sino_offset', jj, 'blob_offset', n, ...
'proj_offsets', slices, 'proj_coeffs', coeffs );
......
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