From 4c921759490475cf7a4cfe18e1350fba7a567409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 20 Nov 2026 16:51:36 -0500 Subject: [PATCH 1/2] BUG: Wrap the vector gradient filter type of StrainImageFilter StrainImageFilter::VectorGradientFilterType is an ImageToImageFilter from a Vector image to a CovariantVector image. ITKCommon wraps that pair only for enabled vector and covariant vector types, so for double Strain types igenerator reported it as not wrapped. Float Strain types are now wrapped only when float Vector and CovariantVector images are. Without them, the gradient filter types were reported as not wrapped, or the input image type was undefined. --- .../Strain/wrapping/itkStrainImageFilter.wrap | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Modules/Filtering/Strain/wrapping/itkStrainImageFilter.wrap b/Modules/Filtering/Strain/wrapping/itkStrainImageFilter.wrap index f154df8fa31..99766783625 100644 --- a/Modules/Filtering/Strain/wrapping/itkStrainImageFilter.wrap +++ b/Modules/Filtering/Strain/wrapping/itkStrainImageFilter.wrap @@ -1,4 +1,14 @@ -unique(types "D;${WRAP_ITK_REAL}") +# The gradient filter types need Vector and CovariantVector images, which are +# always wrapped for double but for float only when enabled. +set(types D) +foreach(p ${WRAP_ITK_REAL}) + list(FIND WRAP_ITK_VECTOR_REAL "V${p}" vector_index) + list(FIND WRAP_ITK_COV_VECTOR_REAL "CV${p}" covariant_vector_index) + if(vector_index GREATER -1 AND covariant_vector_index GREATER -1) + list(APPEND types ${p}) + endif() +endforeach() +list(REMOVE_DUPLICATES types) itk_wrap_include("itkImageToImageFilter.h") itk_wrap_class("itk::ImageToImageFilter" POINTER) @@ -9,6 +19,15 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) "${ITKM_IV${p}${vector_dim}${d}}${ITKM_ISSRT${p}${d}${d}}" "${ITKT_IV${p}${vector_dim}${d}}, ${ITKT_ISSRT${p}${d}${d}}" ) + # VectorGradientFilterType; ITKCommon wraps it only for enabled vector types. + list(FIND WRAP_ITK_VECTOR_REAL "V${p}" vector_index) + list(FIND WRAP_ITK_COV_VECTOR_REAL "CV${p}" covariant_vector_index) + if(vector_index EQUAL -1 OR covariant_vector_index EQUAL -1) + itk_wrap_template( + "${ITKM_IV${p}${vector_dim}${d}}${ITKM_ICV${p}${vector_dim}${d}}" + "${ITKT_IV${p}${vector_dim}${d}}, ${ITKT_ICV${p}${vector_dim}${d}}" + ) + endif() endforeach() endforeach() itk_end_wrap_class() From 7c49a35b54493260628af719a5e5e1276b755483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 20 Nov 2026 16:51:54 -0500 Subject: [PATCH 2/2] BUG: Wrap the types that IsotropicWavelets wrappings refer to igenerator reported types that wrapped IsotropicWavelets methods use but that nothing wraps: - Matrix methods take complex Vector, Point and CovariantVector, which do not compile for complex values. No IsotropicWavelets class uses a complex Matrix, so it is not wrapped. - VariableSizeMatrix uses Array, now wrapped along with vnl_vector> when complex double wrapping is off. - RieszStructureTensorImageFilter::GetGaussianSource() returns a GaussianImageSource of double images, now wrapped with its superclasses when double wrapping is off. Python expression tests cover GetGaussianSource() and complex Array. --- .../IsotropicWavelets/wrapping/CMakeLists.txt | 1 - .../wrapping/itkMatrixComplex.wrap | 7 ------- .../itkRieszStructureTensorImageFilter.wrap | 17 +++++++++++++++++ .../itkVariableSizeMatrixComplex.wrap | 19 ++++++++++++++++++- .../wrapping/test/CMakeLists.txt | 9 +++++++++ 5 files changed, 44 insertions(+), 9 deletions(-) delete mode 100644 Modules/Filtering/IsotropicWavelets/wrapping/itkMatrixComplex.wrap diff --git a/Modules/Filtering/IsotropicWavelets/wrapping/CMakeLists.txt b/Modules/Filtering/IsotropicWavelets/wrapping/CMakeLists.txt index 307a5971120..79a84e4169e 100644 --- a/Modules/Filtering/IsotropicWavelets/wrapping/CMakeLists.txt +++ b/Modules/Filtering/IsotropicWavelets/wrapping/CMakeLists.txt @@ -1,7 +1,6 @@ itk_wrap_module(IsotropicWavelets) set( WRAPPER_SUBMODULE_ORDER - itkMatrixComplex itkVariableSizeMatrixComplex itkRieszStructureTensorImageFilter itkMonogenicSignalFrequencyImageFilter diff --git a/Modules/Filtering/IsotropicWavelets/wrapping/itkMatrixComplex.wrap b/Modules/Filtering/IsotropicWavelets/wrapping/itkMatrixComplex.wrap deleted file mode 100644 index 712acecccd9..00000000000 --- a/Modules/Filtering/IsotropicWavelets/wrapping/itkMatrixComplex.wrap +++ /dev/null @@ -1,7 +0,0 @@ -itk_wrap_class("itk::Matrix") -foreach(d 2 3) - foreach(t ${WRAP_ITK_COMPLEX_REAL}) - itk_wrap_template("${ITKM_${t}}${d}${d}" "${ITKT_${t}},${d},${d}") - endforeach() -endforeach() -itk_end_wrap_class() diff --git a/Modules/Filtering/IsotropicWavelets/wrapping/itkRieszStructureTensorImageFilter.wrap b/Modules/Filtering/IsotropicWavelets/wrapping/itkRieszStructureTensorImageFilter.wrap index 1fb319d83bf..9858cdde034 100644 --- a/Modules/Filtering/IsotropicWavelets/wrapping/itkRieszStructureTensorImageFilter.wrap +++ b/Modules/Filtering/IsotropicWavelets/wrapping/itkRieszStructureTensorImageFilter.wrap @@ -1,5 +1,22 @@ itk_wrap_include("itkVariableSizeMatrix.h") +# GaussianSourceType, when ITKImageSources does not wrap double images. +if(NOT "D" IN_LIST WRAP_ITK_SCALAR) + foreach( + source + ImageSource + GenerateImageSource + ParametricImageSource + GaussianImageSource + ) + itk_wrap_class("itk::${source}" POINTER) + foreach(d ${ITK_WRAP_IMAGE_DIMS}) + itk_wrap_template("${ITKM_ID${d}}" "${ITKT_ID${d}}") + endforeach() + itk_end_wrap_class() + endforeach() +endif() + itk_wrap_class("itk::Image" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) itk_wrap_template("VSM${d}" diff --git a/Modules/Filtering/IsotropicWavelets/wrapping/itkVariableSizeMatrixComplex.wrap b/Modules/Filtering/IsotropicWavelets/wrapping/itkVariableSizeMatrixComplex.wrap index f6401f1fd62..85ca1d489e0 100644 --- a/Modules/Filtering/IsotropicWavelets/wrapping/itkVariableSizeMatrixComplex.wrap +++ b/Modules/Filtering/IsotropicWavelets/wrapping/itkVariableSizeMatrixComplex.wrap @@ -1,6 +1,23 @@ -itk_wrap_class("itk::VariableSizeMatrix") +set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) +itk_wrap_include("itkVariableSizeMatrix.h") + # CD is the superclass of RieszRotationMatrix. unique(variable_size_matrix_types "${WRAP_ITK_COMPLEX_REAL};CD") + +# Array is the vector type of VariableSizeMatrix, and vnl_vector its superclass. +if(NOT "CD" IN_LIST WRAP_ITK_COMPLEX_REAL) + itk_wrap_class("vnl_vector" EXPLICIT_SPECIALIZATION) + itk_wrap_template("${ITKM_CD}" "${ITKT_CD}") + itk_end_wrap_class() +endif() + +itk_wrap_class("itk::Array") +foreach(t ${variable_size_matrix_types}) + itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") +endforeach() +itk_end_wrap_class() + +itk_wrap_class("itk::VariableSizeMatrix") foreach(t ${variable_size_matrix_types}) itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") endforeach() diff --git a/Modules/Filtering/IsotropicWavelets/wrapping/test/CMakeLists.txt b/Modules/Filtering/IsotropicWavelets/wrapping/test/CMakeLists.txt index 559e216ee71..5019b2cb8ba 100644 --- a/Modules/Filtering/IsotropicWavelets/wrapping/test/CMakeLists.txt +++ b/Modules/Filtering/IsotropicWavelets/wrapping/test/CMakeLists.txt @@ -86,3 +86,12 @@ itk_python_expression_add_test( NAME itkIsotropicWaveletsUtilitiesPythonTest EXPRESSION "itk.IsotropicWaveletsUtilities.Factorial(2)" ) +itk_python_expression_add_test( + NAME itkRieszStructureTensorImageFilterGaussianSourcePythonTest + EXPRESSION + "assert isinstance(itk.RieszStructureTensorImageFilter[itk.Image[itk.F, 2], itk.Image[itk.VariableSizeMatrix[itk.D], 2]].New().GetGaussianSource(), itk.GaussianImageSource[itk.Image[itk.D, 2]])" +) +itk_python_expression_add_test( + NAME itkArrayComplexPythonTest + EXPRESSION "instance = itk.Array[itk.complex[itk.D]](3)" +)