3
$\begingroup$

I'm extremely new to Mathematica. I want to import 201 .dcm (DICOM) files into Mathematica 9. Is there a way to do this which doesn't require my doing it an image at a time?

My ultimate need to is to then create a 3D image from these files.

Can anyone help?

Thanks

$\endgroup$
0

1 Answer 1

5
$\begingroup$

Quite simple:

files = FileNames["somePath/*.dicom"];
imgs = Map[Import, files];

Where Filenames finds all files in some path and Map applies the function Import to every list item in the second parameter.

If you want a progress indicator (probably a good idea for 200 images), you can do this:

files = FileNames["somePath/*.dicom"];
imgs = Monitor[Table[Import[files[[i]]], {i, Length[files]}], 
         ProgressIndicator[i/Length[files]]];
$\endgroup$
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.