scifio / scifio-imageio

SCIFIO ImageIO plugin for ITK
15 stars 14 forks source link

MHA created from DM3 with SCIFIO not readable due to header #57

Open romangrothausmann opened 5 years ago

romangrothausmann commented 5 years ago

I stumbled over the problem (https://github.com/romangrothausmann/ITK-CLIs/commit/4fa84310e05451aaf94322d0f93f554d21d905a8) that an MHA created from a DM3 with SCIFIO was not readable by ITK again. It seems that is due to the very long/verbose header possibly containing some info that ITK's metaIO cannot cope with. The test DM3 can be found here: https://github.com/romangrothausmann/ITK-CLIs/blob/4fa84310e05451aaf94322d0f93f554d21d905a8/tests/data/test.dm3

romangrothausmann commented 5 years ago

Not sure if this is a SCIFIO issue or if it should go to https://github.com/Kitware/MetaIO?

dzenanz commented 5 years ago

It might need to go into https://github.com/Kitware/MetaIO. Does read .dm3, write .mha, read .mha create the problem? Or are there additional ingredients necessary?

romangrothausmann commented 5 years ago

Thanks @dzenanz for taking a look

Does read .dm3, write .mha, read .mha create the problem?

Yes, in https://github.com/romangrothausmann/ITK-CLIs/commit/4fa84310e05451aaf94322d0f93f554d21d905a8 it was a mere conversion from DM3 to MHA (https://github.com/romangrothausmann/ITK-CLIs/blob/412a55c708056f28fd6cf7132067d05aafae171d/file_converter.cxx) and then reading the MHA again for getting the stats (https://github.com/romangrothausmann/ITK-CLIs/blob/412a55c708056f28fd6cf7132067d05aafae171d/stat.cxx).

dzenanz commented 5 years ago

If any of the metadata fields contain a line break, that will be a problem. Some other stuff might be offensive too, I am not sure which.

romangrothausmann commented 5 years ago

Well, I guess the question is whether SCIFIO creates some inappropriate headers from this DM3 or whether MetaIO has problems with some headers that are acceptable. NB: When reading an image series of DM3s and saving that as MHA/MHD (with e.g. file-series_reader or subimage_extract_series) the probem does not arise.