Skip to content

COMP: Build against ITK 6 - #252

Merged
dzenanz merged 1 commit into
KitwareMedical:masterfrom
hjmjohnson:itk6-compat
Sep 22, 2026
Merged

dzenanz merged 1 commit into
KitwareMedical:masterfrom
hjmjohnson:itk6-compat

Conversation

@hjmjohnson

Copy link
Copy Markdown
Contributor

Build against ITK 6 while keeping ITK 5.4: select the PocketFFT 1D filters where ITK 6 removed the VNL FFT backend, and call pocketfft directly in Spectra1DImageFilter, which used vnl_fft_1d on a vnl_vector.

Details
  • ITK 6 removed the VNL FFT backend; the Vnl*1DFFTImageFilter names survive only as deprecation shims that a legacy-free build compiles out, and vnl/algo/vnl_fft_1d.h is gone. These classes reach FFTImageFilterFactory as template template arguments keyed on the template itself, so the selection is by macro rather than by alias template.
  • Spectra1DImageFilter called vnl_fft_1d::bwd_transform, for which no ITK filter substitutes. The pocketfft call follows ITK's own removed vnl_fft_1d shim (a4de8b36f76): vnl dir=+1 is exp(+i), pocketfft's backward direction, so bwd_transform is a forward pocketfft transform with no normalization.
Verification

Configured with ITK_DIR pointing at an installed ITK 6 tree (upstream main as of 2026-09-22, ITK_WRAP_PYTHON=ON, with the ingested modules this module depends on enabled), built the module and its Python wrapping. The module still builds against ITK 5.4.

All changes keep the module building against ITK 5.4 as well.

ITK 6 removed the VNL FFT backend. The Vnl*1DFFTImageFilter names survive only
as deprecation shims that a legacy-free ITK build compiles out entirely, and
vnl/algo/vnl_fft_1d.h is gone. Select the PocketFFT filters on ITK 6 and the
Vnl filters below it. These classes reach FFTImageFilterFactory as template
template arguments whose FFTImageFilterTraits specialization is keyed on the
template itself, so the selection is by macro rather than by alias template.

Spectra1DImageFilter called vnl_fft_1d::bwd_transform on a vnl_vector, for
which no ITK filter substitutes. Call pocketfft directly on ITK 6. The
direction and scaling follow ITK's own vnl_fft_1d PocketFFT shim, removed in
a4de8b36f76: vnl dir=+1 is exp(+i), which is pocketfft's backward direction,
so bwd_transform is a forward pocketfft transform with no normalization.
@hjmjohnson
hjmjohnson marked this pull request as ready for review September 22, 2026 16:05

@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.

Changes look good. But my nightly builds run into VTK-related configure error.

@dzenanz
dzenanz merged commit 856ad2d into KitwareMedical:master Sep 22, 2026
15 checks passed
@hjmjohnson

Copy link
Copy Markdown
Contributor Author

Pushed 0501b9d: the tests exercised the Vnl 1D FFT filters by name as an explicit backend (backend == 1); on ITK 6 that backend is PocketFFT, selected with the same version guard as src/. The module, its examples, tests, and header test now build against an installed ITK 6, and 37 of 48 tests pass. The 11 that fail are not caused by this branch:

  • itkSpectra1DImageFilterTest: the reference spectrum input rf_voltage_15_freq_0005000000_2017-5-31_12-36-44_ReferenceSpectrum_side_lines_03_fft1d_size_128.mha resolves (CID bafkreigfnnwh…) to a 479-byte file that is only a MetaImage header, so the reader fails with a zlib error. The published data object appears truncated.
  • The ten Python* tests: itk_python_add_test puts ${ITK_DIR}/Wrapping/Generators/Python first on PYTHONPATH, which against an installed ITK is the wrapping infrastructure rather than ITK's Python package. Tracked as a follow-up on ENH: Build, test, and wrap external modules against an installed ITK InsightSoftwareConsortium/ITK#6891; these tests pass in a build-tree configuration.

@dzenanz

dzenanz commented Sep 22, 2026

Copy link
Copy Markdown
Member

I opened follow-up PR #253 with that commit.

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