Skip to content

ENH: Test 1D FFT along every direction axis (closes #19) - #76

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:enh/issue-19-1d-fft-direction-tests
Jun 7, 2026
Merged

hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:enh/issue-19-1d-fft-direction-tests

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Adds direction-axis coverage to the 1D complex-to-complex FFT test. Previously only axis 0 was exercised; this verifies the transform is applied along each requested direction. Closes #19.

Approach

A forward + inverse round-trip along the same axis is identity regardless of whether SetDirection is honored, so it cannot prove direction handling. Instead, runDirectionAxisTest<Precision, Dimension>() uses a direction-sensitive signature:

  • Forward 1D-FFT of a delta at the origin yields a constant value along the transformed axis and zero on every other line.
  • The test asserts that signature for each direction, then round-trips the inverse to confirm recovery of the original delta.

Covers directions 0,1 (2D) and 0,1,2 (3D). Image size 8 (only prime factor 2) keeps VkFFT on its exact path, so a tight tolerance (1e-4) is valid.

Local verification

Built against ITK (Ninja, Release) and ran the affected test:

itkVkComplexToComplex1DFFTImageFilterSizesTestFloat ... Passed
Direction test (dim=2, direction=0) ... passed.
Direction test (dim=2, direction=1) ... passed.
Direction test (dim=3, direction=0) ... passed.
Direction test (dim=3, direction=1) ... passed.
Direction test (dim=3, direction=2) ... passed.

clang-format applied. The Double variant is gated off on the dev machine (no cl_khr_fp64); fp64-capable CI will exercise both precisions.

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

Looks good on a glance.

The 1D complex-to-complex FFT was exercised only along axis 0. Add a
direction-sensitive check that forward-transforms a delta-at-origin
image along each axis and asserts the result is constant on the line
parallel to that axis and zero elsewhere, then round-trips the inverse.
Covers directions 0,1 (2D) and 0,1,2 (3D).

Closes InsightSoftwareConsortium#19
@hjmjohnson
hjmjohnson force-pushed the enh/issue-19-1d-fft-direction-tests branch from 5dc561a to 2dffeb9 Compare June 3, 2026 20:35
@hjmjohnson
hjmjohnson marked this pull request as ready for review June 7, 2026 17:16
@hjmjohnson
hjmjohnson merged commit a519718 into InsightSoftwareConsortium:main Jun 7, 2026
6 of 56 checks passed
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.

ENH: Add tests to verify 1D FFT functionality in dimensions 1 and 2

2 participants