簡體   English   中英

在matlab中將dicom圖像系列轉換為特定格式

[英]Series of dicom images into specific format in matlab

我有一系列屬於單個病人的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,[]);

自編寫代碼示例以來,調用montage函數的語法已經改變(早在2002年!)。 正如文件交換提交的注釋部分中對示例DICOM數據文件所述,新的正確語法是:

montage(X, 'DisplayRange', []);

因為新語法解釋了montage(X, []);所以你得到了這個錯誤montage(X, []); 好像X是一個索引的彩色圖像(根據錯誤不允許是有符號的int16類型),帶有空的彩色圖[]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM