[Insight-users] EncapsulateMetaData problem

Luis Ibanez luis.ibanez at kitware.com
Sat May 19 06:30:16 EDT 2007


Hi Antoine,

Are you trying to manually edit the DICOM tag
describing the image spacing ?

If so,
ITK will not let you do that.

ITK uses the actual image spacing of the image
and writes it down in the DICOM tags.



    Regards,


       Luis



--------------------------
Antoine Leimgruber wrote:
> 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();
> [...]
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 


More information about the Insight-users mailing list