Repository navigation
BUG: Handle narrow bands with fewer nodes than work units (supersedes #6992) - #7013
Open
hjmjohnson wants to merge 2 commits into
Open
hjmjohnson wants to merge 2 commits into
hjmjohnson wants to merge 2 commits into
Conversation
NarrowBand::SplitBand returned at most one region per band node, while NarrowBandImageFilterBase and IsoContourDistanceImageFilter index the result by work-unit id. A band with fewer nodes than work units was read past its end, and an empty band divided zero by zero. SplitBand now returns exactly one region per work unit, padding with empty ranges. Empty work units are left out of the time-step choice, because an empty range reports a zero time step that would freeze the whole band. GenerateData stops when the band becomes empty, since no work unit then has a valid time step to resolve. Closes InsightSoftwareConsortium#6823.
A one-node narrow band split across eight work units exercises the padded regions that SplitBand now returns for unused work units.
Member
Author
|
@jdotc1 Some improvements on your proposed PR. Feel free to review this, or update your PR. |
hjmjohnson
marked this pull request as ready for review
October 26, 2026 00:05
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found.
|
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.
Supersedes #6992 by @jdotc1, keeping that fix and its authorship. Narrow-band filters no longer read past the per-work-unit region list when the band has fewer nodes than work units, and stop iterating once the band is empty. Closes #6823.
Behavior change for maintainers to accept: when the band becomes empty,
NarrowBandImageFilterBase::GenerateDatastops:GetElapsedIterations()stays at the last count, and no IterationEvent is sent for that pass. Atmainthe same input read an empty vector out of bounds, so no working behavior is lost.Changes relative to #6992
SplitBandreturn-size change and the empty-band stop.itkNarrowBandSmallBandTestto GoogleTest (itkNarrowBandSmallBandGTest), addingITKGoogleTestto the module'sTEST_DEPENDS.ExpectedElapsedIterations(); renamedConfigure(count, shrink)toSetBand(numberOfNodes, emptyBandAfterFirstIteration)andRequestSplitRegiontoGetSplitRegionOfWorkUnit.IsoContourDistanceImageFiltertest with a one-node band over eight work units. That filter also indexesSplitBand's result by work-unit id and was fixed silently by the padding.Local verification
macOS arm64, AppleClang, RelWithDebInfo with AddressSanitizer; modules NarrowBand and DistanceMap plus their IO.
mainheadersNarrowBand.SplitBandReturnsOneContiguousRegionPerWorkUnitNarrowBandImageFilterBase.UpdatesBandWithFewerNodesThanWorkUnitsIsoContourDistanceImageFilter.NarrowBandWithFewerNodesThanWorkUnitsAll 34 NarrowBand and DistanceMap tests pass at the tip, and
pre-commit run --all-filespasses.AI assistance
Claude Code performed the review of #6992, the GoogleTest conversion, the IsoContour test, and the AddressSanitizer runs; I reviewed and directed each change.