I have series of matlab images which belong to a single patient. I found some code online, but it is sowing some error. I want something like this, Image
Here is the code I have.
% Preallocate the 256-by-256-by-1-by-20 image array.
X = repmat(int16(0), [256 256 1 20]);
% Read the series of images.
for p=1:20
filename = sprintf('brain_%03d.dcm', p);
X(:,:,1,p) = dicomread(filename);
end
% Display the image stack.
montage(X,[])
I found this code from here: https://www.mathworks.com/company/newsletters/articles/accessing-data-in-dicom-files.html
Error using montage>validateColormapSyntax (line 339)
An indexed image can be uint8, uint16, double, single, or logical.
Error in montage>parse_inputs (line 259)
cmap = validateColormapSyntax(I,varargin{2});
Error in montage (line 114)
[I,cmap,mSize,indices,displayRange,parent] = parse_inputs(varargin{:});
Error in Untitled2 (line 9)
montage(X,[]);
Error in Untitled2 (line 9) montage(X,[]);
I used this example along with their given dataset. – Muhammad Usman