[Insight-users] EncapsulateMetaData problem
Antoine Leimgruber
antoine.leimgruber at sokal.ch
Fri May 18 16:35:11 EDT 2007
Dear all,
I am trying to edit 3 dicoms tags (see section of code at the end of the message).
When I run the code once, the output dicom image has 2 of the 3 tags edited. The tag 0028|0030 remains unchanged.
If I run the code again with the previous output image as input, then the third tag of the new output is also edited.
What can I do to avoid running twice my code on each image ?
An alternative would be to remove the tag 0018|1164 from the header. How can I do it ?
Thank you for your help
Antoine
[...]
InputImageType::Pointer inputImage = reader->GetOutput();
typedef itk::MetaDataDictionary DictionaryType;
DictionaryType & dictionary = inputImage->GetMetaDataDictionary();
itk::EncapsulateMetaData<std::string>(dictionary,"0018|1164", std::string("0.164800\\0.312500"));
itk::EncapsulateMetaData<std::string>(dictionary,"0028|0030", std::string("0.164800\\0.312500")); itk::EncapsulateMetaData<std::string>(dictionary,"0010|0010", std::string("y pixel size edited"));
typedef itk::ImageFileWriter< InputImageType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetInput( reader->GetOutput() );
writer->SetFileName( argv[2] );
writer->SetImageIO( gdcmImageIO );
try
{
writer->Update();
[...]
More information about the Insight-users
mailing list