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 
27 namespace itk
28 {
29 
31  template <unsigned int SplineOrder, unsigned int Dimension>
32  class GetConstNumberOfWeightsHack
33  {
34  public:
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  itkStaticConstMacro( Value, unsigned long, 1 );
45  };
46 
63 template < class TCoordRep = float,
64  unsigned int VSpaceDimension = 2,
65  unsigned int VSplineOrder = 3 >
67 public FunctionBase< ContinuousIndex<TCoordRep,VSpaceDimension>, Array<double> >
68 {
69 public:
72  typedef FunctionBase<
73  ContinuousIndex< TCoordRep, VSpaceDimension >,
74  Array<double> > Superclass;
75  typedef SmartPointer<Self> Pointer;
76  typedef SmartPointer<const Self> ConstPointer;
77 
80 
82  itkStaticConstMacro( SpaceDimension, unsigned int, VSpaceDimension );
83 
85  itkStaticConstMacro( SplineOrder, unsigned int, VSplineOrder );
86 
88  typedef GetConstNumberOfWeightsHack<
89  itkGetStaticConstMacro(SplineOrder),
90  itkGetStaticConstMacro(SpaceDimension) > GetConstNumberOfWeightsHackType;
91  itkStaticConstMacro( NumberOfWeights, unsigned long, GetConstNumberOfWeightsHackType::Value );
92 
94  typedef Array< double > WeightsType;
95 
97  typedef Index<VSpaceDimension> IndexType;
98  typedef Size<VSpaceDimension> SizeType;
99 
101  typedef ContinuousIndex<TCoordRep,VSpaceDimension> ContinuousIndexType;
102 
104  virtual WeightsType Evaluate( const ContinuousIndexType & index ) const;
105 
113  virtual void Evaluate( const ContinuousIndexType & cindex,
114  const IndexType & startIndex, WeightsType & weights ) const;
115 
117  void ComputeStartIndex( const ContinuousIndexType & index,
118  IndexType & startIndex ) const;
119 
121  itkGetConstReferenceMacro( SupportSize, SizeType );
122 
124  itkGetConstMacro( NumberOfWeights, unsigned long );
125 
126 protected:
129 
131  typedef BSplineKernelFunction2<
132  itkGetStaticConstMacro( SplineOrder ) > KernelType;
133  typedef BSplineDerivativeKernelFunction<
134  itkGetStaticConstMacro( SplineOrder ) > DerivativeKernelType;
136  itkGetStaticConstMacro( SplineOrder ) > SecondOrderDerivativeKernelType;
138 
140  typedef Array2D<unsigned long> TableType;
141 
146  typedef Matrix< double,
147  itkGetStaticConstMacro( SpaceDimension ),
148  itkGetStaticConstMacro( SplineOrder ) + 1 > OneDWeightsType;
149 
151  virtual void Compute1DWeights(
152  const ContinuousIndexType & index,
153  const IndexType & startIndex,
154  OneDWeightsType & weights1D ) const = 0;
155 
157  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
158 
160  unsigned long m_NumberOfWeights;
163 
166  typename DerivativeKernelType::Pointer m_DerivativeKernel;
168 
169 private:
170 
171  BSplineInterpolationWeightFunctionBase(const Self&); //purposely not implemented
172  void operator=(const Self&); //purposely not implemented
173 
175  void InitializeSupport( void );
176 
181  void InitializeOffsetToIndexTable( void );
182 
183 };
184 
185 } // end namespace itk
186 
187 // Define instantiation macro for this template.
188 #define ITK_TEMPLATE_BSplineInterpolationWeightFunctionBase(_, EXPORT, x, y) namespace itk { \
189  _(3(class EXPORT BSplineInterpolationWeightFunctionBase< ITK_TEMPLATE_3 x >)) \
190  namespace Templates { typedef BSplineInterpolationWeightFunctionBase< ITK_TEMPLATE_3 x > BSplineInterpolationWeightFunctionBase##y; } \
191  }
192 
193 #if ITK_TEMPLATE_EXPLICIT
194 # include "Templates/itkBSplineInterpolationWeightFunctionBase+-.h"
195 #endif
196 
197 #if ITK_TEMPLATE_TXX
198 # include "itkBSplineInterpolationWeightFunctionBase.txx"
199 #endif
200 
201 
202 #endif
Matrix< double, itkGetStaticConstMacro(SpaceDimension), itkGetStaticConstMacro(SplineOrder)+1 > OneDWeightsType
BSplineDerivativeKernelFunction< itkGetStaticConstMacro(SplineOrder) > DerivativeKernelType
FunctionBase< ContinuousIndex< TCoordRep, VSpaceDimension >, Array< double > > Superclass
SecondOrderDerivativeKernelType::Pointer m_SecondOrderDerivativeKernel
FixedArray< double, itkGetStaticConstMacro(SplineOrder)+1 > WeightArrayType
B-spline kernel used for density estimation and nonparameteric regression.
ContinuousIndex< TCoordRep, VSpaceDimension > ContinuousIndexType
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.
BSplineSecondOrderDerivativeKernelFunction2< itkGetStaticConstMacro(SplineOrder) > SecondOrderDerivativeKernelType


Generated on 05-01-2014 for elastix by doxygen 1.8.5 elastix logo