ENH: Vendor pocketfft as the ITKPocketFFT third-party module#6532
Conversation
|
Looks correct so far |
|
| Filename | Overview |
|---|---|
| Modules/ThirdParty/PocketFFT/CMakeLists.txt | New top-level module CMakeLists following the Eigen3 pattern; correctly sets up vendored vs system paths, runs configure_file, and exposes ITKPocketFFT_INCLUDE_DIRS. Missing install of vendored files is handled in src/CMakeLists.txt via itk_module_impl() → add_subdirectory(src). |
| Modules/ThirdParty/PocketFFT/src/itk_pocketfft.h.in | Generated entry-point header that sets POCKETFFT_NAMESPACE and POCKETFFT_CACHE_SIZE before the upstream include. Uses #ifndef guards which create a fragility for the system-pocketfft path when another library has already included pocketfft_hdronly.h with its default namespace. |
| Modules/ThirdParty/PocketFFT/src/itkpocketfft/LICENSE.md | LICENSE.md covers only the 2010-2018 Max-Planck-Society copyright but pocketfft_hdronly.h names additional copyright holders (Peter Bell 2019-2020, Matteo Frigo/MIT 2003-2014, Tan Ping Liang/Peter Bell 2024, Cris Luengo 2024). The license file is incomplete relative to the code being distributed. |
| Modules/ThirdParty/PocketFFT/itk-module.cmake | Minimal module declaration with no dependencies; follows standard ITK third-party module pattern. DEPENDS followed immediately by DESCRIPTION is correct CMake argument-parsing idiom for zero dependencies. |
| Modules/ThirdParty/PocketFFT/UpdateFromUpstream.sh | Standard ITK update-third-party script pointing to the ISC fork; exact_tree_match=false is appropriate since only two files are imported from upstream. Tag pinned to for/itk-pocketfft-cpp-c90e55b. |
| Modules/Filtering/FFT/include/itkPocketFFTCommon.h | Updated to use itk_pocketfft.h and itk::detail::pocketfft:: namespace throughout; logic is unchanged. |
| Modules/Filtering/FFT/itk-module.cmake | Adds ITKPocketFFT to ITKFFT's DEPENDS list, correctly modeling the new module dependency. |
| Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/vnl_fft_1d.h | Updated deprecated shim to include itk_pocketfft.h and use itk::detail::pocketfft:: namespace. Comment saying 'Requires ITKFFT module' is still accurate since ITKFFT transitively supplies ITKPocketFFT include dirs. |
| Modules/ThirdParty/PocketFFT/src/itkpocketfft/pocketfft_hdronly.h | Vendored upstream pocketfft header; POCKETFFT_CACHE_SIZE default reverted to 0 (ITK's value is now set in itk_pocketfft.h.in), and arr() default-initializes pointer to nullptr instead of 0. Content otherwise mirrors upstream. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
ITKFFT["ITKFFT module\n(itk-module.cmake)"]
ITKPocketFFT["ITKPocketFFT module\n(ThirdParty)"]
itk_pocketfft_h["itk_pocketfft.h\n(generated via configure_file)\n- #define POCKETFFT_NAMESPACE itk::detail::pocketfft\n- #define POCKETFFT_CACHE_SIZE 16"]
pocketfft_hdronly["itkpocketfft/pocketfft_hdronly.h\n(vendored upstream)"]
system_pocketfft["<pocketfft_hdronly.h>\n(system, if ITK_USE_SYSTEM_POCKETFFT=ON)"]
filters["PocketFFT filter headers\n(itkPocketFFTCommon.h, etc.)"]
vnl["vnl_fft_1d.h\n(deprecated shim)"]
ITKFFT -->|DEPENDS| ITKPocketFFT
ITKPocketFFT --> itk_pocketfft_h
itk_pocketfft_h -->|vendored default| pocketfft_hdronly
itk_pocketfft_h -->|ITK_USE_SYSTEM_POCKETFFT=ON| system_pocketfft
filters -->|#include| itk_pocketfft_h
vnl -->|#include| itk_pocketfft_h
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
ITKFFT["ITKFFT module\n(itk-module.cmake)"]
ITKPocketFFT["ITKPocketFFT module\n(ThirdParty)"]
itk_pocketfft_h["itk_pocketfft.h\n(generated via configure_file)\n- #define POCKETFFT_NAMESPACE itk::detail::pocketfft\n- #define POCKETFFT_CACHE_SIZE 16"]
pocketfft_hdronly["itkpocketfft/pocketfft_hdronly.h\n(vendored upstream)"]
system_pocketfft["<pocketfft_hdronly.h>\n(system, if ITK_USE_SYSTEM_POCKETFFT=ON)"]
filters["PocketFFT filter headers\n(itkPocketFFTCommon.h, etc.)"]
vnl["vnl_fft_1d.h\n(deprecated shim)"]
ITKFFT -->|DEPENDS| ITKPocketFFT
ITKPocketFFT --> itk_pocketfft_h
itk_pocketfft_h -->|vendored default| pocketfft_hdronly
itk_pocketfft_h -->|ITK_USE_SYSTEM_POCKETFFT=ON| system_pocketfft
filters -->|#include| itk_pocketfft_h
vnl -->|#include| itk_pocketfft_h
Reviews (1): Last reviewed commit: "ENH: Vendor pocketfft as the ITKPocketFF..." | Re-trigger Greptile
Move the header-only pocketfft from the FFT module include directory into a proper third-party module, Modules/ThirdParty/PocketFFT, vendored from the InsightSoftwareConsortium/pocketfft fork via UpdateFromUpstream.sh. itk_pocketfft.h is the single entry point: it is the only header that includes pocketfft_hdronly.h, applies ITK's POCKETFFT_NAMESPACE (itk::detail::pocketfft) and POCKETFFT_CACHE_SIZE (16), and exposes the itk::pocketfft alias. The vendored copy keeps upstream defaults so the fork stays a faithful mirror. ITKFFT now DEPENDS ITKPocketFFT; the deprecated vnl_fft_1d shim routes through itk_pocketfft.h.
3e71196 to
a4de8b3
Compare
a879f35
into
InsightSoftwareConsortium:main
Move the header-only pocketfft from the FFT module include directory into a
proper
Modules/ThirdParty/PocketFFTmodule, vendored from theInsightSoftwareConsortium/pocketfft
fork via the standard
UpdateFromUpstream.shmechanism.This gives pocketfft parity with every other ITK third-party inclusion —
even though it is a single header file — so that future upstream pocketfft
updates are maintained the same consistent way as eigen, DCMTK, VNL, etc.
(fork with a
welcomebranch,for/itk-*overlay,UpdateFromUpstream.sh).Upstream pocketfft has also already merged the fix for the compiler warnings
reported on the CDash build
https://open.cdash.org/builds/11378398/build
(mreineck/pocketfft#32), so the vendored copy is warning-clean with no
ITK-local patch required.
What changed
Modules/ThirdParty/PocketFFTmodule (Eigen3 header-only model):itk-module.cmake,CMakeLists.txtwith anITK_USE_SYSTEM_POCKETFFTswitch, and
UpdateFromUpstream.shpinned tofor/itk-pocketfft-cpp-c90e55b.itk_pocketfft.his the single entry point: it is the only header thatincludes
pocketfft_hdronly.h. ITK-specific configuration lives here (not inthe vendored copy), applied before the include:
POCKETFFT_NAMESPACE = itk::detail::pocketfft— confines pocketfft symbolsto an ITK-private namespace so they cannot collide with a
::pocketfftfrom another library (Make pocketfft namespace customizable using POCKETFFT_NAMESPACE definition mreineck/pocketfft#30).
POCKETFFT_CACHE_SIZE = 16.pocketfft_hdronly.hkeeps upstream defaults, so the fork staysa faithful mirror of upstream
cpp(which includes Use nullptr instead of 0 in arr default constructor mreineck/pocketfft#32).ITKFFTnowDEPENDS ITKPocketFFT; the FFT filters and the deprecatedvnl_fft_1dshim includeitk_pocketfft.hand use the fully-qualifieditk::detail::pocketfft::API.Validation
ITKFFTbuilds; all 20 PocketFFT tests pass.itk_pocketfft.handitkpocketfft/{pocketfft_hdronly.h, LICENSE.md}under a single include root; an external consumer including onlyitk_pocketfft.hcompiles and links, withPOCKETFFT_CACHE_SIZE == 16.::pocketfftsymbols; all initk::detail::pocketfft.UpdateFromUpstream.shre-import reproduces the vendored header byte-for-bytewith correct two-parent merge topology.
pre-commit run --all-filespasses.