I have a situation where I need to create some custom filters (derived from an itk::ImageToImageFilter) that modify an input image, but I also want to keep track of some metadata generated by one filter (e.g: a std::vector) that will be used later on by another filter. It seems that this could be handled by accessing and adding to a MetaDataDictionary inside a filter’s GenerateData() method doing something like:
auto outputDict = outputPtr->GetMetaDataDictionary();
itk::EncapsulateMetaData(outputDict, “Float”, float(1.0));
(for a trivial case of just inserting a float into the dictionary). What I’m finding is that none of the additions to the dictionary get carried through to the output. I imagine that I’m missing some important steps, but can’t find much documentation on this particular topic. Any advice would be much appreciated. A test program is attached.
TestITKMetaData.cpp (4.3 KB)