[Insight-users] Cannot change the series description (0008|103E) of a dicom file using ITK
andreasfm at web.de
andreasfm at web.de
Tue May 27 19:51:17 EDT 2008
Dear ITK users!
I want to change the header of a dicom file. It works fine with all but one dicom tag. I cannot change the series description (0008|103E).
My code below is adapted from DicomImageReadChangeHeaderWrite.
Does anyone know why
itk::EncapsulateMetaData<string>( dictionary, "0008|103E", "a new series description, THIS DOES NOT WORK" );
is not working, i.e. after saving the dicom file the tags has not changed?
Thanks,
Andreas
//****
typedef itk::ImageFileReader<TImage> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(inputFile);
typedef itk::GDCMImageIO ImageIOType;
ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
reader->SetImageIO( gdcmImageIO );
TImage::Pointer inputImage = reader->GetOutput();
typedef itk::MetaDataDictionary DictionaryType;
DictionaryType& dictionary = inputImage->GetMetaDataDictionary();
itk::EncapsulateMetaData<string>( dictionary, "0008|1010", "a new station name, THIS WORKS" );
itk::EncapsulateMetaData<string>( dictionary, "0008|103E", "a new series description, THIS DOES NOT WORK" );
typedef itk::ImageFileWriter<TImageSShort2D> WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetInput(reader->GetOutput());
writer->SetFileName(outputFile);
writer->SetImageIO(gdcmImageIO);
writer->Update();
More information about the Insight-users
mailing list