ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkBSplineInterpolationWeightFunction.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkBSplineInterpolationWeightFunction_h
00019 #define __itkBSplineInterpolationWeightFunction_h
00020 
00021 #include "itkFunctionBase.h"
00022 #include "itkContinuousIndex.h"
00023 #include "itkBSplineKernelFunction.h"
00024 #include "itkArray.h"
00025 #include "itkArray2D.h"
00026 
00027 namespace itk
00028 {
00046 template<
00047   class TCoordRep = float,
00048   unsigned int VSpaceDimension = 2,
00049   unsigned int VSplineOrder = 3
00050   >
00051 class ITK_EXPORT BSplineInterpolationWeightFunction:
00052   public FunctionBase< ContinuousIndex< TCoordRep, VSpaceDimension >,
00053                        Array< double > >
00054 {
00055 public:
00057   typedef BSplineInterpolationWeightFunction Self;
00058   typedef FunctionBase< ContinuousIndex< TCoordRep, VSpaceDimension >,
00059                         Array< double > >                  Superclass;
00060 
00061   typedef SmartPointer< Self >       Pointer;
00062   typedef SmartPointer< const Self > ConstPointer;
00063 
00065   itkNewMacro(Self);
00066 
00068   itkTypeMacro(BSplineInterpolationWeightFunction, FunctionBase);
00069 
00071   itkStaticConstMacro(SpaceDimension, unsigned int, VSpaceDimension);
00072 
00074   itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder);
00075 
00077   typedef Array< double > WeightsType;
00078 
00080   typedef Index< VSpaceDimension > IndexType;
00081   typedef Size< VSpaceDimension >  SizeType;
00082 
00084   typedef ContinuousIndex< TCoordRep, VSpaceDimension > ContinuousIndexType;
00085 
00088   virtual WeightsType Evaluate(const ContinuousIndexType & index) const;
00089 
00098   virtual void Evaluate(const ContinuousIndexType & index,
00099                         WeightsType & weights, IndexType & startIndex) const;
00100 
00102   itkGetConstMacro(SupportSize, SizeType);
00103 
00105   itkGetConstMacro(NumberOfWeights, unsigned long);
00106 protected:
00107   BSplineInterpolationWeightFunction();
00108   ~BSplineInterpolationWeightFunction() {}
00109   void PrintSelf(std::ostream & os, Indent indent) const;
00111 
00112 private:
00113   BSplineInterpolationWeightFunction(const Self &); //purposely not implemented
00114   void operator=(const Self &);                     //purposely not implemented
00115 
00117   unsigned long m_NumberOfWeights;
00118 
00120   SizeType m_SupportSize;
00121 
00123   typedef Array2D< unsigned long > TableType;
00124 
00126   TableType m_OffsetToIndexTable;
00127 
00129   typedef BSplineKernelFunction< itkGetStaticConstMacro(SplineOrder) > KernelType;
00130 
00132   typename KernelType::Pointer m_Kernel;
00133 };
00134 } // end namespace itk
00135 
00136 // Define instantiation macro for this template.
00137 #define ITK_TEMPLATE_BSplineInterpolationWeightFunction(_, EXPORT, TypeX, TypeY)                                  \
00138   namespace itk                                                                                                   \
00139   {                                                                                                               \
00140   _( 3 ( class EXPORT BSplineInterpolationWeightFunction< ITK_TEMPLATE_3 TypeX > ) )                              \
00141   namespace Templates                                                                                             \
00142   {                                                                                                               \
00143   typedef BSplineInterpolationWeightFunction< ITK_TEMPLATE_3 TypeX > BSplineInterpolationWeightFunction##TypeY; \
00144   }                                                                                                               \
00145   }
00146 
00147 #if ITK_TEMPLATE_EXPLICIT
00148 //template < class TCoordRep, unsigned int VSpaceDimension, unsigned int
00149 // VSplineOrder>
00150 //  const unsigned int itk::BSplineInterpolationWeightFunction< TCoordRep,
00151 // VSpaceDimension, VSplineOrder >::SplineOrder;
00152 #include "Templates/itkBSplineInterpolationWeightFunction+-.h"
00153 #endif
00154 
00155 #if ITK_TEMPLATE_TXX
00156 #include "itkBSplineInterpolationWeightFunction.hxx"
00157 #endif
00158 
00159 #endif
00160