[Insight-users] EncapsulateMetaData problem
Antoine Leimgruber
antoine.leimgruber at sokal.ch
Sat May 19 11:26:29 EDT 2007
Hi Luis,
Thank you for your answer !
Unfortunately, I have to do it because the spacing tags coming out of
the imaging modality are incorrect. (Do not be concerned, though, we
are imaging animals and not patients).
I am not quite sure to understand your statement that ITK will not
let me do it since I understood that the
DicomReadChangeHeaderWrite.cxx example demonstrates the manual
edition of Dicom tags:
//This example illustrates how to read a single DICOM slice and
write it back
//with some changed header information as another DICOM slice.
It puzzles me because edition of tags (0018|1164) and (0028|0030)
works when I run the code a second time on the output image of the
first run.
Do you mean that ITK cannot be used for editing Dicom Headers, or are
you answering the second part of my question about using ITK to erase
dicom tags ?
Antoine
Le 19 mai 07 à 06:30, Luis Ibanez a écrit :
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070519/988b5523/attachment.htm
More information about the Insight-users
mailing list