[Insight-users] UnaryFunctorImageFilter and MetadataDictionnary handling

Julien Michel julien.michel at c-s.cnes.fr
Fri Mar 16 11:25:03 EST 2007


Dear ITK users,

We are using the MetaDataDictionary attribute of the class itk::Object 
to store additionnal metadata in our custom Image class, deriving from 
itk::Image.

In order to get these metadata propagated through the pipeline, we did 
override the CopyInformation(DataObject * data) method of our Image 
class, first calling the superclass implementation, and then copy the 
MetaDataDictionary of data into our own MetaDataDictionary attribute. 
This method is usually called in the GenerateOutputInformation() method 
of the filters.

The most high level implementation of GenerateOutputInformation() is 
provided by itk::ProcessObject, which calls the CopyInformation() from 
input to output.

itk::ImageToImageFilter override this method, doing some more copying, 
but it first calls the Superclass implemntation, so the 
CopyInformation() is used. Therefore Filters deriving directly from this 
class (such as itk::DiscreteGaussianImageFilter) propagates our metadata 
through the pipeline.

The problem appears with the itk::UnaryFunctorImageFilter. It derives 
from itk::ImageToImageFilter, but it overrides the 
GenerateOutputInformation(), without calling the Superclass 
implementation (for dimensions reasons) and without doing a 
CopyInformation() from input to output by itself. Therefore our metadata 
are lost whenever there is a filter deriving from 
itk::UnaryFunctorImageFilter in our pipeline.

It might not be the only base class to behave like this (maybe 
itk::BinaryFunctorImageFilter does the same), but I did not check for 
the moment.

I don't know if it is a known issue, or if it has been implemented like 
this willingly for some reason. Anyway, I wanted to report it.

Thanks a lot for your work, I hope this will contribute a little,

Best Regards,

Julien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: julien.michel.vcf
Type: text/x-vcard
Size: 255 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20070316/c4fe5bd1/julien.michel.vcf


More information about the Insight-users mailing list