Skip to content

COMP: Include itkImageRegionIteratorWithIndex.h where the type is used#57

Merged
hjmjohnson merged 1 commit into
mainfrom
fix-missing-iterator-include
Jul 18, 2026
Merged

COMP: Include itkImageRegionIteratorWithIndex.h where the type is used#57
hjmjohnson merged 1 commit into
mainfrom
fix-missing-iterator-include

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

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 ImageRegionIteratorWithIndex but 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:

File Spelling Compiler behaviour
include/itkCannyEdgeDetectionRecursiveGaussianImageFilter.hxx:411 unqualified (inside namespace itk) error: use of undeclared identifier 'ImageRegionIteratorWithIndex', then cascading errors on uit
test/itkRegionCompetitionImageFilterTest1.cxx:117 itk::-qualified error: no template named 'ImageRegionIteratorWithIndex' in namespace 'itk' — the compiler then recovers by substituting ImageRegionConstIteratorWithIndex, which rejects the later itr.Set(...) calls

The 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 ITK main at 4213421.

Target Before After
LesionSizingToolkitTestDriver 8 failing TUs 0
LesionSizingToolkit-all 10 failing targets 0, exit 0

Failing translation units before the fix:

itkCannyEdgesDistanceAdvectionFieldFeatureGeneratorTest1.cxx
itkCannyEdgesDistanceFeatureGeneratorTest1.cxx
itkCannyEdgesFeatureGeneratorTest1.cxx
itkLesionSegmentationMethodTest4.cxx
itkLesionSegmentationMethodTest8.cxx
itkLesionSegmentationMethodTest8b.cxx
itkMinimumFeatureAggregatorTest1.cxx
itkRegionCompetitionImageFilterTest1.cxx

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.

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 hjmjohnson left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing includes (previoiusly transitively included).

@hjmjohnson
hjmjohnson marked this pull request as ready for review July 18, 2026 21:13
@hjmjohnson
hjmjohnson merged commit 29ae0f9 into main Jul 18, 2026
3 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant