Hi itk-list,<br><br><br>I&#39;m using the example of &quot;DicomSeriesReadSeriesWrite&quot;, but I&#39;d like to modify one DICOM header field before writing the Series.<br><br>Then I had a look in &quot;DicomImageReadChangeHeaderWrite&quot; and I tried to apply the part of the code that change the header field into the code of &quot;DicomSeriesReadSeriesWrite&quot;.<br>
<br><br>But it doesn&#39;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">&nbsp; typedef signed short&nbsp;&nbsp;&nbsp; PixelType;<br>
&nbsp; const unsigned int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dimension = 3;<br>&nbsp; typedef itk::Image&lt; PixelType, Dimension &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageType;<br>&nbsp; typedef itk::ImageSeriesReader&lt; ImageType &gt;&nbsp;&nbsp;&nbsp;&nbsp; ReaderType;<br>&nbsp; typedef itk::ImageFileReader&lt; ImageType &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReaderMHDType;<br>
&nbsp; typedef itk::GDCMImageIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageIOType;<br>&nbsp; typedef itk::GDCMSeriesFileNames&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NamesGeneratorType;&nbsp; <br><br>&nbsp; ImageIOType::Pointer gdcmIO = ImageIOType::New();<br>&nbsp; NamesGeneratorType::Pointer namesGenerator = NamesGeneratorType::New();<br>
&nbsp; <br>&nbsp; namesGenerator-&gt;SetInputDirectory( [...DIRECTORY...] );<br><br>&nbsp; const ReaderType::FileNamesContainer &amp; filenames = <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; namesGenerator-&gt;GetInputFileNames();<br>&nbsp;<br>&nbsp; ReaderType::Pointer reader = ReaderType::New();<br>
<br>&nbsp; reader-&gt;SetImageIO( gdcmIO );<br>&nbsp; reader-&gt;SetFileNames( filenames );<br><br>&nbsp; reader-&gt;Update();<br><br>&nbsp; <b>// BEGIN =&gt; I&#39;m trying to modify one DICOM Header field &lt;&lt;&lt;</b><br>&nbsp; <br>&nbsp; typedef itk::MetaDataDictionary&nbsp;&nbsp; DictionaryType;<br>
&nbsp; <br>&nbsp; ImageType::Pointer inputImage = reader-&gt;GetOutput();&nbsp; <br>&nbsp; DictionaryType &amp; dictionary = inputImage-&gt;GetMetaDataDictionary();&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp; std::string entryId(&quot;008|103e&quot;);<br>&nbsp; std::string value(&quot;NEW VALUE&quot;);&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; <br>&nbsp; itk::EncapsulateMetaData&lt;std::string&gt;( dictionary, entryId, value );&nbsp;&nbsp; <br>&nbsp;&nbsp; <br>&nbsp;&nbsp; <b>// END</b><br>&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; [...]<br>&nbsp;&nbsp;&nbsp; <br>&nbsp; typedef signed short&nbsp;&nbsp;&nbsp; OutputPixelType;<br>&nbsp; const unsigned int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputDimension = 2;<br>
<br>&nbsp; typedef itk::Image&lt; OutputPixelType, OutputDimension &gt;&nbsp;&nbsp;&nbsp; Image2DType;<br><br>&nbsp; typedef itk::ImageSeriesWriter&lt; ImageType, Image2DType &gt;&nbsp; SeriesWriterType;<br><br>&nbsp; SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New();<br>
<br>&nbsp; seriesWriter-&gt;SetInput( [...VOLUME...] );<br>&nbsp; seriesWriter-&gt;SetImageIO( gdcmIO );<br><br>&nbsp; namesGenerator-&gt;SetOutputDirectory( outputDirectory );<br><br>&nbsp; seriesWriter-&gt;SetFileNames( namesGenerator-&gt;GetOutputFileNames() );&nbsp; <br>
&nbsp; <br>&nbsp; seriesWriter-&gt;SetMetaDataDictionaryArray( <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader-&gt;GetMetaDataDictionaryArray() );<br><br>&nbsp; seriesWriter-&gt;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>