Skip to content

ENH: Support short axes in recursive Gaussian smoothing - #7001

Draft
sdiebolt wants to merge 1 commit into
InsightSoftwareConsortium:mainfrom
sdiebolt:enh/6997-short-dimension-gaussian-smoothing
Draft

sdiebolt wants to merge 1 commit into
InsightSoftwareConsortium:mainfrom
sdiebolt:enh/6997-short-dimension-gaussian-smoothing

Conversation

@sdiebolt

@sdiebolt sdiebolt commented Oct 23, 2026 •

Copy link
Copy Markdown

Hi! This lets SmoothingRecursiveGaussianImageFilter skip axes shorter than four pixels while smoothing the remaining axes, including singleton slices used in registration. Closes #6997.

Scope and local testing
  • Preserve image dimensionality and geometry, and retain the existing processing order when every axis has at least four pixels.
  • Cast directly to the output type when all axes are short, avoiding an unnecessary float conversion.
  • Keep empty-image and nonpositive-sigma validation.
  • Leave recursive Gaussian gradients for a separate issue and PR; registration still needs both metric gradient-filter flags disabled for short dimensions.

Local checks on Linux:

  • Added GoogleTests for short-axis combinations, anisotropic sigma and spacing, geometry, repeated updates, in-place execution, integer/vector pixels, and two-level singleton-image registration.
  • All 14 focused CTest entries passed, including the unchanged smoothing MD5 baseline; the image-adaptor test also passed when invoked directly.
  • A new regression test compiled against unmodified main headers failed with the expected four-pixel exception.
  • Rebuilt the Python registration bindings and ran the exact example from ENH: Support singleton and short dimensions in SmoothingRecursiveGaussianImageFilter #6997 unchanged. Both sigma=1.0 and sigma=0.0 recovered the expected 4-pixel X translation.
  • All local commit hooks passed. Full-suite, cross-platform, and performance validation remain pending.
PR Checklist

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

No public API additions or new wrapped classes. The class documentation describes the short-axis behavior; both new test files have the standard license header. No separate examples contribution is needed for this enhancement.

AI assistance

AI assistance contributed to diagnosis, implementation, and regression tests. Focused C++ and Python checks passed locally.

Allow singleton slices to retain smoothing along their longer axes.
Recursive gradient filtering remains a separate follow-up.

Closes InsightSoftwareConsortium#6997
@github-actions github-actions Bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Enhancement Improvement of existing methods or implementation 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 area:Registration Issues affecting the Registration module labels Oct 23, 2026
@sdiebolt

Copy link
Copy Markdown
Author

The Linux Python failure looks unrelated to this change: Gaussian smoothing passes, and the only failure among 185 tests is the median filter’s type-hint check (NameError: name 'xr' is not defined). The affected type alias and test are unchanged by this PR. This matches the failure observed in #7002.

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 area:Registration Issues affecting the Registration module type:Enhancement Improvement of existing methods or implementation 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.

ENH: Support singleton and short dimensions in SmoothingRecursiveGaussianImageFilter

1 participant