首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在matlab中将dicom系列图像转换为特定格式

在matlab中将dicom系列图像转换为特定格式
EN

Stack Overflow用户
提问于 2017-02-16 01:58:42
回答 1查看 286关注 0票数 3

我有一系列属于一个病人的matlab图像。我在网上找到了一些代码,但它播下了一些错误。我想要这样的东西,Image

这是我的代码。

代码语言:javascript
复制
% 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

代码语言:javascript
复制
Error using montage>validateColormapSyntax (line 339)

索引图像可以是uint8、uint16、double、single或logical。

代码语言:javascript
复制
    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,[]);
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-16 02:32:46

自编写该代码示例以来(早在2002年!),调用montage函数的语法已发生了变化。正如File Exchange submission for the sample DICOM data files的注释部分所述,新的正确语法如下:

代码语言:javascript
复制
montage(X, 'DisplayRange', []);

由于新语法将montage(X, []);解释为具有空颜色映射[]的索引彩色图像(根据错误,这不允许是带符号的int16类型),因此您会得到该错误。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42256815

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档