Hi itk-list,<br><br><br>I'm using the example of "DicomSeriesReadSeriesWrite", but I'd like to modify one DICOM header field before writing the Series.<br><br>Then I had a look in "DicomImageReadChangeHeaderWrite" and I tried to apply the part of the code that change the header field into the code of "DicomSeriesReadSeriesWrite".<br>
<br><br>But it doesn't seem to work. The field I want to change has not changed in the output files. Could you have a look in the (simplified) following code to help me ?<br><br><br><br><font face="courier new,monospace"> typedef signed short PixelType;<br>
const unsigned int Dimension = 3;<br> typedef itk::Image< PixelType, Dimension > ImageType;<br> typedef itk::ImageSeriesReader< ImageType > ReaderType;<br> typedef itk::ImageFileReader< ImageType > ReaderMHDType;<br>
typedef itk::GDCMImageIO ImageIOType;<br> typedef itk::GDCMSeriesFileNames NamesGeneratorType; <br><br> ImageIOType::Pointer gdcmIO = ImageIOType::New();<br> NamesGeneratorType::Pointer namesGenerator = NamesGeneratorType::New();<br>
<br> namesGenerator->SetInputDirectory( [...DIRECTORY...] );<br><br> const ReaderType::FileNamesContainer & filenames = <br> namesGenerator->GetInputFileNames();<br> <br> ReaderType::Pointer reader = ReaderType::New();<br>
<br> reader->SetImageIO( gdcmIO );<br> reader->SetFileNames( filenames );<br><br> reader->Update();<br><br> <b>// BEGIN => I'm trying to modify one DICOM Header field <<<</b><br> <br> typedef itk::MetaDataDictionary DictionaryType;<br>
<br> ImageType::Pointer inputImage = reader->GetOutput(); <br> DictionaryType & dictionary = inputImage->GetMetaDataDictionary(); <br> <br> std::string entryId("008|103e");<br> std::string value("NEW VALUE"); <br>
<br> itk::EncapsulateMetaData<std::string>( dictionary, entryId, value ); <br> <br> <b>// END</b><br> <br> [...]<br> <br> typedef signed short OutputPixelType;<br> const unsigned int OutputDimension = 2;<br>
<br> typedef itk::Image< OutputPixelType, OutputDimension > Image2DType;<br><br> typedef itk::ImageSeriesWriter< ImageType, Image2DType > SeriesWriterType;<br><br> SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New();<br>
<br> seriesWriter->SetInput( [...VOLUME...] );<br> seriesWriter->SetImageIO( gdcmIO );<br><br> namesGenerator->SetOutputDirectory( outputDirectory );<br><br> seriesWriter->SetFileNames( namesGenerator->GetOutputFileNames() ); <br>
<br> seriesWriter->SetMetaDataDictionaryArray( <br> reader->GetMetaDataDictionaryArray() );<br><br> seriesWriter->Update(); <br><br><br><br><br><font face="arial,helvetica,sans-serif">I would be very grateful if you could help me.<br>
<br><br>Thank you very much,<br><br><br><br>Stéphane<br></font></font>