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

Grain segmentation: added logic that uses the reconstruction std-dev to reduce artifacts

parent fe1879c0
No related branches found
No related tags found
No related merge requests found
......@@ -292,6 +292,25 @@ classdef GtThreshold < handle
if (is_6D)
grain_out.vol = grain_rec.ODF6D.intensity;
grain_out.shift = grain_rec.ODF6D.shift;
par_thr = obj.getThrParams();
if (par_thr.weight_by_stddev ...
&& isfield(grain_rec.ODF6D, 'voxels_stddev_R_vectors'))
% Let's use the std-dev info about the reconstruction to
% make the segmentation better
valid_inds = grain_out.vol > 0;
stddev_vol = smooth3(grain_rec.ODF6D.voxels_stddev_R_vectors);
stddev_valid = stddev_vol(valid_inds);
vol_valid = grain_out.vol(valid_inds);
stddev_rescale = max(stddev_valid(:)) - stddev_valid;
stddev_rescale = (stddev_rescale - min(stddev_rescale(:))) ...
./ (max(stddev_rescale(:)) - min(stddev_rescale(:)));
grain_out.vol(valid_inds) = vol_valid .* stddev_rescale;
end
else
grain_out.vol = grain_rec.VOL3D.intensity;
grain_out.shift = grain_rec.VOL3D.shift;
......@@ -369,6 +388,10 @@ classdef GtThreshold < handle
if (~isfield(thr_params, 'percent_of_peak'))
thr_params.percent_of_peak = 2.5;
end
if (~isfield(thr_params, 'weight_by_stddev'))
thr_params.weight_by_stddev = true;
end
end
function grain_seg = thresholdAutoSingleGrain(obj, grain_rec)
......
......@@ -21,5 +21,6 @@ function par_rec = gtRecDefaultParameters(varargin)
% Grain segmentation related values
par_rec.thresholding = struct( ...
'percentile', 20, 'do_morph_recon', true, ...
'percent_of_peak', 2.5, 'num_iter', 0, 'iter_factor', 1);
'percent_of_peak', 2.5, 'num_iter', 0, 'iter_factor', 1, ...
'weight_by_stddev', true);
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