[Insight-users] Writing a DICOM 2D Series into a specific directory

Andreas Siegrist andreas.siegrist at gmail.com
Thu Aug 5 18:16:47 EDT 2010


I'm failing at trying to write a DICOM series in a specified folder.
Check out the code below. I'm explicitly setting the folder "extDicom" as
output directory.
Yet, the files are always written to the current working directory where the
application is in.
Regardless of the folder I'm telling the NamesGenerator...
What am I doing wrong?

typedef itk::GDCMImageIO ImageIOType;

typedef itk::GDCMSeriesFileNames NamesGeneratorType;


 typedef unsigned short OutputPixelType;

const unsigned OutputDimension = 2;

typedef itk::Image<OutputPixelType, OutputDimension> Image2DType;

typedef itk::ImageSeriesWriter<ItkImageType, Image2DType> SeriesWriterType;


 ImageIOType::Pointer gdcmIO = ImageIOType::New();


 SeriesWriterType::Pointer writer = SeriesWriterType::New();

writer->SetInput(itkImage);

writer->SetImageIO(gdcmIO);


 NamesGeneratorType::Pointer namesGenerator = NamesGeneratorType::New();

namesGenerator->SetOutputDirectory("extDicom");


 const SeriesWriterType::FileNamesContainer & filenames =
namesGenerator->GetOutputFileNames();


 writer->SetFileNames(filenames);

writer->SetMetaDataDictionary(itkImage->GetMetaDataDictionary());


 writer->Update();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100806/a3f7b8fa/attachment.htm>


More information about the Insight-users mailing list