-
Nicola Vigano authored
Signed-off-by:
Nicola Vigano <nicola.vigano@esrf.fr>
Nicola Vigano authoredSigned-off-by:
Nicola Vigano <nicola.vigano@esrf.fr>
GtGuiThresholdVolume.m 1.21 KiB
classdef GtGuiThresholdVolume < GtGuiThresholdGrain
properties
end
methods (Access = public)
function obj = GtGuiThresholdVolume(vol, varargin)
varargin(end+1:end+2) = {'cmap', 'constant(1)'};
obj = obj@GtGuiThresholdGrain(vol, varargin{:});
obj.setSegmentFunction(@(thr, morph)segmentVolume(obj, thr, morph));
end
end
methods (Access = protected)
function segmentVolume(obj, threshold, morpho)
filter = {fullfile('5_reconstruction', '*.mat'), 'MATLAB Files (*.mat)';
fullfile('5_reconstruction', '*.edf'), 'EDF files (ESRF Data Format, *.edf)'};
[filename, pathname, filerIndex] = uiputfile(filter, 'Select file...', 'volume_mask.mat');
thr = GtThreshold();
if (exist('morpho', 'var'))
vol = thr.thresholdVolume(obj.conf.vol, threshold, morpho);
else
vol = thr.thresholdVolume(obj.conf.vol, threshold);
end
if (filerIndex == 1)
save(fullfile(pathname, filename), 'vol', '-v7.3');
else
edf_write(vol, fullfile(pathname, filename));
end
end
end
end