我有一系列属于一个病人的matlab图像。我在网上找到了一些代码,但它播下了一些错误。我想要这样的东西,Image
这是我的代码。
% 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,[])我在这里找到了这段代码:https://www.mathworks.com/company/newsletters/articles/accessing-data-in-dicom-files.html
Error using montage>validateColormapSyntax (line 339)索引图像可以是uint8、uint16、double、single或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,[]);发布于 2017-02-16 02:32:46
自编写该代码示例以来(早在2002年!),调用montage函数的语法已发生了变化。正如File Exchange submission for the sample DICOM data files的注释部分所述,新的正确语法如下:
montage(X, 'DisplayRange', []);由于新语法将montage(X, []);解释为具有空颜色映射[]的索引彩色图像(根据错误,这不允许是带符号的int16类型),因此您会得到该错误。
https://stackoverflow.com/questions/42256815
复制相似问题