InsightSoftwareConsortium / InsightSoftwareConsortium/ITK
NiftiImageIO: incorrect reading of 4D image when fourth dimension has size one
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 748
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 64
Description
Initial bug report and some discussion on the [SimpleITK issue tracker](https://github.com/SimpleITK/SimpleITK/issues/1648).
The nifti reader does not read 4D images correctly when the 4'th dimension size is one. Instead of returning a 4D image a 3D image is returned. Based on [the code](https://github.com/InsightSoftwareConsortium/ITK/blob/0fcfaf1288928a76c3ef2b3fcc8b6e53246bfbba/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx#L1069-L1082) it is intentional behavior.
Is it possible to revert to the [commented out line](https://github.com/InsightSoftwareConsortium/ITK/blob/0fcfaf1288928a76c3ef2b3fcc8b6e53246bfbba/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx#L1071)? This "fix" was added to address a problem that should have been resolved at the application level and not the toolkit level. Unfortunately, it has been there for years, so changing behavior may break old code. Old code can be fixed at the application level (ExtractImageFilter). The current behavior does not allow one to address the issue at the application level as the knowledge whether the file contains a 4D or 3D image is lost during reading.
Contributor guide
Research direction
Start with Modules/IO/NIFTI/src/itkNiftiImageIO.cxx around lines 1069-1082 and review the linked SimpleITK issue #1648. Compare the active code with the commented-out line and investigate existing NIFTI IO tests. Done means the reader's handling of a singleton fourth dimension is defined and covered without overlooking the compatibility concern described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100