go home Home | Main Page | Modules | 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 "itkArray.h"
24#include "itkArray2D.h"
25#include "itkMatrix.h"
27#include "itkBSplineDerivativeKernelFunction.h"
29
30namespace itk
31{
32
34template< unsigned int SplineOrder, unsigned int Dimension >
35class GetConstNumberOfWeightsHack
36{
37public:
38
39 typedef GetConstNumberOfWeightsHack< SplineOrder, Dimension - 1 > OneDimensionLess;
40 itkStaticConstMacro( Value, unsigned long, ( SplineOrder + 1 ) * OneDimensionLess::Value );
41};
42
44template< unsigned int SplineOrder >
45class GetConstNumberOfWeightsHack< SplineOrder, 0 >
46{
47public:
48
49 itkStaticConstMacro( Value, unsigned long, 1 );
50};
51
68template< class TCoordRep = float,
69unsigned int VSpaceDimension = 2,
70unsigned int VSplineOrder = 3 >
72 public FunctionBase< ContinuousIndex< TCoordRep, VSpaceDimension >, Array< double > >
73{
74public:
75
78 typedef FunctionBase<
79 ContinuousIndex< TCoordRep, VSpaceDimension >,
80 Array< double > > Superclass;
82 typedef SmartPointer< const Self > ConstPointer;
83
85 itkTypeMacro( BSplineInterpolationWeightFunctionBase, FunctionBase );
86
88 itkStaticConstMacro( SpaceDimension, unsigned int, VSpaceDimension );
89
91 itkStaticConstMacro( SplineOrder, unsigned int, VSplineOrder );
92
94 typedef GetConstNumberOfWeightsHack<
95 itkGetStaticConstMacro( SplineOrder ),
96 itkGetStaticConstMacro( SpaceDimension ) > GetConstNumberOfWeightsHackType;
97 itkStaticConstMacro( NumberOfWeights, unsigned long, GetConstNumberOfWeightsHackType::Value );
98
100 typedef Array< double > WeightsType;
101
103 typedef Index< VSpaceDimension > IndexType;
105
107 typedef ContinuousIndex< TCoordRep, VSpaceDimension > ContinuousIndexType;
108
110 WeightsType Evaluate( const ContinuousIndexType & index ) const override;
111
119 virtual void Evaluate( const ContinuousIndexType & cindex,
120 const IndexType & startIndex, WeightsType & weights ) const;
121
124 IndexType & startIndex ) const;
125
127 itkGetConstReferenceMacro( SupportSize, SizeType );
128
130 itkGetConstMacro( NumberOfWeights, unsigned long );
131
132protected:
133
136
140 typedef BSplineDerivativeKernelFunction< Self::SplineOrder > DerivativeKernelType;
141 typedef typename DerivativeKernelType::Pointer DerivativeKernelPointer;
145
148
153 typedef Matrix< double,
154 itkGetStaticConstMacro( SpaceDimension ),
155 itkGetStaticConstMacro( SplineOrder ) + 1 > OneDWeightsType;
156
158 virtual void Compute1DWeights(
159 const ContinuousIndexType & index,
160 const IndexType & startIndex,
161 OneDWeightsType & weights1D ) const = 0;
162
164 void PrintSelf( std::ostream & os, Indent indent ) const override;
165
167 unsigned long m_NumberOfWeights;
170
173 typename DerivativeKernelType::Pointer m_DerivativeKernel;
175
176private:
177
178 BSplineInterpolationWeightFunctionBase( const Self & ); // purposely not implemented
179 void operator=( const Self & ); // purposely not implemented
180
182 void InitializeSupport( void );
183
189
190};
191
192} // end namespace itk
193
194#ifndef ITK_MANUAL_INSTANTIATION
195#include "itkBSplineInterpolationWeightFunctionBase.hxx"
196#endif
197
198#endif
Returns the weights over the support region used for B-spline interpolation/reconstruction.
SecondOrderDerivativeKernelType::Pointer SecondOrderDerivativeKernelPointer
virtual void Evaluate(const ContinuousIndexType &cindex, const IndexType &startIndex, WeightsType &weights) const
itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder)
WeightsType Evaluate(const ContinuousIndexType &index) const override
ContinuousIndex< TCoordRep, VSpaceDimension > ContinuousIndexType
BSplineSecondOrderDerivativeKernelFunction2< Self::SplineOrder > SecondOrderDerivativeKernelType
virtual void Compute1DWeights(const ContinuousIndexType &index, const IndexType &startIndex, OneDWeightsType &weights1D) const =0
itkStaticConstMacro(SpaceDimension, unsigned int, VSpaceDimension)
void PrintSelf(std::ostream &os, Indent indent) const override
itkStaticConstMacro(NumberOfWeights, unsigned long, GetConstNumberOfWeightsHackType::Value)
Matrix< double, itkGetStaticConstMacro(SpaceDimension), itkGetStaticConstMacro(SplineOrder)+1 > OneDWeightsType
SecondOrderDerivativeKernelType::Pointer m_SecondOrderDerivativeKernel
void ComputeStartIndex(const ContinuousIndexType &index, IndexType &startIndex) const
BSplineDerivativeKernelFunction< Self::SplineOrder > DerivativeKernelType
FunctionBase< ContinuousIndex< TCoordRep, VSpaceDimension >, Array< double > > Superclass
B-spline kernel used for density estimation and nonparameteric regression.
FixedArray< double, itkGetStaticConstMacro(SplineOrder)+1 > WeightArrayType
Derivative of a B-spline kernel used for density estimation and nonparametric regression.


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo