> I have 2D slices of a 3D CT image. They are in DICOM format and there are 250 of
> them. I want to reconstruct the 3D image with MATLAB. How can I do this in a loop?
[snip]
> Images' location is: /home/amadeus/Desktop/images
> Their names go like: IM-0001-0001.dcm, IM-0001-0002.dcm, IM-0001-0003.dcm, ....
> IM-0001-0250.dcm
I'm going to go out on a limb and say that the 2D slices you have don't need "reconstruction," per se. They probably just need to be put into one brick of data. If the slices are the same size and already in Z-order by filename, then it's pretty straightforward.
meta = dicominfo('IM-0001-0001.dcm');
data = zeros([meta.Height, meta.Width, 250], 'int16');
for p = 1:250
fname = sprintf('IM-0001-%04d.dcm', p);
data(:,:,p) = dicomread(fname);
end
Just remember as you're working with this data that the X and Y pixel spacing is probably much, much finer than the Z spacing.
Jeff