Page MenuHomePhabricator

Serialization of mitk::Image properties in/from NRRD (simplified solution)
Closed, ResolvedPublic

Description

For several use cases we need the possibility to serialize properties of the image (BaseData) into a nrrd file and restore the information when the nrrd file is loaded again.

We could build upon the fact that, the itk NRRD IO Implementation is implemented in such a way, that every MetaProperty in the MetaDictrionary will be added as NRRD-Tag in the saved image. And, when reading NRRD files, the tags will be added as key-value-pairs to the MetaDictionary.

The proposed simple solution is to just use this mechanism and extend mitk::ItkImageIO in such a way that it adds the Properties to the MetaDictionary when writing the data. When reading the data it transfers relevant tags from the MetaDictionary to the Properties of the image.

To mark relevant tags and to avoid tag name conflicts with other code. I would propose to use a namespace/prefixe to all properties stored by the mechanism.

Prefix would be "org.mitk." and it would be added to every property name before added to the MetaDictionary and therefore to nrrd file.
If loaded, the prefix would be stripped before the property is added to the mitk::Image.

Current limitation of the current proposal would be that all properties (after loading would be of type string).
This is no problem for my current use cases. On the last MITK hack fest strategies to allow type specific property "reconstruction" where discussed. They involve a bit more infrastructural work.

Therefore I would propose/prefer that this extension is made in a succeeding bug.

Event Timeline

Please compare T19222 and T19209 . Do these already meet your requirements?

It was implictly fixed by the fixing the bugs Caspar mentioned and the fixes for T19775 and T19774