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

6D-reconstruction: share some setup code

parent 0d3943c9
No related branches found
No related tags found
No related merge requests found
......@@ -42,14 +42,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
function [algo, good_orients, blobs] = getGrainReconstructionAlgo(self, sampler, num_interp, varargin)
% Build Empty volumes
ref_gr = sampler.get_reference_grain();
proj = ref_gr.proj(self.det_index);
spacing = mean([proj.vol_size_y, proj.vol_size_x, proj.vol_size_z]) * (self.rspace_oversize - 1);
volume_size = ceil([proj.vol_size_y, proj.vol_size_x, proj.vol_size_z] + spacing);
if (self.volume_downscaling > 1)
volume_size = ceil(volume_size / self.volume_downscaling);
end
volume_size = self.get_volume_size(ref_gr);
switch (lower(self.shape_functions_type))
case 'none'
......@@ -93,14 +86,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
% Build Empty volumes
ref_gr = sampler(1).get_reference_grain();
proj = ref_gr.proj(self.det_index);
spacing = mean([proj.vol_size_y, proj.vol_size_x, proj.vol_size_z]) * (self.rspace_oversize - 1);
volume_size = ceil([proj.vol_size_y, proj.vol_size_x, proj.vol_size_z] + spacing);
if (self.volume_downscaling > 1)
volume_size = ceil(volume_size / self.volume_downscaling);
end
volume_size = self.get_volume_size(ref_gr);
for ii_g = 1:num_grains
gr = sampler(ii_g).get_reference_grain();
......@@ -536,6 +522,17 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
'good_orients', {true(1, tot_orient)} );
end
function volume_size = get_volume_size(self, ref_gr)
proj = ref_gr.proj(self.det_index);
spacing = mean([proj.vol_size_y, proj.vol_size_x, proj.vol_size_z]) * (self.rspace_oversize - 1);
volume_size = ceil([proj.vol_size_y, proj.vol_size_x, proj.vol_size_z] + spacing);
if (self.volume_downscaling > 1)
volume_size = ceil(volume_size / self.volume_downscaling);
end
end
function [sub_blob_slices, proj_coeffs] = get_sub_blobs(self, blobs, slices_interp, padding)
num_blobs = numel(blobs);
sub_blob_slices = cell(num_blobs, 1);
......@@ -771,18 +768,9 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
sliceLims = [floor(sliceLims(:, 1)), ceil(sliceLims(:, 2))] + 1;
end
function volume_size = get_volume_size(self, gr_center, Ws, bls)
% At this point we kinda lost the original blob size
% information! so we get it from the mask ;)
BBs(:, [1, 3]) = cat(1, bls(:).bbuim);
BBs(:, [2, 4]) = cat(1, bls(:).bbvim);
BBs = [BBs(:, 1:2), (BBs(:, 3:4) - BBs(:, 1:2) + 1)];
verts = gtFwdSimComputeCircumscribingPolyhedron(gr_center, Ws, BBs, self.parameters, self.det_index);
volume_size = round(max(verts, [], 1) - min(verts, [], 1) / self.parameters.fsim.oversize);
end
function [geometries, offsets] = makeSubBlobGeometries( self, ...
grains_props, proj_coeffs, extreemes_blobs_w, w_tab, abs_lims)
......
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