# Missing exception handling

**URL:** <https://discourse.slicer.org/t/missing-exception-handling/34473>\
**Category:** Development\
**Tags:** data-loading\
**Created:** [February 22, 2024, 11:45am UTC](https://discourse.slicer.org/t/missing-exception-handling/34473 "2024-02-22T11:45:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heiko\_Stark](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/heiko_stark/32/69446_2.png) [@Heiko\_Stark](https://discourse.slicer.org/u/Heiko_Stark)\
**Post date:** [February 22, 2024, 11:45am UTC](https://discourse.slicer.org/t/missing-exception-handling/34473/1 "2024-02-22T11:45:39Z")

</div>

Slicer is not able to load a malformed nii.gz file in 5.6.1, which is possible with version 4.8. Missing error message: only visible in logging window and cryptic. A meaningful error message or more tolerant loading would be welcome (malformed files will occur again and again).

“Slicer has caught an application error, please save your work and restart.\n\nIf you have a repeatable sequence of steps that causes this message, please report the issue following instructions available at [https://slicer.org](https://slicer.org)\n\n\nThe message detail is:\n\nException thrown in event: /work/Stable/Slicer-0-build/ITK/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx:2100:\nITK ERROR: ITK only supports orthonormal direction cosines. No orthonormal definition found!”

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 22, 2024, 3:56pm UTC](https://discourse.slicer.org/t/missing-exception-handling/34473/2 "2024-02-22T15:56:40Z")

</div>

Thanks for reporting this. It’s probably good that newer versions of ITK are more careful about interpreting nifti variants, as this has been an ongoing source of confusion. I don’t think we should push back in that, but instead offer a more robust nifti loader that as you suggest is more user-friendly in pointing out bad data and offering loading solutions. This would be a chance to handle other variants nifti types, like time series.

I did a prototype of a [python-based reader for diffusion MRI](https://github.com/SlicerDMRI/SlicerDMRI/compare/master...pieper:SlicerDMRI:nifiio) that could be used as a starting point. It would be great if people who rely on nifti in their workflows could pick up and generalize this to support their needs. Perhaps even a dedicated module like [RawImageGuess](https://discourse.slicer.org/t/new-extension-rawimageguess-for-loading-of-images-from-unrecognized-file-format/9219) or [ImageStacks](https://github.com/SlicerMorph/SlicerMorph/tree/master/Docs/ImageStacks) would help people deal with some not-uncommon issues like left-right flip, qform/sform disagreement, or making use of intent types.
