From a45c94339477108ec512a6761111d5988e489bc5 Mon Sep 17 00:00:00 2001 From: Michael-Sun Date: Mon, 4 Dec 2023 11:04:12 -0500 Subject: [PATCH] Some minor fixes --- CanlabCore/@region/isosurface.m | 10 +++++----- CanlabCore/@region/region.m | 8 +++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CanlabCore/@region/isosurface.m b/CanlabCore/@region/isosurface.m index 6de743a8..712d8500 100644 --- a/CanlabCore/@region/isosurface.m +++ b/CanlabCore/@region/isosurface.m @@ -82,20 +82,20 @@ cl = region2struct(r); -% surface_handles = []; % This appears to be a bug, as it coerces the Patch object into a double. 05/23/2023 MS -surface_handles = {}; +surface_handles = []; % This appears to be a bug, as it coerces the Patch object into a double. 05/23/2023 MS +% surface_handles = {}; for i = 1:k try out = imageCluster('cluster', cl(i), 'color', colors{i}, varargin{:}); -% surface_handles(i) = out; % This appears to be a bug, as it + surface_handles(i) = out; % This appears to be a bug, as it % coerces the Patch object into a double. 05/23/2023 MS - surface_handles{i} = out; +% surface_handles{i} = out; catch disp('Error imaging isosurface; too few voxels?') - %surface_handles(i) = []; + surface_handles(i) = []; end % % Isocaps, if needed diff --git a/CanlabCore/@region/region.m b/CanlabCore/@region/region.m index a2b7612d..ca5c9ad4 100644 --- a/CanlabCore/@region/region.m +++ b/CanlabCore/@region/region.m @@ -384,9 +384,11 @@ obj(i).dim = mask.volInfo.dim; obj(i).numVox = size(obj(i).XYZ, 2); - obj(i).center = center_of_mass(myXYZ, double(obj(i).Z)); - obj(i).mm_center = center_of_mass(obj(i).XYZmm, double(obj(i).Z)); - + if ~isempty(myXYZ) % XYZ initialization may be skipped, so skip this if so MS 2/15/2023 + obj(i).center = center_of_mass(myXYZ, double(obj(i).Z)); + obj(i).mm_center = center_of_mass(obj(i).XYZmm, double(obj(i).Z)); + end + if ~isempty(mask.volInfo.fname) [~, ff, ee] = fileparts(mask.volInfo.fname); obj(i).custom_info1 = [ff ee];