Use RegionConstIteratorWithIndex in ContourExtractor2DImageFilter, deprecate nested RegionIterator aliases#5806
Merged
thewtex merged 4 commits intoInsightSoftwareConsortium:mainfrom Feb 16, 2026
Conversation
Replaced using RegionConstIterator with using ImageRegionConstIteratorWithIndex in `ContourExtractor2DImageFilter<TInputImage>::GenerateDataForLabels()`, to avoid potentially expensive index computation with each iteration.
Avoided calling `inputIt.GetIndex()` repetitively during one and the same iteration. This is just a style improvement, as it is not a major performance improvement. (`inputIt.GetIndex()` is likely to be very fast.)
Reduced the scope of the local `inputIt` variable in `GenerateDataForLabels()`, by moving its declaration into the _init-statement_ of its `for` loop. Following C++ Core Guidelines, Jul 8, 2025 "Declare names in for-statement initializers and conditions to limit scope", https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#res-cond Removed the `inputIt.GoToBegin()` call, following pull request InsightSoftwareConsortium#5736 commit f10bd8f "STYLE: Remove GoToBegin() calls on ImageRegionIteratorWithIndex"
These nested type aliases are no longer used. Originally, they were just used internally, within the implementation of `ContourExtractor2DImageFilter`.
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.
RegionConstIteratorwith usingImageRegionConstIteratorWithIndexinContourExtractor2DImageFilter::GenerateDataForLabels(), to avoid potentially expensive index computation with each iteration.GoToBegin()call, following pull request Remove GoToBegin() calls on local ImageRegionIteratorWithIndex variables #5736RegionIteratorandRegionConstIteratorthat were nested withingContourExtractor2DImageFilter, as they are no longer being used.