From 72c035f6fde34c1cbf133d205cece304b226b66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Thu, 9 Feb 2023 10:49:06 -0500 Subject: [PATCH] COMP: Fix `Regitration::FEM` module `PrintSelf` compiler errors Fix miscellaneous compiler errors in `Registration::FEM` module classes' `PrintSelf` methods. Fixes: ``` ITK\Modules\Registration\FEM\include\itkFEMFiniteDifferenceFunctionLoad.hxx(358,3): error C2440: 'static_cast': cannot convert from 'const itk::fem::Solution::ConstPointer' to 'const itk::LightObject *' ``` ``` ITK\Modules\Registration\FEM\include\itkFEMFiniteDifferenceFunctionLoad.hxx(358,3): error C2039: 'Print': is not a member of 'itk::fem::Solution' ``` and ``` ITK\Modules\Numerics\FEM\include\itkImageToRectilinearFEMObjectFilter.hxx(302,22): error C2275: 'itk::fem::Material': expected an expression instead of a type ``` ``` ITK\Modules\Numerics\FEM\include\itkImageToRectilinearFEMObjectFilter.hxx(302,3): error C3861: 'itkPrintSelfObject': identifier not found ``` and ``` ITK\Modules\Registration\FEM\include\itkFEMRegistrationFilter.hxx(1471,9): error C2440: 'static_cast': cannot convert from 'const unsigned int' to 'itk::Size<3>' ``` ``` ITK\Modules\Registration\FEM\include\itkFEMRegistrationFilter.hxx(1529,16): error C2679: binary '<<': no operator found which takes a right-hand operand of type 'const itk::fem::FEMRegistrationFilter::LandmarkArrayType' (or there is no acceptable conversion) ``` raised for example in: https://open.cdash.org/viewBuildError.php?buildid=8462352 Inadvertently introduced in c47ed1c1b3e26051de655f7ad03e975fae93b73b. --- .../include/itkImageToRectilinearFEMObjectFilter.hxx | 2 +- .../FEM/include/itkFEMFiniteDifferenceFunctionLoad.hxx | 10 +++++++++- .../FEM/include/itkFEMRegistrationFilter.hxx | 9 +++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Modules/Numerics/FEM/include/itkImageToRectilinearFEMObjectFilter.hxx b/Modules/Numerics/FEM/include/itkImageToRectilinearFEMObjectFilter.hxx index d1d528dfccd..a08e3878b6a 100644 --- a/Modules/Numerics/FEM/include/itkImageToRectilinearFEMObjectFilter.hxx +++ b/Modules/Numerics/FEM/include/itkImageToRectilinearFEMObjectFilter.hxx @@ -299,7 +299,7 @@ ImageToRectilinearFEMObjectFilter::PrintSelf(std::ostream & os, Ind os << indent << "NumberOfElements: " << m_NumberOfElements << std::endl; os << indent << "PixelsPerElement: " << m_PixelsPerElement << std::endl; - itkPrintSelfObject(Material); + itkPrintSelfObjectMacro(Material); itkPrintSelfObjectMacro(Element); } diff --git a/Modules/Registration/FEM/include/itkFEMFiniteDifferenceFunctionLoad.hxx b/Modules/Registration/FEM/include/itkFEMFiniteDifferenceFunctionLoad.hxx index 3b29821d7b3..bf20560678e 100644 --- a/Modules/Registration/FEM/include/itkFEMFiniteDifferenceFunctionLoad.hxx +++ b/Modules/Registration/FEM/include/itkFEMFiniteDifferenceFunctionLoad.hxx @@ -355,7 +355,15 @@ FiniteDifferenceFunctionLoad::PrintSelf(std::ostream & os, Inde os << indent << "SolutionIndex2: " << m_SolutionIndex2 << std::endl; os << indent << "Gamma: " << m_Gamma << std::endl; - itkPrintSelfObjectMacro(Solution); + os << indent << "Solution: "; + if (m_Solution != nullptr) + { + os << m_Solution << std::endl; + } + else + { + os << "(null)" << std::endl; + } os << indent << "GradSigma: " << static_cast::PrintType>(m_GradSigma) << std::endl; os << indent << "Sign: " << m_Sign << std::endl; diff --git a/Modules/Registration/FEM/include/itkFEMRegistrationFilter.hxx b/Modules/Registration/FEM/include/itkFEMRegistrationFilter.hxx index c23898a5e2b..a6c1d88c221 100644 --- a/Modules/Registration/FEM/include/itkFEMRegistrationFilter.hxx +++ b/Modules/Registration/FEM/include/itkFEMRegistrationFilter.hxx @@ -1468,7 +1468,8 @@ FEMRegistrationFilter::PrintSelf(std::ost os << indent << "FileCount: " << m_FileCount << std::endl; os << indent << "CurrentLevel: " << m_CurrentLevel << std::endl; os << indent << "CurrentLevelImageSize: " - << static_cast::PrintType>(m_CurrentLevel) << std::endl; + << static_cast::PrintType>(m_CurrentLevelImageSize) + << std::endl; os << indent << "WhichMetric: " << m_WhichMetric << std::endl; os << indent << "MeshPixelsPerElementAtEachResolution: " << m_MeshPixelsPerElementAtEachResolution << std::endl; @@ -1526,7 +1527,11 @@ FEMRegistrationFilter::PrintSelf(std::ost itkPrintSelfObjectMacro(Metric); itkPrintSelfObjectMacro(FEMObject); - os << indent << "LandmarkArray: " << m_LandmarkArray << std::endl; + os << indent << "LandmarkArray: "; + for (const auto & elem : m_LandmarkArray) + { + os << indent.GetNextIndent() << "[" << &elem - &*(m_LandmarkArray.begin()) << "]: " << *elem << std::endl; + } itkPrintSelfObjectMacro(Interpolator);