[Insight-users] meta data continued

Richard Beare richard.beare at gmail.com
Wed Jul 27 00:45:35 EDT 2005


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;
	}


More information about the Insight-users mailing list