-
-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nifti files with non-orthonormal directional cosines should be read and the error changed to a warning. #3994
Comments
Thank you for contributing an issue! 🙏 Welcome to the ITK community! 🤗👋☀️ We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. 📜 |
People who use NIFTI a lot should weigh in. Candidates: @hjmjohnson @cookpa @vfonov @seanm. Maybe make the error/warning CMake configurable, with the default being a warning? |
ITK does not support non-orthogonal images, to read the images that are non-orthogonal invalidates all the requirements about processing and analyzing images. |
Maybe we should add a flag that forces Nifti reader to convert the non-confirming non-orthogonal matrix to the closest possible orthogonal? |
@vfonov I think such a flag would have some utility, would not break backward compatibility, and would require the end-user to explicitly ask for the risky behavior. I am supportive of adding such a flag if a pull request is made. I have also thought that the non-orthogonal part could be returned as part of the meta-data dictionary as a transform so that it could be used by the developer for other purposes. |
I looked through the linked issues in the first post, but I didn't see any links to example data that reproduce the problem. Even the headers by themselves would be useful, these can be extracted with head -c 352 image.nii > header.nii If the sform checks are too strict, it would be good to fix them. Otherwise everyone is just going to turn on this flag at compile time and the end users will likely not even know about it |
I think, it's possible that, other software is quietly fixing this issue by using ITK/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx Line 2261 in c44f9c1
|
I created a file from another one by using nifti_tool to make sform non-orthogonal, but it is probably not representative of the real world problem. |
I think there is some kind of bug with the implementation of this check anyway. I spent 4 days ripping my hair out when getting an error message indicating a non-orthonormal transform for nifti files generated using the |
Required to open some nifti files generated with old versions of tools like simpleitk 2.2.0. The new version shows the error "ITK only supports orthonormal direction cosines. No orthonormal definition found!". More details here: InsightSoftwareConsortium/ITK#3994
Following @mike-barrow analysis, I've uploaded couple of examples of the same (full-zeros) image which the only difference is in the translation vector. Note the rotation is orthogonal. import itk
io = itk.NiftiImageIO.New()
io.SetFileName("fail_to_open.nii.gz")
io.ReadImageInformation() I'm not sure what the differences are, maybe different build flags? Examples (both work and don't work)❌ fail_to_open.nii.gz (original affine)
|
Thanks for these examples. I believe the translation issue was fixed by this commit as part of #4009. |
Yes, ITK-SNAP is somewhat behind on ITK version. |
The next major update of ITK-SNAP (v4.4.0) will be using ITK 5.4
…On Tue, Aug 20, 2024 at 9:21 AM Dženan Zukić ***@***.***> wrote:
Yes, ITK-SNAP is somewhat behind on ITK version.
—
Reply to this email directly, view it on GitHub
<#3994 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARDT6PVKDPDYYPFHY4HCA2TZSM7FTAVCNFSM6AAAAAAWSXMCJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJYHA2DQNJSHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hi all,
In this PR - https://github.com/InsightSoftwareConsortium/ITK/pull/1868/files ITK introduced an additional constraint on NiFTI files being read.
This has affected users across a variety of technologies which use ITK such as TorchIO, TotalSegmentator, Nvidia AAIA, HD-BET, nnDetection and even ITK-SNAP (with some files working on < v3.6 but not on v3.8 >)
Given so many users see this as unexpected behaviour could the developers investigate whether the constraint is still a reasonable one?
Note: In this issue this was discussed but the solution solved only one failure case related to small voxel sizes - #2674 - this issue is still affecting users with larger voxel sizes across a variety of technologies
References:
MIC-DKFZ/nnDetection#24
SimpleITK/SimpleITK#1433
fepegar/torchio#669
wasserth/TotalSegmentator#32
The text was updated successfully, but these errors were encountered: