diff --git a/zUtil_TomoUtils/GtGrainsManager.m b/zUtil_TomoUtils/GtGrainsManager.m index 2efb9716ebfacb4f56aa5416e35610ffb10866cc..1084b6bdb62ca889000cd183574ae6e16b9dc50a 100644 --- a/zUtil_TomoUtils/GtGrainsManager.m +++ b/zUtil_TomoUtils/GtGrainsManager.m @@ -371,8 +371,12 @@ classdef GtGrainsManager < GtVolView bboxList = sample.phases{phaseID}.simpleSearchBBtouched(voxel); for jj = 1:length(bboxList) grainID = bboxList(jj); - seg = obj.cache.get('grain', {phaseID, grainID}, 'seg'); - if isempty(seg) + try + gr_seg = obj.cache.get('grain_det', {phaseID, grainID}, 'SEG'); + catch + gr_seg = obj.cache.get('grain', {phaseID, grainID}, {'seg'}); + end + if (isempty(gr_seg.seg) || numel(gr_seg.seg) == 1) fprintf('Segmentation volume for grain %d is empty. Please run Reconstruction and 3d Threshold again!\n', grainID) continue end @@ -999,8 +1003,12 @@ classdef GtGrainsManager < GtVolView % % viewSegmentedGrain(obj, phaseID, grainID) - grainSeg = obj.cache.get('grain', {phaseID, grainID}, 'seg'); - GtVolView(grainSeg); + try + gr_seg = obj.cache.get('grain_det', {phaseID, grainID}, 'SEG'); + catch + gr_seg = obj.cache.get('grain', {phaseID, grainID}, {'seg'}); + end + GtVolView(gr_seg.seg); end function displayForwardSim(obj, phaseID, grainID, varargin) @@ -1329,7 +1337,11 @@ classdef GtGrainsManager < GtVolView % GTGRAINSMANAGER/GETCONTOUROFGRAIN Function that gets border of grains, % when grain is not into assembled volume sample = obj.getSample(); - vol = obj.cache.get('grain', {phaseID, grainID}, 'seg'); + try + gr_seg = obj.cache.get('grain_det', {phaseID, grainID}, 'SEG'); + catch + gr_seg = obj.cache.get('grain', {phaseID, grainID}, {'seg'}); + end bbox = sample.phases{phaseID}.getBoundingBox(grainID); indx = obj.conf.slicendx - bbox(obj.conf.ortDim); @@ -1337,15 +1349,15 @@ classdef GtGrainsManager < GtVolView switch (obj.conf.ortDim) case 3 % equivalent to plane 'xy' or 'yx' slice = zeros(obj.conf.dim(1), obj.conf.dim(2)); - sliceVol = vol(:, :, indx); + sliceVol = gr_seg.seg(:, :, indx); slice = gtPlaceSubVolume(slice, sliceVol, ([bbox(1) bbox(2) 1]-1)); case 1 % equivalent to plane 'yz' or 'zy' slice = zeros(obj.conf.dim(2), obj.conf.dim(3)); - sliceVol = squeeze(vol(indx, :, :)); + sliceVol = squeeze(gr_seg.seg(indx, :, :)); slice = gtPlaceSubVolume(slice, sliceVol, ([1 bbox(2) bbox(3)]-1)); case 2 % equivalent to plane 'zx' or 'xz' slice = zeros(obj.conf.dim(1), obj.conf.dim(3)); - sliceVol = squeeze(vol(:, indx, :)); + sliceVol = squeeze(gr_seg.seg(:, indx, :)); slice = gtPlaceSubVolume(slice, sliceVol, ([bbox(1) 1 bbox(3)]-1)); end