Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ElastixGitHubActions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.3rc03"
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.3rc03"
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.3rc03"
cmake-build-type: "Release"
ANNLib: "libANNlib-5.0.1.dylib"
ANNLib2: "libANNlib-5.0.dylib"
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 14 additions & 23 deletions Common/Transforms/itkAdvancedBSplineDeformableTransform.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ AdvancedBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::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;
Expand Down Expand Up @@ -352,9 +351,8 @@ AdvancedBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::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;
Expand Down Expand Up @@ -418,9 +416,8 @@ AdvancedBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::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);
const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights;
WeightsType weights;

/** Compute the B-spline derivative weights. */
IndexType supportIndex;
Expand Down Expand Up @@ -475,9 +472,8 @@ AdvancedBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::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<typename WeightsType::ValueType, numberOfWeights * SpaceDimension> coeffs;
Expand Down Expand Up @@ -579,8 +575,7 @@ AdvancedBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::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<WeightsValueType, numberOfWeights * SpaceDimension> coeffs;
Expand Down Expand Up @@ -702,9 +697,8 @@ AdvancedBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::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);
Expand Down Expand Up @@ -806,8 +800,7 @@ AdvancedBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::GetJ
/** Allocate weight on the stack. */
using WeightsValueType = typename WeightsType::ValueType;
const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights;
WeightsValueType weightsArray[numberOfWeights];
WeightsType weights(weightsArray, numberOfWeights, false);
WeightsType weights;

/** Allocate coefficients on the stack. */
std::array<WeightsValueType, numberOfWeights * SpaceDimension> coeffs;
Expand Down Expand Up @@ -957,9 +950,8 @@ AdvancedBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::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);
Expand Down Expand Up @@ -1082,8 +1074,7 @@ AdvancedBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::GetJ
/** Allocate weight on the stack. */
using WeightsValueType = typename WeightsType::ValueType;
const unsigned long numberOfWeights = WeightsFunctionType::NumberOfWeights;
WeightsValueType weightsArray[numberOfWeights];
WeightsType weights(weightsArray, numberOfWeights, false);
WeightsType weights;

/** Allocate coefficients on the stack. */
std::array<WeightsValueType, numberOfWeights * SpaceDimension> coeffs;
Expand Down
8 changes: 5 additions & 3 deletions Common/Transforms/itkBSplineInterpolationWeightFunctionBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ namespace itk
*/
template <class TCoordRep = float, unsigned int VSpaceDimension = 2, unsigned int VSplineOrder = 3>
class ITK_TEMPLATE_EXPORT BSplineInterpolationWeightFunctionBase
: public FunctionBase<ContinuousIndex<TCoordRep, VSpaceDimension>, Array<double>>
: public FunctionBase<ContinuousIndex<TCoordRep, VSpaceDimension>,
FixedArray<double, Math::UnsignedPower(VSplineOrder + 1, VSpaceDimension)>>
{
public:
/** Standard class typedefs. */
using Self = BSplineInterpolationWeightFunctionBase;
using Superclass = FunctionBase<ContinuousIndex<TCoordRep, VSpaceDimension>, Array<double>>;
using Superclass = FunctionBase<ContinuousIndex<TCoordRep, VSpaceDimension>,
FixedArray<double, Math::UnsignedPower(VSplineOrder + 1, VSpaceDimension)>>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

Expand All @@ -70,7 +72,7 @@ class ITK_TEMPLATE_EXPORT BSplineInterpolationWeightFunctionBase
static constexpr unsigned long NumberOfWeights = Math::UnsignedPower(VSplineOrder + 1, VSpaceDimension);

/** OutputType typedef support. */
using WeightsType = Array<double>;
using WeightsType = FixedArray<double, NumberOfWeights>;

/** Index and size typedef support. */
using IndexType = Index<VSpaceDimension>;
Expand Down
7 changes: 2 additions & 5 deletions Common/Transforms/itkCyclicBSplineDeformableTransform.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@ CyclicBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::Transf
{
/** 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;
Expand Down Expand Up @@ -319,9 +318,7 @@ CyclicBSplineDeformableTransform<TScalarType, NDimensions, VSplineOrder>::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);
Expand Down
52 changes: 15 additions & 37 deletions Common/Transforms/itkRecursiveBSplineTransform.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,11 @@ auto
RecursiveBSplineTransform<TScalar, NDimensions, VSplineOrder>::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])
Expand Down Expand Up @@ -151,10 +147,8 @@ RecursiveBSplineTransform<TScalar, NDimensions, VSplineOrder>::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.
Expand Down Expand Up @@ -209,10 +203,8 @@ RecursiveBSplineTransform<TScalar, NDimensions, VSplineOrder>::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.
Expand Down Expand Up @@ -262,11 +254,8 @@ RecursiveBSplineTransform<TScalar, NDimensions, VSplineOrder>::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]);
Expand Down Expand Up @@ -349,13 +338,9 @@ RecursiveBSplineTransform<TScalar, NDimensions, VSplineOrder>::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]);
Expand Down Expand Up @@ -468,11 +453,8 @@ RecursiveBSplineTransform<TScalar, NDimensions, VSplineOrder>::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]);
Expand Down Expand Up @@ -567,13 +549,9 @@ RecursiveBSplineTransform<TScalar, NDimensions, VSplineOrder>::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]);
Expand Down
2 changes: 1 addition & 1 deletion Testing/CI/Azure/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variables:
ITKv5_VERSION: v5.2.0
ITKv5_VERSION: v5.3rc03
ITK_GIT_URL: https://github.com/InsightSoftwareConsortium/ITK
ITK_SOURCE_DIR: $(Agent.BuildDirectory)/ITK-source
ITK_BINARY_DIR: $(Agent.BuildDirectory)/ITK-build
Expand Down
3 changes: 1 addition & 2 deletions Testing/itkBSplineTransformPointPerformanceTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ class BSplineTransform_TEST : public AdvancedBSplineDeformableTransform<TScalarT
TransformPoint_OLD(const InputPointType & point) const
{
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;
Expand Down