[Insight-users] Changing a DICOM Header... in a DICOM Series
Stéphane CALANDE
scalande at gmail.com
Wed Nov 19 07:38:06 EST 2008
Oh sorry, there was a mistake in the entry...
But the field is still not modified... :-(
Any other idea ?
Thank you Bill ;-)
Stéphane
2008/11/19 Bill Lorensen <bill.lorensen at gmail.com>
> Try
> std::string entryId("0008|103e");
> instead of
> std::string entryId("008|103e");
>
> Bill
>
> On Wed, Nov 19, 2008 at 6:53 AM, Stéphane CALANDE <scalande at gmail.com>
> wrote:
> > Hi itk-list,
> >
> >
> > I'm using the example of "DicomSeriesReadSeriesWrite", but I'd like to
> > modify one DICOM header field before writing the Series.
> >
> > 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".
> >
> >
> > 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 ?
> >
> >
> >
> > typedef signed short PixelType;
> > const unsigned int Dimension = 3;
> > typedef itk::Image< PixelType, Dimension > ImageType;
> > typedef itk::ImageSeriesReader< ImageType > ReaderType;
> > typedef itk::ImageFileReader< ImageType > ReaderMHDType;
> > typedef itk::GDCMImageIO ImageIOType;
> > typedef itk::GDCMSeriesFileNames NamesGeneratorType;
> >
> > ImageIOType::Pointer gdcmIO = ImageIOType::New();
> > NamesGeneratorType::Pointer namesGenerator = NamesGeneratorType::New();
> >
> > namesGenerator->SetInputDirectory( [...DIRECTORY...] );
> >
> > const ReaderType::FileNamesContainer & filenames =
> > namesGenerator->GetInputFileNames();
> >
> > ReaderType::Pointer reader = ReaderType::New();
> >
> > reader->SetImageIO( gdcmIO );
> > reader->SetFileNames( filenames );
> >
> > reader->Update();
> >
> > // BEGIN => I'm trying to modify one DICOM Header field <<<
> >
> > typedef itk::MetaDataDictionary DictionaryType;
> >
> > ImageType::Pointer inputImage = reader->GetOutput();
> > DictionaryType & dictionary = inputImage->GetMetaDataDictionary();
> >
> > std::string entryId("008|103e");
> > std::string value("NEW VALUE");
> >
> > itk::EncapsulateMetaData<std::string>( dictionary, entryId, value );
> >
> > // END
> >
> > [...]
> >
> > typedef signed short OutputPixelType;
> > const unsigned int OutputDimension = 2;
> >
> > typedef itk::Image< OutputPixelType, OutputDimension > Image2DType;
> >
> > typedef itk::ImageSeriesWriter< ImageType, Image2DType >
> > SeriesWriterType;
> >
> > SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New();
> >
> > seriesWriter->SetInput( [...VOLUME...] );
> > seriesWriter->SetImageIO( gdcmIO );
> >
> > namesGenerator->SetOutputDirectory( outputDirectory );
> >
> > seriesWriter->SetFileNames( namesGenerator->GetOutputFileNames() );
> >
> > seriesWriter->SetMetaDataDictionaryArray(
> > reader->GetMetaDataDictionaryArray() );
> >
> > seriesWriter->Update();
> >
> >
> >
> >
> > I would be very grateful if you could help me.
> >
> >
> > Thank you very much,
> >
> >
> >
> > Stéphane
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20081119/97fe72c8/attachment-0001.htm>
More information about the Insight-users
mailing list