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

Random fixes from segmentation and assembling

parent 7921e202
No related branches found
No related tags found
No related merge requests found
......@@ -223,7 +223,7 @@ classdef GtThreshold < handle
tmp_seg = obj.thresholdAutoSingleGrainSimpleSearch(cl_sub_recs(ii_g), 0.02);
tmp_seg.seg = gtPlaceSubVolume( ...
zeros(cl_seg.segbb(4:6), 'like', cl_seg(1).seg), ...
zeros(cl_seg(1).segbb(4:6), 'like', cl_seg(1).seg), ...
tmp_seg.seg, ...
tmp_seg.segbb(1:3) - cl_seg(1).segbb(1:3) );
tmp_seg.segbb = cl_seg(1).segbb;
......@@ -365,6 +365,10 @@ classdef GtThreshold < handle
if (~isfield(thr_params, 'do_extended'))
thr_params.do_extended = false;
end
if (~isfield(thr_params, 'percent_of_peak'))
thr_params.percent_of_peak = 2.5;
end
end
function grain_seg = thresholdAutoSingleGrain(obj, grain_rec)
......@@ -467,7 +471,7 @@ classdef GtThreshold < handle
centery = round(seed(2) - size(vol, 2) * peak_region_fact) : round(seed(2) + size(vol, 2) * peak_region_fact);
centerz = round(seed(3) - size(vol, 3) * peak_region_fact) : round(seed(3) + size(vol, 3) * peak_region_fact);
threshold_val = gtImgMeanValue(vol(centerx, centery, centerz)) / 2.5
threshold_val = gtImgMeanValue(vol(centerx, centery, centerz)) / par_thr.percent_of_peak
grain_seg = obj.segmentAndDoMorph(grain_rec, threshold_val, ...
par_thr.do_morph_recon, seed);
......
......@@ -544,7 +544,7 @@ classdef GtAssembleVol3D < handle
% Sample translation
sample_shift = obj.localPar.sample_shift;
sample_shift_size = size(sample_shift);
if sample_shift_size(2)<3
if (isempty(sample_shift) || (sample_shift_size(2) < 3))
sample_shift = [0, 0, 0];
end
......
......@@ -18,19 +18,21 @@ classdef GtGuiThresholdVolume < GtGuiThresholdGrain
filter, 'Select file...', ...
fullfile('5_reconstruction', 'volume_mask.mat'));
thr = GtThreshold();
if (exist('morpho_seed', 'var'))
seg_struct = thr.volumeThreshold(obj.conf.vol, threshold, morpho_seed);
else
seg_struct = thr.volumeThreshold(obj.conf.vol, threshold);
end
seg_struct.vol = zeros(size(obj.conf.vol), 'like', seg_struct.seg);
seg_struct.vol = gtPlaceSubVolume(seg_struct.vol, seg_struct.seg, seg_struct.segbb(1:3));
if (~isempty(filename) && filename)
thr = GtThreshold();
if (exist('morpho_seed', 'var'))
seg_struct = thr.volumeThreshold(obj.conf.vol, threshold, morpho_seed);
else
seg_struct = thr.volumeThreshold(obj.conf.vol, threshold);
end
seg_struct.vol = zeros(size(obj.conf.vol), 'like', seg_struct.seg);
seg_struct.vol = gtPlaceSubVolume(seg_struct.vol, seg_struct.seg, seg_struct.segbb(1:3));
if (filerIndex == 1)
save(fullfile(pathname, filename), '-struct', 'seg_struct', '-v7.3');
else
edf_write(seg_struct.vol, fullfile(pathname, filename));
if (filerIndex == 1)
save(fullfile(pathname, filename), '-struct', 'seg_struct', '-v7.3');
else
edf_write(seg_struct.vol, fullfile(pathname, filename));
end
end
end
end
......
......@@ -21,5 +21,5 @@ function par_rec = gtRecDefaultParameters(varargin)
% Grain segmentation related values
par_rec.thresholding = struct( ...
'percentile', 20, 'do_morph_recon', true, ...
'num_iter', 0, 'iter_factor', 1);
'percent_of_peak', 2.5, 'num_iter', 0, 'iter_factor', 1);
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