[UNKNOWN_PRINT_CHARACTERISTICS] when reading MINC headers

Hello,

I am a beginner in using simpleitk. I have came across an issue with when reading specific header informatic from my MINC file resulting in [UNKNOWN_PRINT_CHARACTERISTICS]. However, when I view these information using external programs like ITKsnap, these information are present. Any suggestions on how I can fix this? See example below:

reader = sitk.ImageFileReader()
reader.SetImageIO("MINCImageIO")
reader.SetFileName(inputImageFileName)
image = reader.Execute()

metadata = {key: reader.GetMetaData(key) for key in reader.GetMetaDataKeys()}

age = metadata.get("patient:age", "")

This would then output:

[UNKNOWN_PRINT_CHARACTERISTICS]

As compared to when viewing this specific header information in ITKsnap
image

This specific information is viewable. Any suggestions on how this can be fixed?

This is a general problem with printing entries of MetaDataDictionary values from Python. @blowekamp I guess we should fix this?

Amazing! Please let me know when there is a fix or an alternative. This would definitely help stream line some of my work.

What version of SimpleITK are you using? What binaries were installed etc.?

Also do you have a sample MINC file with this field that could be shared?

@gdevenyi Do you know where this field is added into the metadata dictionary in MINICIO?

I am using 2.3.1, I can definitely share the environment I am using.

Unfortunately I canā€™t share the MINC file as itā€™s confidential. Thanks

The relevant lines which iterate over all of the header objects in the MINC file are here:

@gdevenyi Thank you. Do you have a sample MINC files with one of these array fields that I could use to further investigate?

After writing a quick implementation to call the value objectā€™s Print method or operator<< if implemented I read the documentation for the MetaDataObject class:

So it appear that this is a feature and not a bug? @hjmjohnson

It would appear that it is simpleITKā€™s responsibility to explicitly implement the Print method for these types, and avoid conflict of other libraries using ITK.

2 Likes

I hit this some time ago, and had a stab on it.

However, I didnā€™t have time to fight compilers to address reviewers comments to get to the finish line.
In case somebody wants to follow on.

2 Likes

Hereā€™s a rich MINC2 file generated by dcm2mnc,

2 Likes

@gdevenyi Thank you for the image

@phcerdan Thanks for the reference to the PR, and the open issue. Which includes @hjmjohnson comment that he is in favor of removing the old macros, and including support for printing for the MetaDataObjects directly in ITK.

I made a PR with the implementation I did before I saw yours.

It appears to work with the current infrastructure.

3 Likes