# \[UNKNOWN\_PRINT\_CHARACTERISTICS\] when reading MINC headers

**URL:** <https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180>\
**Category:** Beginner Questions\
**Created:** [August 16, 2024, 1:49pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180 "2024-08-16T13:49:57Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Confused](https://discourse.itk.org/user_avatar/discourse.itk.org/confused/32/4340_2.png) [@Confused](https://discourse.itk.org/u/Confused)\
**Post date:** [August 16, 2024, 1:49pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/1 "2024-08-16T13:49:58Z")

</div>

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:

```auto
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:

```auto
[UNKNOWN_PRINT_CHARACTERISTICS]

```

As compared to when viewing this specific header information in ITKsnap  
 ![image](https://discourse.itk.org/uploads/default/original/2X/d/dfef5acc1b55639f641c19b798dc906206974ea3.png)

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

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [August 16, 2024, 2:03pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/2 "2024-08-16T14:03:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Confused](https://discourse.itk.org/user_avatar/discourse.itk.org/confused/32/4340_2.png) [@Confused](https://discourse.itk.org/u/Confused)\
**Post date:** [August 16, 2024, 2:12pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/3 "2024-08-16T14:12:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [August 16, 2024, 2:30pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/4 "2024-08-16T14:30:39Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Confused](https://discourse.itk.org/user_avatar/discourse.itk.org/confused/32/4340_2.png) [@Confused](https://discourse.itk.org/u/Confused)\
**Post date:** [August 16, 2024, 2:52pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/5 "2024-08-16T14:52:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gdevenyi](https://discourse.itk.org/user_avatar/discourse.itk.org/gdevenyi/32/355_2.png) [@gdevenyi](https://discourse.itk.org/u/gdevenyi)\
**Post date:** [August 20, 2024, 3:53pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/6 "2024-08-20T15:53:46Z")

</div>

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

> <https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/IO/MINC/src/itkMINCImageIO.cxx#L742-L858>

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [August 20, 2024, 5:08pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/7 "2024-08-20T17:08:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [August 20, 2024, 5:46pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/8 "2024-08-20T17:46:49Z")

</div>

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:

> <https://github.com/InsightSoftwareConsortium/ITK/blob/52cfd0b6f7228e72837644d41efb3b20e829447a/Modules/Core/Common/include/itkMetaDataObject.h#L61-L69>

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.

---

<div class="post-metadata">

**Author:** ![phcerdan](https://discourse.itk.org/user_avatar/discourse.itk.org/phcerdan/32/286_2.png) [@phcerdan](https://discourse.itk.org/u/phcerdan)\
**Post date:** [August 20, 2024, 11:15pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/9 "2024-08-20T23:15:21Z")

</div>

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

> <https://github.com/InsightSoftwareConsortium/ITK/pull/4368>
>
> Also removes dead code related to METADATAPRINT
> 
> Fix #1454
> 
> \## PR Checklist
> …
> \- \[x\] No \[API changes\](https://github.com/InsightSoftwareConsortium/ITK/blob/master/CONTRIBUTING.md#breaking-changes) were made (or the changes have been approved)
> \- \[x\] No \[major design changes\](https://github.com/InsightSoftwareConsortium/ITK/blob/master/CONTRIBUTING.md#design-changes) were made (or the changes have been approved)
> \- \[x\] Added test (or behavior not changed)
> \- \[x\] Updated API documentation (or API not changed)
> \- \[NA\] Added Python wrapping to new files (if any) as described in \[ITK Software Guide\](https://itk.org/ItkSoftwareGuide.pdf) Section 9.5

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.

---

<div class="post-metadata">

**Author:** ![gdevenyi](https://discourse.itk.org/user_avatar/discourse.itk.org/gdevenyi/32/355_2.png) [@gdevenyi](https://discourse.itk.org/u/gdevenyi)\
**Post date:** [August 21, 2024, 7:36pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/10 "2024-08-21T19:36:13Z")

</div>

Here’s a rich MINC2 file generated by dcm2mnc,

> **[2015\_01\_12\_GAD\_t1w\_2.mnc](https://wetransfer.com/downloads/7a260b602432abee7e4f491b7affbea020240821193537/a87a86)**
>
> 1 file sent via WeTransfer, the simplest way to send your files around the world

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [August 21, 2024, 8:41pm UTC](https://discourse.itk.org/t/unknown-print-characteristics-when-reading-minc-headers/7180/11 "2024-08-21T20:41:24Z")

</div>

@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.

> <https://github.com/InsightSoftwareConsortium/ITK/pull/4814>
>
> Also removes dead code related to METADATAPRINT
> 
> Does not currently add printi…ng for std::vector.
> 
> Fix #1454
> Near duplicate of: #4368
> Co-Author: Pablo Hernandez-Cerdan \<pablo.hernandez.cerdan@outlook.com\>
> 
> \<!-- The text within this markup is a comment, and is intended to provide
> guidelines to open a Pull Request for the ITK repository. This text will not
> be part of the Pull Request. --\>
> 
> 
> \<!-- See the CONTRIBUTING (CONTRIBUTING.md) guide. Specifically:
> 
> Start ITK commit messages with a standard prefix (and a space):
> 
> \* BUG: fix for runtime crash or incorrect result
> \* COMP: compiler error or warning fix
> \* DOC: documentation change
> \* ENH: new functionality
> \* PERF: performance improvement
> \* STYLE: no logic impact (indentation, comments)
> \* WIP: Work In Progress not ready for merge
> 
> Provide a short, meaningful message that describes the change you made.
> 
> When the PR is based on a single commit, the commit message is usually left as
> the PR message.
> 
> A reference to a related issue or pull request (https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests)
> in your repository. You can automatically
> close a related issues using keywords (https://help.github.com/articles/closing-issues-using-keywords/)
> 
> @mentions (https://help.github.com/articles/basic-writing-and-formatting-syntax/#mentioning-people-and-teams)
> of the person or team responsible for reviewing proposed changes. --\>
> 
> \## PR Checklist
> \- \[\] No \[API changes\](https://github.com/InsightSoftwareConsortium/ITK/blob/master/CONTRIBUTING.md#breaking-changes) were made (or the changes have been approved)
> \- \[\] No \[major design changes\](https://github.com/InsightSoftwareConsortium/ITK/blob/master/CONTRIBUTING.md#design-changes) were made (or the changes have been approved)
> \- \[\] Added test (or behavior not changed)
> \- \[\] Updated API documentation (or API not changed)
> \- \[\] Added \[license\](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/KWStyle/ITKHeader.h) to new files (if any)
> \- \[\] Added Python wrapping to new files (if any) as described in \[ITK Software Guide\](https://itk.org/ItkSoftwareGuide.pdf) Section 9.5
> \- \[\] Added \[ITK examples\](https://github.com/InsightSoftwareConsortium/ITKSphinxExamples) for all new major features (if any)
> 
> Refer to the \[ITK Software Guide\](https://itk.org/ItkSoftwareGuide.pdf) for
> further development details if necessary.

It appears to work with the current infrastructure.
