Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure time warnings with wrappings #143

Open
phcerdan opened this issue Jun 28, 2021 · 1 comment
Open

Configure time warnings with wrappings #143

phcerdan opened this issue Jun 28, 2021 · 1 comment
Labels

Comments

@phcerdan
Copy link
Collaborator

This module works a lot with std::complex , and in StructureTensor each pixel is very small image.

Those cases are not wrapped in ITK, so some API won't be accessible from python.

Generated at configure time with wrappings enabled:

Generating /path/../IsotropicWavelets_snake_case.py
itkMatrixComplex: warning(4): ITK type not wrapped, or currently not known: itk::Vector< std::complex< float >, 2 >
itkMatrixComplex: warning(4): ITK type not wrapped, or currently not known: itk::Point< std::complex< float >, 2 >
itkMatrixComplex: warning(4): ITK type not wrapped, or currently not known: itk::CovariantVector< std::complex< float >, 2 >
itkMatrixComplex: warning(4): ITK type not wrapped, or currently not known: itk::Vector< std::complex< float >, 3 >
itkMatrixComplex: warning(4): ITK type not wrapped, or currently not known: itk::Point< std::complex< float >, 3 >
itkMatrixComplex: warning(4): ITK type not wrapped, or currently not known: itk::CovariantVector< std::complex< float >, 3 >
itkVariableSizeMatrixComplex: warning(4): ITK type not wrapped, or currently not known: itk::Array< std::complex< float > >
itkStructureTensor: warning(4): ITK type not wrapped, or currently not known: itk::GaussianImageSource< itk::Image< double, 3 > >
itkRieszRotationMatrix: warning(4): ITK type not wrapped, or currently not known: itk::Array< std::complex< double > >
@phcerdan
Copy link
Collaborator Author

phcerdan commented Jun 29, 2021

The following warning will go away if ITK is build with ITK_WRAP_complex_double

itkStructureTensor: warning(4): ITK type not wrapped, or currently not known: itk::GaussianImageSource< itk::Image< double, 3 > >

However, all the core types associates to itkMatrix will still be missing. If we wrap all of them in itkMatrixComplex.wrap.

itk_wrap_class("itk::Vector")
  foreach(d 2 3)
    foreach(t ${WRAP_ITK_COMPLEX_REAL})
      itk_wrap_template("${ITKM_${t}}${d}" "${ITKT_${t}},${d}")
    endforeach()
  endforeach()
itk_end_wrap_class()

itk_wrap_class("itk::Point")
  foreach(d 2 3)
    foreach(t ${WRAP_ITK_COMPLEX_REAL})
      itk_wrap_template("${ITKM_${t}}${d}" "${ITKT_${t}},${d}")
    endforeach()
  endforeach()
itk_end_wrap_class()

itk_wrap_class("itk::CovariantVector")
  foreach(d 2 3)
    foreach(t ${WRAP_ITK_COMPLEX_REAL})
      itk_wrap_template("${ITKM_${t}}${d}" "${ITKT_${t}},${d}")
    endforeach()
  endforeach()
itk_end_wrap_class()

itk_wrap_class("itk::FixedArray")
  foreach(d 2 3)
    foreach(t ${WRAP_ITK_COMPLEX_REAL})
      itk_wrap_template("${ITKM_${t}}${d}" "${ITKT_${t}},${d}")
    endforeach()
  endforeach()
itk_end_wrap_class()

itk_wrap_class("itk::Array")
  foreach(t ${WRAP_ITK_COMPLEX_REAL})
      itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}")
  endforeach()
itk_end_wrap_class()

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()

We face compile time errors because a mix of std::complex<double>and scalar float and viceversa, std::complex<float> and double. And also std::complex<T> with std::complex<T'>.

Modules/Core/Common/include/itkVector.hxx:135:71: error: no match foroperator*’ (operand types are ‘itk::FixedArray<std::complex<float>, 3>::ValueType’ {aka ‘std::complex<float>’} andconst RealValueType’ {aka ‘const std::complex<double>’})
  135 |     (*this)[i] = static_cast<T>(static_cast<RealValueType>((*this)[i] * inversedNorm))

Modules/Core/Common/include/itkPoint.hxx:215:26: error: no match foroperator*’ (operand types are ‘const doubleandconst ValueType’ {aka ‘const std::complex<float>’})
  215 |     (*this)[i] += weight * P[N - 1][i];

Some of this errors might be fixed tweaking the itkNumericTraits for std::complex. RealValueType might be changed to be a scalar, not a std::complex.

However, these failures are expected, itkPoint might be conceived as a real point in space, not as a container for other types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant