ENH: Add StructuralSimilarityImageFilter at Modules/Filtering#6094
Conversation
78c7b8f to
ae93a00
Compare
|
| Filename | Overview |
|---|---|
| Modules/Filtering/StructuralSimilarity/include/itkStructuralSimilarityImageFilter.h | Adds the SSIM filter header; well-structured ITK class with clean type aliases, itkSetMacro/itkGetConstMacro accessors, and proper concept check for numeric traits. |
| Modules/Filtering/StructuralSimilarity/include/itkStructuralSimilarityImageFilter.hxx | Implements SSIM via a five-Gaussian mini-pipeline; algorithm is mathematically correct but VerifyPreconditions() misses a MaximumKernelWidth==0 guard, and subInterior.GetNumberOfPixels() is re-evaluated every inner-loop iteration. |
| Modules/Filtering/StructuralSimilarity/itk-module.cmake | Module descriptor compiles cleanly but classifies ITKSmoothing and ITKImageFilterBase as COMPILE_DEPENDS when they are instantiated at runtime inside GenerateData(), which may require them to be DEPENDS for correct downstream linking. |
| Modules/Filtering/StructuralSimilarity/test/itkStructuralSimilarityImageFilterGTest.cxx | Comprehensive 30-case GTest suite covering identities, analytic closed-form checks, error-throw paths, multi-dimensional support, pixel-type variants, and cross-validation against scikit-image reference values. |
| Modules/Filtering/StructuralSimilarity/wrapping/itkStructuralSimilarityImageFilter.wrap | Wraps WRAP_ITK_REAL types with 2 template parameters, producing only same-type pairs; missing the (double→float) combination that matches the C++ default output type. |
| pyproject.toml | Adds -DModule_StructuralSimilarity:BOOL=ON to the configure-ci task; correctly scoped to the CI preset without altering the default configure task. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Input1: TInputImage"] --> C1["Cast to RealImage x"]
B["Input2: TInputImage"] --> C2["Cast to RealImage y"]
C1 --> G_x["Gaussian → mu_x"]
C2 --> G_y["Gaussian → mu_y"]
C1 --> MXX["x times x"]
C2 --> MYY["y times y"]
C1 --> MXY["x times y"]
C2 --> MXY
MXX --> G_xx["Gaussian → E_xx"]
MYY --> G_yy["Gaussian → E_yy"]
MXY --> G_xy["Gaussian → E_xy"]
G_x --> COMBINE["Per-pixel SSIM combination\nParallelizeImageRegion\nvar_x = E_xx - mu_x^2\nvar_y = E_yy - mu_y^2\ncov_xy = E_xy - mu_x*mu_y"]
G_y --> COMBINE
G_xx --> COMBINE
G_yy --> COMBINE
G_xy --> COMBINE
COMBINE --> OUT["Output SSIM map"]
COMBINE --> MEAN["m_MeanSSIM over interior region"]
Reviews (1): Last reviewed commit: "ENH: Add StructuralSimilarityImageFilter..." | Re-trigger Greptile
9dc9057 to
396b0c5
Compare
New standalone module at Modules/Filtering/StructuralSimilarity/ containing StructuralSimilarityImageFilter (SSIM, Wang et al. 2004). Computes per-pixel SSIM map and scalar mean SSIM between two images using a sliding Gaussian window over local luminance, contrast, and structure terms. Placed as a standalone module under Filtering/ rather than extending the existing ImageCompare module, to avoid perturbing a core module's dependency surface for a new filter. Enabled in CI via configure-ci. Reference: Wang Z., Bovik A.C., Sheikh H.R., Simoncelli E.P., "Image quality assessment: From error visibility to structural similarity," IEEE Trans. Image Processing 13(4), 2004. Co-Authored-By: Hans Johnson <hans-johnson@uiowa.edu>
396b0c5 to
bb8bd7e
Compare
Adds
Modules/Filtering/StructuralSimilarity/containingStructuralSimilarityImageFilter(SSIM, Wang et al. 2004). Standalone module under Filtering — does not touch ImageCompare or any other existing module. Enabled in CI viaconfigure-ci. Supersedes #6034 (which was stacked on the now-rejectedModules/Beta/approach in #6085).What changed from PR #6034
Modules/Beta/StructuralSimilarity/, stacked on ENH: Add Modules/Beta/ container (infra-only for stacked beta-module ingests) #6085 (Modules/Beta/container, rejected by reviewers)Modules/Filtering/StructuralSimilarity/, based directly onupstream/main. No dependency on ENH: Add Modules/Beta/ container (infra-only for stacked beta-module ingests) #6085 or WIP: ENH: Ingest 10 beta modules inline under Modules/Beta/ (stacked on #6085) #6086.-DModule_StructuralSimilarity:BOOL=ONtoconfigure-ciinpyproject.tomlModule layout
Local verification
Reviewer feedback addressed
From #6034:
From #6094:
m_ScaleWeightsvia theArray(SizeValueType, const ValueType &)ctor directly in the header NSDMI; collapse declare-then-Fill patterns in tests toImageType::SizeType::Filled(size); use CTAD on iterators and drop redundantGoToBegin().m_MaximumKernelWidth == 0guard inVerifyPreconditions()plus a newZeroMaximumKernelWidth_Throwstest case.subInterior.GetNumberOfPixels() > 0out of the per-pixel inner loop intoconst bool subInteriorIsNonEmpty.ITKImageFilterBaseandITKSmoothingfromCOMPILE_DEPENDStoDEPENDS(parallel to the fix in COMP: Fix COMPILE_DEPENDS → DEPENDS in three Filtering module declara… #6097).AI assistance
Array(SizeValueType, const ValueType &)ctor,::Filled(size), iterator CTAD); Greptile P1MaximumKernelWidth == 0guard + regression test; Greptile P2 loop-invariant hoisting;COMPILE_DEPENDS → DEPENDSalignment with COMP: Fix COMPILE_DEPENDS → DEPENDS in three Filtering module declara… #6097