Skip to main content

Module fft

Module fft 

Source
Expand description

FFT wrapper for 3D transforms using rustfft

Provides 3D FFT/IFFT operations compatible with NumPy’s FFT conventions. Uses Fortran (column-major) order indexing to match NIfTI convention.

Structs§

Fft3dWorkspace
FFT workspace that caches plans and scratch buffers for reuse
Fft3dWorkspaceF32
FFT workspace using f32 for better WASM performance Single precision halves memory bandwidth and is faster on most hardware
SendPtr 🔒
Wrapper to send a raw mutable pointer across threads. Stores as usize to avoid auto-trait issues with raw pointers. Safety: caller must guarantee non-overlapping access patterns.

Functions§

fft3d
3D FFT (in-place, complex-to-complex)
fft3d_real
3D FFT of real data (real-to-complex)
fftfreq
Generate FFT frequency values for a given dimension Matches numpy.fft.fftfreq(n, d)
fftfreq_f32
Generate FFT frequency values (f32 version for WASM performance) Matches numpy.fft.fftfreq(n, d)
fftshift
3D FFT shift: swap quadrants so zero-frequency is at center
fftshift_inplace
3D FFT shift in-place: swap quadrants so zero-frequency is at center
idx3d
Index into a 3D array stored in Fortran order (column-major) index = x + ynx + znx*ny
ifft3d
3D IFFT (in-place, complex-to-complex)
ifft3d_real
3D IFFT returning real part (complex-to-real)
ifftshift
3D inverse FFT shift: undo fftshift
wrap_angle
Wrap angle to [-π, π]