[Insight-users] How to write/read a single 3D Dicom image

Kai Li likai at cs.uoregon.edu
Tue Jun 21 14:35:10 EDT 2005


Hi,
  I tried to write a 3D image to a file in Dicom format but didn't
succeed. Here's what I did:

typedef itk::ImageFileWriter ImageFileWriterType;
typedef typename ImageFileWriterType::Pointer ImageFileWriterPointer;
ImageFileWriterPointer writer = ImageFileWriterType::New();
writer->SetInput(image);
writer->SetFilename("MyDicomImage.dcm");
writer->Update();

Finding the above code does not work, I inserted the following two lines
before the writer->Update, but without any luck:

itk::GDCMImageIO::Pointer gdcmImageIO = itk::GDCMImageIO::New();
writer->SetImageIO(gdcmImageIO);

Instead of GDCMImageIO, I also tried itk::DicomImageIO with the same
result.

Any help is appreciated.

Kai


More information about the Insight-users mailing list