BUG: Make FastMarching AllTargets stop condition count distinct targets#6658
Open
hjmjohnson wants to merge 1 commit into
Open
BUG: Make FastMarching AllTargets stop condition count distinct targets#6658hjmjohnson wants to merge 1 commit into
hjmjohnson wants to merge 1 commit into
Conversation
FastMarchingUpwindGradientImageFilter's AllTargets stop condition compared the reached-target count against the raw target-container size. Because each index is accepted (and so reached) at most once, a target container with duplicate indices could never satisfy the equality, so AllTargets mode never triggered and the front marched the whole image. Compute the number of distinct target indices once in Initialize() and compare against that. Adds a GoogleTest with a duplicated target index, which leaves GetTargetValue() at 0 on the unfixed code (target never registered) and reports the correct arrival time after the fix. Issue InsightSoftwareConsortium#6575, item B24.
hjmjohnson
marked this pull request as ready for review
July 17, 2026 18:43
Contributor
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.
Fixes the
AllTargetsstop condition inFastMarchingUpwindGradientImageFilter, which compared the reached-target count against the raw target-container size and so never triggered when the target list held duplicate indices. Addresses item B24 of #6575.Root cause & fix
Each index is accepted (reached) at most once, so a target container with duplicate indices could never satisfy
reachedCount == containerSize;AllTargetsmode therefore never halted and the front marched the whole image.The filter now computes the number of distinct target indices once in
Initialize()(viastd::set<IndexType>) and compares the reached count against that. The change is scoped strictly to theAllTargetsbranch ofUpdateNeighbors;SomeTargets/OneTargetbehavior is unchanged.Test
Adds a GoogleTest with a duplicated target index. On the unfixed code
GetTargetValue()stays 0 (target never registered / never halts as intended); after the fix it reports the correct arrival time. Fail-before/pass-after was verified locally. Self-contained synthetic image — no ITKTestingData fixture.