Skip to content

Commit 4c1bfc9

Browse files
committed
fix computation of type from data size
1 parent 7467d0a commit 4c1bfc9

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/@Image/Image.m

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,22 @@ function setInnerData(obj, data)
305305

306306
function initImageType(obj)
307307
% Determines a priori the type of image
308-
if islogical(obj.Data)
309-
obj.Type = 'binary';
310-
elseif isfloat(obj.Data)
311-
obj.Type = 'intensity';
312-
elseif obj.DataSize(4) == 3
313-
obj.Type = 'color';
308+
309+
if obj.DataSize(4) == 1
310+
if islogical(obj.Data)
311+
obj.Type = 'binary';
312+
elseif ismember(class(obj.Data), {'uint8', 'uint16', 'uint32'})
313+
obj.Type = 'grayscale';
314+
else
315+
obj.Type = 'intensity';
316+
end
317+
314318
elseif obj.DataSize(4) == 2
315319
obj.Type = 'complex';
320+
321+
elseif obj.DataSize(4) == 3
322+
obj.Type = 'color';
323+
316324
elseif obj.DataSize(4) > 3
317325
obj.Type = 'vector';
318326
end

0 commit comments

Comments
 (0)