From e6a435c7eae9a957118982c2986946b41c78a604 Mon Sep 17 00:00:00 2001 From: "Stephen R. Aylward" Date: Mon, 4 Oct 2021 17:00:45 -0400 Subject: [PATCH] Fix dashboards (#83) * BUG: Fixed typename, overload, protected variable reference, incorrect capitalization, and matrix.as_ref() usage. * Use itkv5.3rc01 --- .github/workflows/build-test-package.yml | 2 +- .github/workflows/clang-format-linter.yml | 12 +++++ setup.py | 1 + ...tktubeSubSampleTubeSpatialObjectFilter.hxx | 2 +- ...alSpatialObjectToImageRegistrationMethod.h | 2 +- ...SpatialObjectToImageRegistrationMethod.hxx | 4 +- ...bePointBasedSpatialObjectToImageMetric.hxx | 49 ++++++++++--------- ...PointBasedSpatialObjectTransformFilter.hxx | 9 ++-- .../itktubeSpatialObjectToImageMetric.h | 4 +- ...beSpatialObjectToImageRegistrationMethod.h | 2 +- ...SpatialObjectToImageRegistrationMethod.hxx | 2 +- src/Segmentation/itktubeRadiusExtractor3.hxx | 2 +- src/Segmentation/itktubeRidgeExtractor.hxx | 2 +- 13 files changed, 54 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/clang-format-linter.yml diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index d13ca266f..858f0038f 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -5,7 +5,7 @@ on: [push,pull_request] env: ITKMinimalPathExtraction-git-tag: v1.2.0 vtk-git-tag: "1681cee3489800373c2e183af2d3ca8552e05940" - itk-git-tag: v5.2.1 + itk-git-tag: v5.3rc01 jobs: build-test-cxx: diff --git a/.github/workflows/clang-format-linter.yml b/.github/workflows/clang-format-linter.yml new file mode 100644 index 000000000..c59dd5875 --- /dev/null +++ b/.github/workflows/clang-format-linter.yml @@ -0,0 +1,12 @@ +name: clang-format linter + +on: [push,pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master diff --git a/setup.py b/setup.py index 7c5c367a0..a6dfb21a2 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,7 @@ keywords='ITK InsightToolkit', url=r'https://itk.org/', install_requires=[ + r'numpy', r'itk>=5.2.1.post1', r'itk-minimalpathextraction>=1.2.0' ] diff --git a/src/Filtering/itktubeSubSampleTubeSpatialObjectFilter.hxx b/src/Filtering/itktubeSubSampleTubeSpatialObjectFilter.hxx index 30c1d5bb3..6a7a7de6b 100644 --- a/src/Filtering/itktubeSubSampleTubeSpatialObjectFilter.hxx +++ b/src/Filtering/itktubeSubSampleTubeSpatialObjectFilter.hxx @@ -50,7 +50,7 @@ void SubSampleTubeSpatialObjectFilter< ObjectDimension > ::GenerateData( void ) { - typename const TubeSpatialObjectType * input = + const TubeSpatialObjectType * input = dynamic_cast( this->GetInput() ); if (input == nullptr) { diff --git a/src/Registration/itktubeInitialSpatialObjectToImageRegistrationMethod.h b/src/Registration/itktubeInitialSpatialObjectToImageRegistrationMethod.h index 8e6326f80..0c3056bba 100644 --- a/src/Registration/itktubeInitialSpatialObjectToImageRegistrationMethod.h +++ b/src/Registration/itktubeInitialSpatialObjectToImageRegistrationMethod.h @@ -56,7 +56,7 @@ class InitialSpatialObjectToImageRegistrationMethod // // Typedefs from Superclass // - typedef Superclass::SpatialObjectType SpatialObjectType; + typedef typename Superclass::SpatialObjectType SpatialObjectType; itkStaticConstMacro( ImageDimension, unsigned int, TImage::ImageDimension ); diff --git a/src/Registration/itktubeInitialSpatialObjectToImageRegistrationMethod.hxx b/src/Registration/itktubeInitialSpatialObjectToImageRegistrationMethod.hxx index bd7acbc55..c110b3f36 100644 --- a/src/Registration/itktubeInitialSpatialObjectToImageRegistrationMethod.hxx +++ b/src/Registration/itktubeInitialSpatialObjectToImageRegistrationMethod.hxx @@ -171,7 +171,7 @@ InitialSpatialObjectToImageRegistrationMethod this->m_NumberOfMoments == 0 ) { // Moving image info - typedef SpatialObjectType::BoundingBoxType BoundingBoxType; + typedef typename SpatialObjectType::BoundingBoxType BoundingBoxType; typename BoundingBoxType::ConstPointer bbox; typename BoundingBoxType::PointType minPnt; typename BoundingBoxType::PointType maxPnt; @@ -203,7 +203,7 @@ InitialSpatialObjectToImageRegistrationMethod Point fixedCenterPoint; if( this->GetFixedImageMaskObject() != nullptr ) { - typedef SpatialObjectType::BoundingBoxType BoundingBoxType; + typedef typename SpatialObjectType::BoundingBoxType BoundingBoxType; typename BoundingBoxType::ConstPointer bbox; typename BoundingBoxType::PointType minPnt; typename BoundingBoxType::PointType maxPnt; diff --git a/src/Registration/itktubePointBasedSpatialObjectToImageMetric.hxx b/src/Registration/itktubePointBasedSpatialObjectToImageMetric.hxx index d63cc46ea..896d4610f 100644 --- a/src/Registration/itktubePointBasedSpatialObjectToImageMetric.hxx +++ b/src/Registration/itktubePointBasedSpatialObjectToImageMetric.hxx @@ -87,7 +87,7 @@ PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > m_MaximumNumberOfSurfacePoints = 0; typename PointBasedSpatialObjectType::ChildrenConstListType * pbsoList = - this->GetPointBasedChildren( m_MovingSpatialObject ); + this->GetPointBasedChildren( this->m_MovingSpatialObject ); typename PointBasedSpatialObjectType::ChildrenConstListType::const_iterator pbsoIter; for( pbsoIter = pbsoList->begin(); pbsoIter != pbsoList->end(); @@ -158,7 +158,7 @@ PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > unsigned int pointCount = 0; typename PointBasedSpatialObjectType::ChildrenConstListType * pbsoList = - this->GetPointBasedChildren( m_MovingSpatialObject ); + this->GetPointBasedChildren( this->m_MovingSpatialObject ); auto pbsoIter = pbsoList->begin(); while( pbsoIter != pbsoList->end() ) { @@ -254,14 +254,14 @@ PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > unsigned int pointCount = 0; typename PointBasedSpatialObjectType::ChildrenConstListType * pbsoList = - this->GetPointBasedChildren( m_MovingSpatialObject ); - std::string oName = m_MovingSpatialObject->GetTypeName(); + this->GetPointBasedChildren( this->m_MovingSpatialObject ); + std::string oName = this->m_MovingSpatialObject->GetTypeName(); if (oName.find("Tube") != std::string::npos || oName.find("Surface") != std::string::npos || oName.find("Blob") != std::string::npos || oName.find("Point") != std::string::npos) { - pbsoList->push_front( m_MovingSpatialObject.GetPointer() ); + pbsoList->push_front( this->m_MovingSpatialObject.GetPointer() ); } auto pbsoIter = pbsoList->begin(); while( pbsoIter != pbsoList->end() ) @@ -450,7 +450,7 @@ PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > } if( childrenSO == nullptr ) { - childrenSO = new MovingSpatialObjectType::ChildrenConstListType; + childrenSO = new typename MovingSpatialObjectType::ChildrenConstListType; } auto tmpChildren = parentSO->GetConstChildren(); @@ -503,9 +503,9 @@ PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > transformCopy->SetFixedParameters( this->m_Transform->GetFixedParameters() ); transformCopy->SetParameters( parameters ); - NJetImageFunction< FixedImageType >::Pointer imFunc = + typename NJetImageFunction< FixedImageType >::Pointer imFunc = NJetImageFunction< FixedImageType >::New(); - imFunc->SetInputImage( m_FixedImage ); + imFunc->SetInputImage( this->m_FixedImage ); VnlVectorType n1T, n2T; @@ -599,9 +599,9 @@ PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > transformCopy->SetFixedParameters( this->m_Transform->GetFixedParameters() ); transformCopy->SetParameters( parameters ); - NJetImageFunction< FixedImageType >::Pointer imFunc = + typename NJetImageFunction< FixedImageType >::Pointer imFunc = NJetImageFunction< FixedImageType >::New(); - imFunc->SetInputImage( m_FixedImage ); + imFunc->SetInputImage( this->m_FixedImage ); VnlMatrixType biasV; VnlVectorType n1T, n2T; @@ -687,7 +687,7 @@ PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > { value = - value / weightSum; - VnlMatrixType biasVI = vnl_matrix_inverse< double >( biasV ).inverse(); + VnlMatrixType biasVI = vnl_matrix_inverse< double >( biasV.as_ref() ).inverse(); derivative.fill(0); @@ -702,10 +702,10 @@ PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > dXT = dXT * biasVI; typename TransformType::JacobianType jacobian; - m_Transform->ComputeJacobianWithRespectToParameters( fixedPoint, + this->m_Transform->ComputeJacobianWithRespectToParameters( fixedPoint, jacobian ); - for( unsigned int p = 0; pGetNumberOfParameters(); ++p) + for( unsigned int p = 0; pm_Transform->GetNumberOfParameters(); ++p) { for( unsigned int d=0; d return false; } } - if( m_MovingSpatialObjectMaskObject.IsNotNull() && - m_UseMovingSpatialObjectMaskObject ) + if( this->m_MovingSpatialObjectMaskObject.IsNotNull() && + this->m_UseMovingSpatialObjectMaskObject ) { - if( !m_MovingSpatialObjectMaskObject->IsInsideInWorldSpace( + if( !this->m_MovingSpatialObjectMaskObject->IsInsideInWorldSpace( pnt.GetPositionInWorldSpace() ) ) { return false; @@ -749,10 +749,10 @@ bool PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > ::IsValidMovingPoint( const SurfacePointType & pnt ) const { - if( m_MovingSpatialObjectMaskObject.IsNotNull() && - m_UseMovingSpatialObjectMaskObject ) + if( this->m_MovingSpatialObjectMaskObject.IsNotNull() && + this->m_UseMovingSpatialObjectMaskObject ) { - if( !m_MovingSpatialObjectMaskObject->IsInsideInWorldSpace( + if( !this->m_MovingSpatialObjectMaskObject->IsInsideInWorldSpace( pnt.GetPositionInWorldSpace() ) ) { return false; @@ -766,10 +766,10 @@ bool PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > ::IsValidMovingPoint( const BlobPointType & pnt ) const { - if( m_MovingSpatialObjectMaskObject.IsNotNull() && - m_UseMovingSpatialObjectMaskObject ) + if( this->m_MovingSpatialObjectMaskObject.IsNotNull() && + this->m_UseMovingSpatialObjectMaskObject ) { - if( !m_MovingSpatialObjectMaskObject->IsInsideInWorldSpace( + if( !this->m_MovingSpatialObjectMaskObject->IsInsideInWorldSpace( pnt.GetPositionInWorldSpace() ) ) { return false; @@ -783,9 +783,10 @@ bool PointBasedSpatialObjectToImageMetric< ObjectDimension, TFixedImage > ::IsValidFixedPoint( const FixedPointType & pnt ) const { - if( m_FixedImageMaskObject.IsNotNull() && m_UseFixedImageMaskObject ) + if( this->m_FixedImageMaskObject.IsNotNull() && + this->m_UseFixedImageMaskObject ) { - if( !m_FixedImageMaskObject->IsInsideInWorldSpace( pnt ) ) + if( !this->m_FixedImageMaskObject->IsInsideInWorldSpace( pnt ) ) { return false; } diff --git a/src/Registration/itktubePointBasedSpatialObjectTransformFilter.hxx b/src/Registration/itktubePointBasedSpatialObjectTransformFilter.hxx index 6b0ce66ef..7a008638f 100644 --- a/src/Registration/itktubePointBasedSpatialObjectTransformFilter.hxx +++ b/src/Registration/itktubePointBasedSpatialObjectTransformFilter.hxx @@ -25,6 +25,7 @@ limitations under the License. #include "itktubePointBasedSpatialObjectTransformFilter.h" +#include #include namespace itk @@ -58,8 +59,8 @@ void PointBasedSpatialObjectTransformFilter< TTransformType, TDimension > ::GenerateData( void ) { - SpatialObject::ConstPointer inputSO = this->GetInput(); - SpatialObject::Pointer outputSO = this->GetOutput(); + typename SpatialObject::ConstPointer inputSO = this->GetInput(); + typename SpatialObject::Pointer outputSO = this->GetOutput(); Transform(inputSO, outputSO); @@ -69,7 +70,7 @@ PointBasedSpatialObjectTransformFilter< TTransformType, TDimension > typename ChildrenConstListType::iterator it = children->begin(); while( it != children->end() ) { - SpatialObject::Pointer tmpSO = (*it)->Clone(); + typename SpatialObject::Pointer tmpSO = (*it)->Clone(); this->UpdateLevel( *it, outputSO ); ++it; } @@ -87,7 +88,7 @@ PointBasedSpatialObjectTransformFilter< TTransformType, TDimension > ::UpdateLevel( const SpatialObject< TDimension > * inputSO, SpatialObject< TDimension > * parentSO ) { - SpatialObject::Pointer outputSO = inputSO->Clone(); + typename SpatialObject::Pointer outputSO = inputSO->Clone(); Transform(inputSO, outputSO); diff --git a/src/Registration/itktubeSpatialObjectToImageMetric.h b/src/Registration/itktubeSpatialObjectToImageMetric.h index a7d7b5f8d..0523d3844 100644 --- a/src/Registration/itktubeSpatialObjectToImageMetric.h +++ b/src/Registration/itktubeSpatialObjectToImageMetric.h @@ -96,7 +96,7 @@ class ITK_TEMPLATE_EXPORT SpatialObjectToImageMetric : public SingleValuedCostFu /** Type of the Transform Base class */ using TransformType = Transform; + ObjectDimension, ImageDimension>; using TransformPointer = typename TransformType::Pointer; using MovingPointType = typename TransformType::InputPointType; @@ -104,7 +104,7 @@ class ITK_TEMPLATE_EXPORT SpatialObjectToImageMetric : public SingleValuedCostFu using TransformParametersType = typename TransformType::ParametersType; using TransformJacobianType = typename TransformType::JacobianType; - using MovingVectorType = vnl_vector_fixed; + using MovingVectorType = vnl_vector_fixed; using FixedVectorType = vnl_vector_fixed; /** Type of the match measure */ diff --git a/src/Registration/itktubeSpatialObjectToImageRegistrationMethod.h b/src/Registration/itktubeSpatialObjectToImageRegistrationMethod.h index bdc4305d7..1a127ad9c 100644 --- a/src/Registration/itktubeSpatialObjectToImageRegistrationMethod.h +++ b/src/Registration/itktubeSpatialObjectToImageRegistrationMethod.h @@ -25,7 +25,7 @@ limitations under the License. #include "itkCommand.h" #include "itkSpatialObject.h" -#include "itkDataobjectDecorator.h" +#include "itkDataObjectDecorator.h" namespace itk { diff --git a/src/Registration/itktubeSpatialObjectToImageRegistrationMethod.hxx b/src/Registration/itktubeSpatialObjectToImageRegistrationMethod.hxx index fa1270741..e3a9a4ef4 100644 --- a/src/Registration/itktubeSpatialObjectToImageRegistrationMethod.hxx +++ b/src/Registration/itktubeSpatialObjectToImageRegistrationMethod.hxx @@ -45,7 +45,7 @@ SpatialObjectToImageRegistrationMethod this->ProcessObject::SetNthOutput( 0, transformDecorator.GetPointer() ); this->m_RegistrationNumberOfWorkUnits = this->GetNumberOfWorkUnits(); - this->GetMultiThreader()->SetNumberOfWorkUnits( this->m_RegistrationNumberOfWorkUnits ); + this->SetNumberOfWorkUnits( this->m_RegistrationNumberOfWorkUnits ); this->m_FixedImage = 0; this->m_MovingSpatialObject = 0; diff --git a/src/Segmentation/itktubeRadiusExtractor3.hxx b/src/Segmentation/itktubeRadiusExtractor3.hxx index b2cca5fa4..6f15ebb12 100644 --- a/src/Segmentation/itktubeRadiusExtractor3.hxx +++ b/src/Segmentation/itktubeRadiusExtractor3.hxx @@ -103,7 +103,7 @@ public: d[3] /= m_Data->size(); } - unsigned int GetNumberOfParameters(void) const + unsigned int GetNumberOfParameters(void) const override { return 4; } diff --git a/src/Segmentation/itktubeRidgeExtractor.hxx b/src/Segmentation/itktubeRidgeExtractor.hxx index 832750640..8b0aab23f 100644 --- a/src/Segmentation/itktubeRidgeExtractor.hxx +++ b/src/Segmentation/itktubeRidgeExtractor.hxx @@ -156,7 +156,7 @@ RidgeExtractor m_FailureCodeCount.fill( 0 ); m_Tube = nullptr; - m_TubeMaskImage == nullptr; + m_TubeMaskImage = nullptr; } /**