Skip to content
Snippets Groups Projects
Commit d4c2e307 authored by Lorenzo Valzania's avatar Lorenzo Valzania Committed by Nicola Vigano
Browse files

GtSample/GtPhase: fixed a few bugs introduced by removing the GtGrain class

parent 58031f69
No related branches found
No related tags found
No related merge requests found
......@@ -100,7 +100,7 @@ classdef GtThreshold < handle
gauge.incrementAndDisplay();
try
grain = obj.loadGrain(phaseID, grainID);
grain = obj.loadGrain(phaseID, grainID, sample);
% Actually threshold now!
if (obj.checkIsIterative())
......@@ -144,8 +144,11 @@ classdef GtThreshold < handle
% GTTHRESHOLD/singleGrainThresholdInFile
% grain = singleGrainThresholdInFile(obj, phaseID, grainID, threshold, center)
samplefile = fullfile(obj.param.acq.dir, '4_grains', 'sample.mat');
sample = GtSample.loadFromFile(samplefile);
fprintf('Segmenting Grain %d, from phase %d.. ', grainID, phaseID);
grain = obj.loadGrain(phaseID, grainID);
grain = obj.loadGrain(phaseID, grainID, sample);
if (exist('center', 'var'))
do_morpho = true;
......
......@@ -47,10 +47,6 @@ classdef GtPhase < handle
% grains
obj.grains_number = number;
obj.grains = cell(number,1);
for ii = 1:number
obj.grains{ii} = GtGrain();
end
obj.selectedGrains = true(number, 1);
obj.completeness = ones(number, 1);
obj.center = zeros(number, 3);
......@@ -70,7 +66,6 @@ classdef GtPhase < handle
% GTPHASE/PUSHGRAIN Adds a new empty grain at the end of the list
obj.grains_number = obj.grains_number + 1;
obj.grains{end+1} = GtGrain();
obj.selectedGrains = [obj.selectedGrains; true];
obj.completeness = [obj.completeness; 1];
obj.center = [obj.center; 0 0 0];
......@@ -90,7 +85,6 @@ classdef GtPhase < handle
copy.active = obj.active;
copy.volumeFile = obj.volumeFile;
copy.grains = obj.grains;
copy.selectedGrains = obj.selectedGrains;
copy.completeness = obj.completeness;
copy.center = obj.center;
......@@ -135,9 +129,9 @@ classdef GtPhase < handle
end
% grains fields
function setMergeIDs(obj, grainid, ids)
obj.grains{grainid}.mergeIDs = ids;
end
% function setMergeIDs(obj, grainid, ids)
% obj.grains{grainid}.mergeIDs = ids;
% end
function setUseExtended(obj, grainid, use_ext)
obj.use_extended(grainid, 1) = use_ext;
......@@ -197,13 +191,9 @@ classdef GtPhase < handle
end
% grains fields
function ids = getMergeIDs(obj, grainid)
ids = obj.grains{grainid}.mergeIDs;
end
function grain = getGrain(obj, grainid)
grain = obj.grains{grainid};
end
% function ids = getMergeIDs(obj, grainid)
% ids = obj.grains{grainid}.mergeIDs;
% end
function grainIDs = getGrainsWithCompletenessLessThan(obj, value)
% GTPHASE/GETGRAINSWITHCOMPLETENESSLESSTHAN Gets grains with
......@@ -251,7 +241,7 @@ classdef GtPhase < handle
if (~exist('oversize', 'var'))
oversize = 1;
end
numGrains = length(obj.grains);
numGrains = obj.getNumberOfGrains();
replOnes = ones(numGrains, 1);
halfLengths = obj.boundingBox(:, 4:6) / 2;
......
......@@ -1712,7 +1712,7 @@ classdef GtGrainsManager < GtVolView
filePath = fullfile(obj.dataDir, '4_grains', ...
sprintf('phase_%02d', phaseID), 'grain_*.mat');
fileInfo = dir(filePath);
numGrains = length(phase.grains);
numGrains = phase.getNumberOfGrains();
if (length(fileInfo) < numGrains)
upToDate = false;
return
......
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