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 This file is part of the elastix software.
4 
5 Copyright (c) University Medical Center Utrecht. All rights reserved.
6 See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7 details.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 #ifndef __itkBSplineInterpolationWeightFunctionBase_h
15 #define __itkBSplineInterpolationWeightFunctionBase_h
16 
17 #include "itkFunctionBase.h"
18 #include "itkContinuousIndex.h"
19 #include "itkArray.h"
20 #include "itkArray2D.h"
21 #include "itkMatrix.h"
23 #include "itkBSplineDerivativeKernelFunction.h"
25 
26 namespace itk
27 {
28 
30 template< unsigned int SplineOrder, unsigned int Dimension >
31 class GetConstNumberOfWeightsHack
32 {
33 public:
34 
35  typedef GetConstNumberOfWeightsHack< SplineOrder, Dimension - 1 > OneDimensionLess;
36  itkStaticConstMacro( Value, unsigned long, ( SplineOrder + 1 ) * OneDimensionLess::Value );
37 };
38 
40 template< unsigned int SplineOrder >
41 class GetConstNumberOfWeightsHack< SplineOrder, 0 >
42 {
43 public:
44 
45  itkStaticConstMacro( Value, unsigned long, 1 );
46 };
47 
64 template< class TCoordRep = float,
65 unsigned int VSpaceDimension = 2,
66 unsigned int VSplineOrder = 3 >
68  public FunctionBase< ContinuousIndex< TCoordRep, VSpaceDimension >, Array< double > >
69 {
70 public:
71 
74  typedef FunctionBase<
75  ContinuousIndex< TCoordRep, VSpaceDimension >,
76  Array< double > > Superclass;
77  typedef SmartPointer< Self > Pointer;
78  typedef SmartPointer< const Self > ConstPointer;
79 
82 
84  itkStaticConstMacro( SpaceDimension, unsigned int, VSpaceDimension );
85 
87  itkStaticConstMacro( SplineOrder, unsigned int, VSplineOrder );
88 
90  typedef GetConstNumberOfWeightsHack<
91  itkGetStaticConstMacro( SplineOrder ),
92  itkGetStaticConstMacro( SpaceDimension ) > GetConstNumberOfWeightsHackType;
93  itkStaticConstMacro( NumberOfWeights, unsigned long, GetConstNumberOfWeightsHackType::Value );
94 
96  typedef Array< double > WeightsType;
97 
99  typedef Index< VSpaceDimension > IndexType;
100  typedef Size< VSpaceDimension > SizeType;
101 
103  typedef ContinuousIndex< TCoordRep, VSpaceDimension > ContinuousIndexType;
104 
106  virtual WeightsType Evaluate( const ContinuousIndexType & index ) const;
107 
115  virtual void Evaluate( const ContinuousIndexType & cindex,
116  const IndexType & startIndex, WeightsType & weights ) const;
117 
119  void ComputeStartIndex( const ContinuousIndexType & index,
120  IndexType & startIndex ) const;
121 
123  itkGetConstReferenceMacro( SupportSize, SizeType );
124 
126  itkGetConstMacro( NumberOfWeights, unsigned long );
127 
128 protected:
129 
132 
136  typedef BSplineDerivativeKernelFunction< Self::SplineOrder > DerivativeKernelType;
137  typedef typename DerivativeKernelType::Pointer DerivativeKernelPointer;
141 
143  typedef Array2D< unsigned long > TableType;
144 
149  typedef Matrix< double,
150  itkGetStaticConstMacro( SpaceDimension ),
151  itkGetStaticConstMacro( SplineOrder ) + 1 > OneDWeightsType;
152 
154  virtual void Compute1DWeights(
155  const ContinuousIndexType & index,
156  const IndexType & startIndex,
157  OneDWeightsType & weights1D ) const = 0;
158 
160  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
161 
163  unsigned long m_NumberOfWeights;
166 
169  typename DerivativeKernelType::Pointer m_DerivativeKernel;
171 
172 private:
173 
174  BSplineInterpolationWeightFunctionBase( const Self & ); // purposely not implemented
175  void operator=( const Self & ); // purposely not implemented
176 
178  void InitializeSupport( void );
179 
184  void InitializeOffsetToIndexTable( void );
185 
186 };
187 
188 } // end namespace itk
189 
190 #ifndef ITK_MANUAL_INSTANTIATION
191 #include "itkBSplineInterpolationWeightFunctionBase.hxx"
192 #endif
193 
194 #endif
Matrix< double, itkGetStaticConstMacro(SpaceDimension), itkGetStaticConstMacro(SplineOrder)+1 > OneDWeightsType
SecondOrderDerivativeKernelType::Pointer SecondOrderDerivativeKernelPointer
ContinuousIndex< TCoordRep, VSpaceDimension > ContinuousIndexType
virtual WeightsType Evaluate(const ContinuousIndexType &index) const
BSplineSecondOrderDerivativeKernelFunction2< Self::SplineOrder > SecondOrderDerivativeKernelType
BSplineDerivativeKernelFunction< Self::SplineOrder > DerivativeKernelType
SecondOrderDerivativeKernelType::Pointer m_SecondOrderDerivativeKernel
void ComputeStartIndex(const ContinuousIndexType &index, IndexType &startIndex) const
itkStaticConstMacro(SpaceDimension, unsigned int, VSpaceDimension)
virtual void PrintSelf(std::ostream &os, Indent indent) const
FunctionBase< ContinuousIndex< TCoordRep, VSpaceDimension >, Array< double > > Superclass
FixedArray< double, itkGetStaticConstMacro(SplineOrder)+1 > WeightArrayType
B-spline kernel used for density estimation and nonparameteric regression.
virtual void Compute1DWeights(const ContinuousIndexType &index, const IndexType &startIndex, OneDWeightsType &weights1D) const =0
Returns the weights over the support region used for B-spline interpolation/reconstruction.
Derivative of a B-spline kernel used for density estimation and nonparametric regression.


Generated on 11-03-2014 for elastix by doxygen 1.8.6 elastix logo