[Insight-users] meta data continued

Vincent A. Magnotta vincent-magnotta at uiowa.edu
Wed Jul 27 08:51:48 EDT 2005


Richard,

I believe that you need to set the Meta data for the image and not the
writer. You probably want something similar to this pseudo code:

image = reader->GetOutput();
image->SetMetaDataDictionary(dictionary);
writer->SetInput( image );

Vince


On Tue, 2005-07-26 at 23:45, Richard Beare wrote:
> Hi,
> I'm still having problems with meta data. I'm successfully extracting
> a dictionary from the dictionary array produced by a series reader.
> I'm able to add new key/value pairs to it - in particular I'm adding
> ITK_PatientID, ITK_PatientName, ITK_ExperimentDate,
> ITK_ExperimentTime. I can print the dictionary by iterating through it
> and confirm that the tags have been added (the Unknown part is due to
> dicom not recognising the tags):
> 
> (ITK_ExperimentDate) Unknown = 20050416
> (ITK_ExperimentTime) Unknown = 111622.52
> (ITK_PatientID) Unknown = 28121975
> 
> However, I can't seem to get any of this information to appear in
> analyze format output images, no matter what combination of flags I
> use. (I'm using spm_read_hdr in matlab to check the presence of
> patient id - let me know if there is a better way). I've looked at the
> analyze IO code and it appears to me that these tags should be
> written.
> 
> My writing code is as follows - what am I doing wrong?
> 
>       writer->SetFileName( (osm.str()).c_str());      
>       writer->SetInput( reader->GetOutput() );
>       writer->SetMetaDataDictionary(dictionary);
>       // don't use the one from the input image
>       writer->UseInputMetaDataDictionaryOn();   // I've tried both On
> and Off versions
>       writer->Print(std::cout);
>       try
> 	{
> 	writer->Update();
> 	}
>       catch (itk::ExceptionObject &ex)
> 	{
> 	std::cout << ex;
> 	return EXIT_FAILURE;
> 	}
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
-- 
Assistant Professor
Department of Radiology
0453-D JCP
200 Hawkins Drive
Iowa City, IA 52242
E-mail: vincent-magnotta at uiowa.edu
Phone: 319-356-8255
Fax: 319-353-6275
Website: http://www.radiology.uiowa.edu



More information about the Insight-users mailing list