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

Fwdproj of deformation volumes: updated and fixed a few small things

parent c7c4e476
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ function active_vol = gtFedActiveVolumeVoxels(phase_vol, parameters_inline, vara
vol_size_xyz = size(phase_vol.intvol);
det_mask = zeros(vol_size_xyz(2), vol_size_xyz(3));
det_mask = zeros(vol_size_xyz(2), vol_size_xyz(3), 'single');
if (isempty(conf.vert_slice))
conf.vert_slice = round(vol_size_xyz(2) / 2);
......@@ -69,7 +69,7 @@ function active_vol = gtFedActiveVolumeVoxels(phase_vol, parameters_inline, vara
det_mask(conf.vert_slice, :) = v;
case 'line'
% Creation of the line mask: 1 vx vertical thickness
det_mask(conf.vert_slice, :) = true;
det_mask(conf.vert_slice, :) = 1;
end
fprintf('\b\b: Done in %g seconds.\n', toc(c))
......
function fedpars = gtFedCreateGrainParsMasked(grain, active_vol, dmvol, parameters, varargin)
% [fedpars, dmvol, active_vol] = gtFedCreateGrainParsMasked(grain, grain_rec, parameters, varargin)
conf = struct(...
'is_real_data', [], ...
conf = struct( ...
'keep_ondet', true, ...
'volume_super_sampling', []);
'volume_super_sampling', 1);
conf = parse_pv_pairs(conf, varargin);
%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -31,76 +30,57 @@ function fedpars = gtFedCreateGrainParsMasked(grain, active_vol, dmvol, paramete
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Creation of actual fedpars structure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('- Creating fedpars structure ...')
fprintf('Creating fedpars structure..')
c = tic();
% x, y, z no. of voxels in the grain
fedpars.grainsize = size(active_vol);
% x, y, z no. of voxels in a volume element
fedpars.gvsize = fedpars.grainsize ./ size(active_vol);
fedpars.grainsize = size(active_vol);
% Active deformation components. Total number is 9.
% In case of rotations only (should be our case):
fedpars.dcomps = [true(1, 3) false(1, 6)];
% Origin voxel in the SAM reference
% Using original intensities volume size to retrieve the correct shift
vc = gtGeoSam2Sam(size(active_vol) / 2, parameters.recgeo(1), parameters.samgeo, false);
vs = [0 0 0];
% vs = gtGeoSam2Sam(gr_seg.segbb(1:3), parameters.recgeo, parameters.samgeo, false);
fedpars.vox000sam = grain.center - vc + vs;
fedpars.dcomps = [true(1, 3), false(1, 6)];
% Class of strain states
fedpars.gvtype = class(active_vol);
% Real or simulated data?
if (isempty(conf.is_real_data))
is_real = inputwdefault('Are you working with real data? [y/n]', 'y');
fedpars.is_real_data = ~strcmpi(is_real, 'n');
else
fedpars.is_real_data = conf.is_real_data;
end
fedpars.gvtype = class(active_vol);
% Generate random deformation components
if (~exist('dmvol', 'var') || isempty(dmvol))
% Type of deformation applied
fedpars.deftype = 'smooth';
deftype = inputwdefault(['Specify the type of deformation ' ...
'applied: smooth (s) or realistic (r):', 's']);
if (strcomp(deftype, 'r'))
fedpars.deftype = 'realistic';
switch (lower(deftype))
case 'r'
fedpars.deftype = 'realistic';
otherwise
fedpars.deftype = 'smooth';
end
% Random strain definition mode
fedpars.randdefmode = 'smooth';
randdefmode = input(['Specify the random strain definition mode: ' ...
'smooth (s) or interpolated (i):'], 's');
if (strcompi(randdefmode, 'i'))
fedpars.randdefmode = 'interp';
switch (lower(randdefmode))
case 'i'
fedpars.randdefmode = 'interp';
otherwise
fedpars.randdefmode = 'smooth';
end
% Maximum absolute deformation gradient
fedpars.dappgradlim = 2e-4 * ones(size(fedpars.dcomps)); % guess: verify
fedpars.dappgradlim = 2e-4 * ones(size(fedpars.dcomps)); % guess: verify
% Maximum absolute deformation value which can be randomly generated
fedpars.dapplim = 5e-3 * ones(size(fedpars.dcomps)); % guess: verify
fedpars.dapplim = 5e-3 * ones(size(fedpars.dcomps)); % guess: verify
end
% ID of blobs to load for figure
fedpars.loadbl = [];
% Detector parameters
ndet = numel(parameters.detgeo);
if (~conf.keep_ondet)
grain_fwd = gtCalculateGrain(grain, parameters);
end
for ii_det = 1:ndet
% Detector parameters
ndet = numel(parameters.detgeo);
for ii_det = 1:ndet
if (conf.keep_ondet && isfield(grain, 'proj') && (numel(grain.proj) >= ii_det))
if (isfield(grain.proj, 'ondet') ...
&& (~isempty(grain.proj(ii_det).ondet)))
......@@ -124,20 +104,15 @@ function fedpars = gtFedCreateGrainParsMasked(grain, active_vol, dmvol, paramete
end
% Types for blobs intensities
fedpars.bltype = 'single';
fedpars.bltype = 'single';
% Deformation method for calculation of deformation tensor
fedpars.defmethod = 'rod_rightstretch';
% fedpars.defmethod = 'small';
fedpars.defmethod = 'rod_rightstretch';
% Algorithm for blobs smoothing
fedpars.intsmoothalg = 'none';
fedpars.intsmoothalg = 'none';
if (~isempty(conf.volume_super_sampling))
fedpars.volume_super_sampling = conf.volume_super_sampling;
else
fedpars.volume_super_sampling = 1;
end
fedpars.volume_super_sampling = conf.volume_super_sampling;
disp('Done')
fprintf('\b\b: Done in %g seconds.\n', toc(c))
end
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