Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

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

share|improve this question

marked as duplicate by Yves Klett, rasher, Kuba, Michael E2, m_goldberg Mar 28 at 13:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

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]]];
share|improve this answer
    
Thank you, that seems to work –  Palaeoanth Mar 28 at 6:56

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