Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading Dicom MR Images

0 views
Skip to first unread message

Kate

unread,
Aug 5, 2003, 10:05:42 AM8/5/03
to
I want to read a series of MR images (Dicom format) into matlab so
that I can project these in 3-D. Currently I have a directory
containing 33 dicom images each of which represents one slice. Does
anyone know how I can read these images into a 4-D (128x128x1x33)
array for image processing purposes using dimcomread? I know how to
read in one of the images but cannot figure out how to read in all 33
to the same array using a single command that will access the series
of images in the directory. Each has the same root file name with a
numerical identifier at the end indicating which image in the series
it is. For example: JaneDoe_000000, JaneDoe_000001, JaneDoe_000002,
etc.

Thankyou
Kate Morgan
Research Technician
Department of Medical Imaging
University of Toronto

Jeff Mather

unread,
Aug 13, 2003, 10:03:43 AM8/13/03
to
Kate wrote:
> I want to read a series of MR images (Dicom format) into matlab so
> that I can project these in 3-D. Currently I have a directory
> containing 33 dicom images each of which represents one slice. Does
> anyone know how I can read these images into a 4-D (128x128x1x33)
> array for image processing purposes using dimcomread? I know how to
> read in one of the images but cannot figure out how to read in all 33
> to the same array using a single command that will access the series
> of images in the directory. Each has the same root file name with a
> numerical identifier at the end indicating which image in the series
> it is. For example: JaneDoe_000000, JaneDoe_000001, JaneDoe_000002,
> etc.

Hi Kate,

There's no single command you can give that will read the entire
directory of DICOM files into one array, but you can use this code:

% Preallocate the array (using the dimensions you gave).
% You may need to change the datatype to match what the file contains.
X(128, 128, 1, 33) = int16(0);

d = dir('JaneDoe*');

for p = 1:numel(d)
X(:,:,:,p) = dicomread(d(p).name);
end


Voilà.

Jeff Mather
Image Processing Group
The MathWorks, Inc.
jma...@mathworks.com

0 new messages