Error while reading DICOM images in simple program
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nitinkumar Ambekar
le 20 Déc 2015
Commenté : Walter Roberson
le 21 Déc 2015
% 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 am getting error as :
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 main (line 11)
montage(X,[]);
What I am doing wrong here? When I comment montage(), it runs without any error. Thanks for you time.
0 commentaires
Réponse acceptée
Walter Roberson
le 20 Déc 2015
If the data signed 16 bit like you seem to indicate, then you will need to use
X = zeros(256, 256, 1, 20);
If the data is unsigned 16 bit then you can use
X = zeros(256, 256, 1, 20, 'uint16');
6 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!