COMP: Include itkImageRegionIteratorWithIndex.h where the type is used#57
Merged
Conversation
Both files use ImageRegionIteratorWithIndex but relied on the header arriving transitively, which current ITK no longer provides, so the module does not compile against ITK main. In the .hxx the unqualified name is undeclared. In the test the itk:: qualified name resolves to nothing, and the compiler recovers with ImageRegionConstIteratorWithIndex, which then rejects the Set() calls.
hjmjohnson
commented
Jul 18, 2026
hjmjohnson
left a comment
Member
Author
There was a problem hiding this comment.
Missing includes (previoiusly transitively included).
hjmjohnson
marked this pull request as ready for review
July 18, 2026 21:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the missing
#include "itkImageRegionIteratorWithIndex.h"to the two files that use the type. Without it this module does not compile against current ITK main — 8 translation units fail.Why it broke
Both files use
ImageRegionIteratorWithIndexbut never include its header, relying on it arriving transitively through another ITK header. Current ITK no longer provides it that way.The two files fail differently because of how the name is spelled:
include/itkCannyEdgeDetectionRecursiveGaussianImageFilter.hxx:411namespace itk)error: use of undeclared identifier 'ImageRegionIteratorWithIndex', then cascading errors onuittest/itkRegionCompetitionImageFilterTest1.cxx:117itk::-qualifiederror: no template named 'ImageRegionIteratorWithIndex' in namespace 'itk'— the compiler then recovers by substitutingImageRegionConstIteratorWithIndex, which rejects the lateritr.Set(...)callsThe second case is worth noting: the reported errors are
no member named 'Set' in 'itk::ImageRegionConstIteratorWithIndex<...>', which reads like a wrong-iterator-type bug. It is not — the declaration at line 117 already asks for the non-const iterator. It is the same missing include, seen through the compiler's error recovery.These are the only two files in the module that use the type without including its header.
Verification
Built as an ITK remote module (
-DModule_LesionSizingToolkit=ON), Release, AppleClang, arm64, macOS 26.5 SDK, against ITKmainat4213421.LesionSizingToolkitTestDriverLesionSizingToolkit-allFailing translation units before the fix:
The breakage is not new to any recent change here — building the previously ITK-pinned commit (
affbf7b095…) against the same ITK reproduces the identical 8 failures, so it has been latent since ITK stopped providing the header transitively.Not covered: the test suite was not executed (requires the module's test data); this change is verified at compile/link only.