go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkBSplineInterpolationWeightFunctionBase.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkBSplineInterpolationWeightFunctionBase_h
19#define itkBSplineInterpolationWeightFunctionBase_h
20
21#include "itkFunctionBase.h"
22#include "itkContinuousIndex.h"
23#include "itkIndexRange.h"
24#include "itkMath.h"
25#include "itkMatrix.h"
27#include "itkBSplineDerivativeKernelFunction.h"
29
30namespace itk
31{
48template <typename TCoordinate = float, unsigned int VSpaceDimension = 2, unsigned int VSplineOrder = 3>
50 : public FunctionBase<ContinuousIndex<TCoordinate, VSpaceDimension>,
51 FixedArray<double, Math::UnsignedPower(VSplineOrder + 1, VSpaceDimension)>>
52{
53public:
55
58 using Superclass = FunctionBase<ContinuousIndex<TCoordinate, VSpaceDimension>,
59 FixedArray<double, Math::UnsignedPower(VSplineOrder + 1, VSpaceDimension)>>;
60 using Pointer = SmartPointer<Self>;
61 using ConstPointer = SmartPointer<const Self>;
62
65
67 itkStaticConstMacro(SpaceDimension, unsigned int, VSpaceDimension);
68
70 itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder);
71
73 static constexpr unsigned long NumberOfWeights = Math::UnsignedPower(VSplineOrder + 1, VSpaceDimension);
74
76 using WeightsType = FixedArray<double, NumberOfWeights>;
77
79 using IndexType = Index<VSpaceDimension>;
80 using SizeType = Size<VSpaceDimension>;
81
83 using ContinuousIndexType = ContinuousIndex<TCoordinate, VSpaceDimension>;
84
87 Evaluate(const ContinuousIndexType & index) const override;
88
95 Evaluate(const ContinuousIndexType & cindex, const IndexType & startIndex) const;
96
98 static IndexType
100
102 static constexpr SizeType SupportSize{ SizeType::Filled(VSplineOrder + 1) };
103
104protected:
107
111 using DerivativeKernelType = BSplineDerivativeKernelFunction<VSplineOrder>;
112 using DerivativeKernelPointer = typename DerivativeKernelType::Pointer;
116
121 using OneDWeightsType = Matrix<double, Self::SpaceDimension, VSplineOrder + 1>;
122
124 virtual void
126 const IndexType & startIndex,
127 OneDWeightsType & weights1D) const = 0;
128
130 void
131 PrintSelf(std::ostream & os, Indent indent) const override;
132
133private:
135 using TableType = FixedArray<IndexType, NumberOfWeights>;
136
139 TableType table;
140 std::copy_n(ZeroBasedIndexRange<SpaceDimension>(SupportSize).cbegin(), NumberOfWeights, table.begin());
141 return table;
142 }() };
143};
144
145} // end namespace itk
146
147#ifndef ITK_MANUAL_INSTANTIATION
148# include "itkBSplineInterpolationWeightFunctionBase.hxx"
149#endif
150
151#endif
~BSplineInterpolationWeightFunctionBase() override=default
itkStaticConstMacro(SpaceDimension, unsigned int, VSpaceDimension)
ITK_DISALLOW_COPY_AND_MOVE(BSplineInterpolationWeightFunctionBase)
itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder)
FunctionBase< ContinuousIndex< TScalarType, VSpaceDimension >, FixedArray< double, Math::UnsignedPower(VSplineOrder+1, VSpaceDimension)> > Superclass
static IndexType ComputeStartIndex(const ContinuousIndexType &index)
itkOverrideGetNameOfClassMacro(BSplineInterpolationWeightFunctionBase)
void PrintSelf(std::ostream &os, Indent indent) const override
WeightsType Evaluate(const ContinuousIndexType &cindex, const IndexType &startIndex) const
WeightsType Evaluate(const ContinuousIndexType &index) const override
virtual void Compute1DWeights(const ContinuousIndexType &index, const IndexType &startIndex, OneDWeightsType &weights1D) const =0
B-spline kernel used for density estimation and nonparameteric regression.
FixedArray< double, VSplineOrder+1 > WeightArrayType
Derivative of a B-spline kernel used for density estimation and nonparametric regression.


Generated on 26-02-2026 for elastix by doxygen 1.16.1 (669aeeefca743c148e2d935b3d3c69535c7491e6) elastix logo