diff --git a/.github/workflows/ElastixGitHubActions.yml b/.github/workflows/ElastixGitHubActions.yml index 0d3436b70..730d9de06 100644 --- a/.github/workflows/ElastixGitHubActions.yml +++ b/.github/workflows/ElastixGitHubActions.yml @@ -18,21 +18,21 @@ jobs: - os: ubuntu-18.04 c-compiler: "gcc" cxx-compiler: "g++" - itk-git-tag: "v5.2.0" + itk-git-tag: "v5.3rc02" cmake-build-type: "Release" ANNLib: "libANNlib-5.0.so" ANNLib2: "libANNlib-5.0.so.1" - os: windows-2019 c-compiler: "cl.exe" cxx-compiler: "cl.exe" - itk-git-tag: "v5.2.0" + itk-git-tag: "v5.3rc02" cmake-build-type: "Release" ANNLib: "ANNlib-5.0.dll" vcvars64: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" - os: macos-10.15 c-compiler: "clang" cxx-compiler: "clang++" - itk-git-tag: "v5.2.0" + itk-git-tag: "v5.3rc02" cmake-build-type: "Release" ANNLib: "libANNlib-5.0.1.dylib" ANNLib2: "libANNlib-5.0.dylib" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ffc80c6a..aa769705a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ if(ELASTIX_USE_OPENCL) endif() # Find ITK. -find_package( ITK 5.2.0 REQUIRED COMPONENTS +find_package( ITK 5.3 REQUIRED COMPONENTS ITKCommon ITKDisplacementField ITKDistanceMap diff --git a/Common/Transforms/itkAdvancedBSplineDeformableTransform.hxx b/Common/Transforms/itkAdvancedBSplineDeformableTransform.hxx index 2b04d1eef..2663050f7 100644 --- a/Common/Transforms/itkAdvancedBSplineDeformableTransform.hxx +++ b/Common/Transforms/itkAdvancedBSplineDeformableTransform.hxx @@ -292,9 +292,8 @@ AdvancedBSplineDeformableTransform::Tran { /** Allocate memory on the stack: */ const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray[numberOfWeights]; typename ParameterIndexArrayType::ValueType indicesArray[numberOfWeights]; - WeightsType weights(weightsArray, numberOfWeights, false); + WeightsType weights; ParameterIndexArrayType indices(indicesArray, numberOfWeights, false); OutputPointType outputPoint; @@ -380,9 +379,8 @@ AdvancedBSplineDeformableTransform::GetJ /** Compute the number of affected B-spline parameters. * Allocate memory on the stack. */ - const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray[numberOfWeights]; - WeightsType weights(weightsArray, numberOfWeights, false); + const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; + WeightsType weights; /** Compute the weights. */ IndexType supportIndex; @@ -447,9 +445,7 @@ AdvancedBSplineDeformableTransform::Eval /** Compute the number of affected B-spline parameters. * Allocate memory on the stack. */ - const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray[numberOfWeights]; - WeightsType weights(weightsArray, numberOfWeights, false); + WeightsType weights; /** Compute the B-spline derivative weights. */ IndexType supportIndex; @@ -505,9 +501,8 @@ AdvancedBSplineDeformableTransform::GetS /** Compute the number of affected B-spline parameters. */ /** Allocate memory on the stack: */ - const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray[numberOfWeights]; - WeightsType weights(weightsArray, numberOfWeights, false); + const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; + WeightsType weights; /** Array for CoefficientImage values */ std::array coeffs; @@ -610,8 +605,7 @@ AdvancedBSplineDeformableTransform::GetS /** Helper variables. */ /** Allocate memory on the stack: */ const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; - WeightsValueType weightsArray[numberOfWeights]; - WeightsType weights(weightsArray, numberOfWeights, false); + WeightsType weights; /** Array for CoefficientImage values */ std::array coeffs; @@ -734,9 +728,8 @@ AdvancedBSplineDeformableTransform::GetJ /** Helper variables. */ /** Allocate memory on the stack: */ - const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray[numberOfWeights]; - WeightsType weights(weightsArray, numberOfWeights, false); + const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; + WeightsType weights; IndexType supportIndex; this->m_DerivativeWeightsFunctions[0]->ComputeStartIndex(cindex, supportIndex); @@ -839,8 +832,7 @@ AdvancedBSplineDeformableTransform::GetJ /** Allocate weight on the stack. */ typedef typename WeightsType::ValueType WeightsValueType; const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; - WeightsValueType weightsArray[numberOfWeights]; - WeightsType weights(weightsArray, numberOfWeights, false); + WeightsType weights; /** Allocate coefficients on the stack. */ std::array coeffs; @@ -991,9 +983,8 @@ AdvancedBSplineDeformableTransform::GetJ /** Compute the number of affected B-spline parameters. */ /** Allocate memory on the stack: */ - const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray[numberOfWeights]; - WeightsType weights(weightsArray, numberOfWeights, false); + const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; + WeightsType weights; IndexType supportIndex; this->m_SODerivativeWeightsFunctions[0][0]->ComputeStartIndex(cindex, supportIndex); @@ -1117,8 +1108,7 @@ AdvancedBSplineDeformableTransform::GetJ /** Allocate weight on the stack. */ typedef typename WeightsType::ValueType WeightsValueType; const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights; - WeightsValueType weightsArray[numberOfWeights]; - WeightsType weights(weightsArray, numberOfWeights, false); + WeightsType weights; /** Allocate coefficients on the stack. */ std::array coeffs; diff --git a/Common/Transforms/itkBSplineInterpolationWeightFunctionBase.h b/Common/Transforms/itkBSplineInterpolationWeightFunctionBase.h index 985b4e874..f0f419cbb 100644 --- a/Common/Transforms/itkBSplineInterpolationWeightFunctionBase.h +++ b/Common/Transforms/itkBSplineInterpolationWeightFunctionBase.h @@ -48,14 +48,17 @@ namespace itk */ template class ITK_TEMPLATE_EXPORT BSplineInterpolationWeightFunctionBase - : public FunctionBase, Array> + : public FunctionBase, + FixedArray> { public: /** Standard class typedefs. */ - typedef BSplineInterpolationWeightFunctionBase Self; - typedef FunctionBase, Array> Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; + typedef BSplineInterpolationWeightFunctionBase Self; + typedef FunctionBase, + FixedArray> + Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; /** Run-time type information (and related methods). */ itkTypeMacro(BSplineInterpolationWeightFunctionBase, FunctionBase); @@ -70,7 +73,7 @@ class ITK_TEMPLATE_EXPORT BSplineInterpolationWeightFunctionBase static constexpr unsigned long NumberOfWeights = Math::UnsignedPower(VSplineOrder + 1, VSpaceDimension); /** OutputType typedef support. */ - typedef Array WeightsType; + typedef FixedArray WeightsType; /** Index and size typedef support. */ typedef Index IndexType; diff --git a/Common/Transforms/itkCyclicBSplineDeformableTransform.hxx b/Common/Transforms/itkCyclicBSplineDeformableTransform.hxx index 4cb76cfbc..18a16366e 100644 --- a/Common/Transforms/itkCyclicBSplineDeformableTransform.hxx +++ b/Common/Transforms/itkCyclicBSplineDeformableTransform.hxx @@ -317,9 +317,7 @@ CyclicBSplineDeformableTransform::GetSpa /** Compute the number of affected B-spline parameters. */ /** Allocate memory on the stack: */ - const SizeValueType numberOfWeights = WeightsFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray[numberOfWeights]; - WeightsType weights(weightsArray, numberOfWeights, false); + WeightsType weights; IndexType supportIndex; this->m_DerivativeWeightsFunctions[0]->ComputeStartIndex(cindex, supportIndex); diff --git a/Common/Transforms/itkRecursiveBSplineTransform.hxx b/Common/Transforms/itkRecursiveBSplineTransform.hxx index dd4457035..40a35b906 100644 --- a/Common/Transforms/itkRecursiveBSplineTransform.hxx +++ b/Common/Transforms/itkRecursiveBSplineTransform.hxx @@ -50,15 +50,11 @@ auto RecursiveBSplineTransform::TransformPoint(const InputPointType & point) const -> OutputPointType { - /** Define some constants. */ - const unsigned int numberOfWeights = RecursiveBSplineWeightFunctionType::NumberOfWeights; - /** Initialize output point. */ OutputPointType outputPoint; /** Allocate weights on the stack: */ - typename WeightsType::ValueType weightsArray1D[numberOfWeights]; - WeightsType weights1D(weightsArray1D, numberOfWeights, false); + WeightsType weights1D; /** Check if the coefficient image has been set. */ if (!this->m_CoefficientImages[0]) @@ -156,10 +152,8 @@ RecursiveBSplineTransform::GetJacobian( * In contrast to the normal B-spline weights function, the recursive version * returns the individual weights instead of the multiplied ones. */ - const unsigned int numberOfWeights = RecursiveBSplineWeightFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray1D[numberOfWeights]; - WeightsType weights1D(weightsArray1D, numberOfWeights, false); - IndexType supportIndex; + WeightsType weights1D; + IndexType supportIndex; this->m_RecursiveBSplineWeightFunction->Evaluate(cindex, weights1D, supportIndex); /** Recursively compute the first numberOfIndices entries of the Jacobian. @@ -215,10 +209,8 @@ RecursiveBSplineTransform::EvaluateJacobianW * In contrast to the normal B-spline weights function, the recursive version * returns the individual weights instead of the multiplied ones. */ - const unsigned int numberOfWeights = RecursiveBSplineWeightFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray1D[numberOfWeights]; - WeightsType weights1D(weightsArray1D, numberOfWeights, false); - IndexType supportIndex; + WeightsType weights1D; + IndexType supportIndex; this->m_RecursiveBSplineWeightFunction->Evaluate(cindex, weights1D, supportIndex); /** Recursively compute the inner product of the Jacobian and the moving image gradient. @@ -269,11 +261,8 @@ RecursiveBSplineTransform::GetSpatialJacobia } /** Create storage for the B-spline interpolation weights. */ - const unsigned int numberOfWeights = RecursiveBSplineWeightFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray1D[numberOfWeights]; - WeightsType weights1D(weightsArray1D, numberOfWeights, false); - typename WeightsType::ValueType derivativeWeightsArray1D[numberOfWeights]; - WeightsType derivativeWeights1D(derivativeWeightsArray1D, numberOfWeights, false); + WeightsType weights1D; + WeightsType derivativeWeights1D; double * weightsPointer = &(weights1D[0]); double * derivativeWeightsPointer = &(derivativeWeights1D[0]); @@ -357,13 +346,9 @@ RecursiveBSplineTransform::GetSpatialHessian } /** Create storage for the B-spline interpolation weights. */ - const unsigned int numberOfWeights = RecursiveBSplineWeightFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray1D[numberOfWeights]; - WeightsType weights1D(weightsArray1D, numberOfWeights, false); - typename WeightsType::ValueType derivativeWeightsArray1D[numberOfWeights]; - WeightsType derivativeWeights1D(derivativeWeightsArray1D, numberOfWeights, false); - typename WeightsType::ValueType hessianWeightsArray1D[numberOfWeights]; - WeightsType hessianWeights1D(hessianWeightsArray1D, numberOfWeights, false); + WeightsType weights1D; + WeightsType derivativeWeights1D; + WeightsType hessianWeights1D; double * weightsPointer = &(weights1D[0]); double * derivativeWeightsPointer = &(derivativeWeights1D[0]); @@ -477,11 +462,8 @@ RecursiveBSplineTransform::GetJacobianOfSpat } /** Create storage for the B-spline interpolation weights. */ - const unsigned int numberOfWeights = RecursiveBSplineWeightFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray1D[numberOfWeights]; - WeightsType weights1D(weightsArray1D, numberOfWeights, false); - typename WeightsType::ValueType derivativeWeightsArray1D[numberOfWeights]; - WeightsType derivativeWeights1D(derivativeWeightsArray1D, numberOfWeights, false); + WeightsType weights1D; + WeightsType derivativeWeights1D; double * weightsPointer = &(weights1D[0]); double * derivativeWeightsPointer = &(derivativeWeights1D[0]); @@ -577,13 +559,9 @@ RecursiveBSplineTransform::GetJacobianOfSpat } /** Create storage for the B-spline interpolation weights. */ - const unsigned int numberOfWeights = RecursiveBSplineWeightFunctionType::NumberOfWeights; - typename WeightsType::ValueType weightsArray1D[numberOfWeights]; - WeightsType weights1D(weightsArray1D, numberOfWeights, false); - typename WeightsType::ValueType derivativeWeightsArray1D[numberOfWeights]; - WeightsType derivativeWeights1D(derivativeWeightsArray1D, numberOfWeights, false); - typename WeightsType::ValueType hessianWeightsArray1D[numberOfWeights]; - WeightsType hessianWeights1D(hessianWeightsArray1D, numberOfWeights, false); + WeightsType weights1D; + WeightsType derivativeWeights1D; + WeightsType hessianWeights1D; double * weightsPointer = &(weights1D[0]); double * derivativeWeightsPointer = &(derivativeWeights1D[0]); diff --git a/Testing/CI/Azure/ci.yml b/Testing/CI/Azure/ci.yml index 61b0d8631..576b14e2d 100644 --- a/Testing/CI/Azure/ci.yml +++ b/Testing/CI/Azure/ci.yml @@ -1,5 +1,5 @@ variables: - ITKv5_VERSION: v5.2.0 + ITKv5_VERSION: v5.3rc02 ITK_GIT_URL: https://github.com/InsightSoftwareConsortium/ITK ITK_SOURCE_DIR: $(Agent.BuildDirectory)/ITK-source ITK_BINARY_DIR: $(Agent.BuildDirectory)/ITK-build diff --git a/Testing/itkBSplineTransformPointPerformanceTest.cxx b/Testing/itkBSplineTransformPointPerformanceTest.cxx index f7f9740cf..aff4617bb 100644 --- a/Testing/itkBSplineTransformPointPerformanceTest.cxx +++ b/Testing/itkBSplineTransformPointPerformanceTest.cxx @@ -61,9 +61,8 @@ class BSplineTransform_TEST : public AdvancedBSplineDeformableTransform