Skip to content

COMP: Fix the FFT tests against ITK 6 with wrapping enabled - #84

Merged
hjmjohnson merged 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:comp-itk6-fft-test-fixes
Sep 16, 2026
Merged

hjmjohnson merged 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:comp-itk6-fft-test-fixes

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Fixes two test failures against ITK 6 built with wrapping enabled. Both tests fail today; neither change is specific to ITK 6 except where guarded.

1. The factory test used a class ITK compiles out

itkVnlComplexToComplex1DFFTImageFilter.h now guards its class with

#if !defined(ITK_LEGACY_REMOVE) && !defined(ITK_FUTURE_LEGACY_REMOVE)

and ITK declares

cmake_dependent_option(ITK_LEGACY_REMOVE "..." OFF "NOT ITK_WRAPPING" ON)

so any ITK built with wrapping forces ITK_LEGACY_REMOVE on and the class
disappears:

error: no template named 'VnlComplexToComplex1DFFTImageFilter' in namespace 'itk'

The class is a deprecated shim that routes to
PocketFFTComplexToComplex1DFFTImageFilter, which is ITK 6's documented default
1D backend. The test now uses the PocketFFT class under
#if ITK_VERSION_MAJOR >= 6, keeping the Vnl spelling for ITK 5.4, which has no
PocketFFT header.

2. The Python test instantiated the 1D filters with one template argument
itk.Forward1DFFTImageFilter[real_image_type]
itk.support.extras.TemplateTypeError: itk.Forward1DFFTImageFilter is not wrapped
for input type `itk.Image[itk.F,3]`.

itkForward1DFFTImageFilter.wrap wraps input and output
(itkForward1DFFTImageFilterIF3ICF3), and itkInverse1DFFTImageFilter.wrap does
the same — identically in ITK 5.4 and ITK 6, so this is not a version change.
The two 1D entries now pass both arguments, matching what the neighbouring
ForwardFFTImageFilter and InverseFFTImageFilter entries in the same list
already do.

Verification

Built against ITK main (6.0.0) with ITK_WRAP_PYTHON=ON, VTK 9.6, macOS
arm64, Metal backend.

before after
build 1 failed target 0
ctest 2 of 24 passed 24 of 24

Before these changes the C++ failure stopped the build, so the Python module was
never produced.

🤖 Generated with Claude Code

https://claude.ai/code/session_01S5zzoU6yyUwdLEvjM2s6iS

itkVnlComplexToComplex1DFFTImageFilter is now a deprecated shim guarded
by ITK_LEGACY_REMOVE / ITK_FUTURE_LEGACY_REMOVE, and ITK forces
ITK_LEGACY_REMOVE on whenever it is built with wrapping enabled
(cmake_dependent_option ... "NOT ITK_WRAPPING" ON). The factory test
then fails to compile: no template named VnlComplexToComplex1DFFTImageFilter.

The shim routes to PocketFFTComplexToComplex1DFFTImageFilter, ITK 6's
default 1D backend, so name that directly. ITK 5.4 has no PocketFFT
header, hence the version guard.
itk.Forward1DFFTImageFilter[real_image_type] raises TemplateTypeError:
itkForward1DFFTImageFilter.wrap wraps input and output
(itkForward1DFFTImageFilterIF3ICF3), and itkInverse1DFFTImageFilter.wrap
does the same. Both declare it that way in ITK 5.4 and ITK 6 alike, so
the single-argument lookup never matched.

Pass both arguments, as the ForwardFFTImageFilter and InverseFFTImageFilter
entries in the same list already do.
@hjmjohnson
hjmjohnson marked this pull request as ready for review September 16, 2026 19:16
@hjmjohnson
hjmjohnson merged commit d2b991b into InsightSoftwareConsortium:main Sep 16, 2026
10 of 13 checks passed
@hjmjohnson
hjmjohnson deleted the comp-itk6-fft-test-fixes branch September 16, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants