2

我有 3D CT 图像的 2D 切片。它们是DICOM格式的,其中有 250 个。我想用 MATLAB 重建 3D 图像。我怎样才能在一个循环中做到这一点?

  • 我在我的 Ubuntu 系统上使用 MATLAB R2010b。
  • 图片的位置是:/home/amadeus/Desktop/images
  • 图像命名为:

    IM-0001-0001.dcm
    IM-0001-0002.dcm
    IM-0001-0003.dcm
    ...
    IM-0001-0250.dcm
    
4

1 回答 1

4

显然有一个函数只用于读取 DICOM 文件:dicomread,我建议使用它来加载图像,然后将它们存储在 3D 矩阵中。sprintf可用于构造图像的文件名(用于%04d生成带前导零的四位数字)。

假设所有图像都对齐并具有相同的大小:

N = 250;
img_dir = '/home/amadeus/Desktop/images'

% read the first image separately just to get the size
strfile = 'IM-0001-0001.dcm';
img = dicomread(fullfile(img_dir, strfile));
siz_img = size(img);

% create result matrix:
ct3d = NaN([siz_img N]);
ct3d(:,:,1) = img;    

% load all the remaining images and put them in the matrix
for ii=2:N
    strfile = sprintf('IM-0001-%04d.dcm',ii);
    ct3d(:,:,ii)= dicomread(fullfile(img_dir, strfile));
end

编辑:这假设图像是灰度(2d)。如果它们是全彩色的(宽 x 高 x 3),您应该在分配给ct3d.

于 2012-10-09T13:55:51.900 回答