Skip to content

BUG: Include region in WarpImageFilter same-information fast path (B34, split of #6669) - #6672

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:split6669-b34-warp-fastpath
Jul 23, 2026
Merged

hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:split6669-b34-warp-fastpath

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

B34 — WarpImageFilter same-information fast path ignored the region. Split out of #6669 as an independent bug fix (#6669 closed in favor of focused PRs).

The "same information" test compared origin/spacing/direction but not size, so a valid larger-output configuration took the fast path and died in an iterator-containment check instead of the general resampling path. The region is now part of the test.

New GTest WarpImageFilter.LargerOutputThanFieldDoesNotThrow fails before / passes after.

Local testing

Cherry-picked onto current upstream/main (37ecafc); built ITKImageGridGTestDriver and ran the new test — PASSED. pre-commit run --all-files clean.

Fixes item B34 from the #6575 audit. Companion PRs (split from #6669): STYLE/DOC dispositions and the ExponentialDisplacementField B35 fix.

The fast path iterated the displacement field over the output thread
region, but the gate compared only origin, spacing and direction. A
legitimately larger output over a smaller matching field died in the
iterator containment check instead of taking the general clamped path.

Issue InsightSoftwareConsortium#6575, item B34.
@github-actions github-actions Bot added type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Filtering Issues affecting the Filtering module labels Jul 21, 2026
@hjmjohnson
hjmjohnson marked this pull request as ready for review July 21, 2026 15:33
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the WarpImageFilter same-information fast path for mismatched output and displacement-field regions. The main changes are:

  • Adds largest-possible-region equality to the fast-path condition.
  • Routes larger output regions through the general displacement sampling path.
  • Adds a GoogleTest regression for larger output than displacement field.
  • Registers the new test with the ImageGrid GTest driver.

Confidence Score: 5/5

Safe to merge with minimal risk.

The code change is localized and aligns the fast-path condition with the region assumptions used by the paired output and displacement-field iterators. The new test exercises the reported failure mode through the public filter API.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • Checked the build toolchain and found cmake, ninja, and ctest were unavailable, causing command-not-found/exit 127, which blocked progress.
  • Observed the CMake configure step failing because cmake is unavailable, as shown in the configure blocker log.
  • Confirmed the source confirms itkWarpImageFilterGTest.cxx is listed in CMakeLists.txt and defines the WarpImageFilter, LargerOutputThanFieldDoesNotThrow test.
  • Uploaded and linked four artifact logs documenting the tool blocker, the configure blocker, and the source confirmation for reviewer inspection.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx Adds largest-possible-region equality to the displacement-field same-information fast path, so larger output regions use the general region-safe path.
Modules/Filtering/ImageGrid/test/itkWarpImageFilterGTest.cxx Adds a regression test covering a larger requested output than the displacement field while preserving matching origin, spacing, and direction.
Modules/Filtering/ImageGrid/test/CMakeLists.txt Registers the new WarpImageFilter GoogleTest source with the ImageGrid GTest driver.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[GenerateOutputInformation sets output region] --> B[GenerateInputRequestedRegion]
B --> C{Output and displacement field have same region, origin, spacing, direction?}
C -- Yes --> D[Request output region from displacement field]
D --> E[DynamicThreadedGenerateData fast path uses paired output/field iterators]
C -- No --> F[Compute field request with EnlargeRegionOverBox]
F --> G[DynamicThreadedGenerateData general path samples displacement by physical point]
E --> H[Warped output]
G --> H[Warped output]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[GenerateOutputInformation sets output region] --> B[GenerateInputRequestedRegion]
B --> C{Output and displacement field have same region, origin, spacing, direction?}
C -- Yes --> D[Request output region from displacement field]
D --> E[DynamicThreadedGenerateData fast path uses paired output/field iterators]
C -- No --> F[Compute field request with EnlargeRegionOverBox]
F --> G[DynamicThreadedGenerateData general path samples displacement by physical point]
E --> H[Warped output]
G --> H[Warped output]
Loading

Reviews (1): Last reviewed commit: "BUG: Include region in WarpImageFilter s..." | Re-trigger Greptile

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change looks good. Test looks good on a glance.

@hjmjohnson
hjmjohnson merged commit 1677575 into InsightSoftwareConsortium:main Jul 23, 2026
21 checks passed
@hjmjohnson
hjmjohnson deleted the split6669-b34-warp-fastpath branch August 22, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants