You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ImageFileReader: add diagnostics for reduced-dimensional reads #6942
The direction-collapse policy work from #6918 and #6948 is now consolidated in the open draft #6977. That proposal adds reader strategy selection and shares the implementation with the extraction filters. This issue remains the separate diagnostics follow-up; it does not request another collapse-policy implementation.
The outstanding diagnostics are still the input/output dimensions, discarded extents and an actual direction fallback, with an explicit decision for implicit singleton axes and repeated/streamed updates. Those details should follow the API decision in #6977.
ImageFileReader can read a higher-dimensional file into a lower-dimensional output and select the first slice or volume without warning that trailing axes were discarded. A retained direction may also fall back to identity when it cannot be preserved. The direction correction in #6918 should stay separate from diagnostics for that reduction.
Could the reader emit a diagnostic that identifies the input and output dimensions, the discarded extents, and any direction fallback? The policy for implicit singleton axes should be decided explicitly, so ordinary single-slice reads do not become noisy merely because an ImageIO reports an extra dimension.
Useful regression coverage would distinguish a time-series or volume axis with more than one sample from an implicit singleton axis, and verify any fallback message only when direction is actually replaced. Repeated pipeline updates and streamed reads should not emit the same warning for every chunk.
Relevant paths are GenerateOutputInformation and EnlargeOutputRequestedRegion in Modules/IO/ImageBase/include/itkImageFileReader.hxx. This follow-up proposes diagnostics only; it does not request changing slice selection, pixel values, direction tolerances, or the reduction policy in #6918.
There is an existing way to achieve this with ITK. If you connect the ImageFilerReader->ExtractImageFilter where the ImageFileReader is the full dimension of the Image in the file, then the ExtractImageFilter can be configured to collapse the dimensions, or raise an exception as desired with the policy. This is similar to the structure used in SimpleITK for reader, and a the refinement of adding the collapse strategy is proposed here: SimpleITK/SimpleITK#2756
Second in an effort to reuse code, a refactoring of the ExtractImageFilter was done to expose the method and implementation of the collapse strategy so that it could be reused here in #6948. I didn't explore how that could be used in the ImageFileReader or if there are other parts in ITK where the functionality could be reused.
Activity
github-actions commentedon Oct 10, 2026
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. 📜
Also, please check existing open issues and consider discussion on the ITK Discourse. 📖
This is an automatic message. Allow for time for the ITK community to be able to read the issue and comment on it.
blowekamp commentedon Oct 14, 2026
This behavior in the ImageFilterReader is very similar to the ExtractImageFilter. That filter has a
DirectionCollapseToStrategymember that can be configured: https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1ExtractImageFilter.html#a136c05a8390450c3623e9d2d2d5ef0cb I think the say options, strategy could be adopted by the reader to provide clear user definable behavior.gdevenyi commentedon Oct 14, 2026
This is a great way to standardize. How recently has DirectionCollapseToStrategy been tested?
blowekamp commentedon Oct 15, 2026
There is an existing way to achieve this with ITK. If you connect the ImageFilerReader->ExtractImageFilter where the ImageFileReader is the full dimension of the Image in the file, then the ExtractImageFilter can be configured to collapse the dimensions, or raise an exception as desired with the policy. This is similar to the structure used in SimpleITK for reader, and a the refinement of adding the collapse strategy is proposed here: SimpleITK/SimpleITK#2756
Second in an effort to reuse code, a refactoring of the ExtractImageFilter was done to expose the method and implementation of the collapse strategy so that it could be reused here in #6948. I didn't explore how that could be used in the ImageFileReader or if there are other parts in ITK where the functionality could be reused.