]> Creatis software - clitk.git/blob - itk/clitkGenericInterpolator.h
5762f0eb88b8bb2064a8416469f52d4910ee9872
[clitk.git] / itk / clitkGenericInterpolator.h
1 #ifndef __clitkGenericInterpolator_h
2 #define __clitkGenericInterpolator_h
3 #include "clitkImageCommon.h"
4
5 //itk include
6 #include "itkNearestNeighborInterpolateImageFunction.h"
7 #include "itkLinearInterpolateImageFunction.h"
8 #include "itkBSplineInterpolateImageFunction.h"
9 #include "itkBSplineInterpolateImageFunctionWithLUT.h"
10
11
12 /*
13
14 Requires at least the following section is the .ggo file
15
16 option "interp"         -       "Interpolation: 0=NN, 1=Linear, 2=BSpline, 3=BLUT"      int     no  default="1"
17 option "interpOrder"    -       "Order if BLUT or BSpline (0-5)"                        int     no  default="3"
18 option "interpSF"       -       "Sampling factor if BLUT"                               int     no  default="20"
19
20 The use will something like
21
22 typedef clitk::GenericVectorInterpolator<InputImageType, double> GenericVectorInterpolatorType;
23 typename GenericVectorInterpolatorType::Pointer genericInterpolator=GenericVectorInterpolatorType::New();
24 genericInterpolator->SetArgsInfo(m_ArgsInfo);
25 typedef itk::VectorInterpolateImageFunction<InputImageType, double> InterpolatorType; 
26 typename InterpolatorType::Pointer interpolator=genericInterpolator->GetInterpolatorPointer();
27
28 */
29
30 namespace clitk
31 {
32   
33   template <class args_info_type,  class ImageType,  class TCoordRep >  
34   class GenericInterpolator : public itk::LightObject
35   {
36   public:
37     //==============================================
38     typedef GenericInterpolator     Self;
39     typedef itk::LightObject     Superclass;
40     typedef itk::SmartPointer<Self>            Pointer;
41     typedef itk::SmartPointer<const Self>      ConstPointer;
42
43     typedef itk::InterpolateImageFunction<ImageType, TCoordRep> InterpolatorType;
44     typedef typename InterpolatorType::Pointer InterpolatorPointer;   
45      
46     /** Method for creation through the object factory. */
47     itkNewMacro(Self);  
48   
49     //============================================== 
50     //Set members
51     void SetArgsInfo(args_info_type args_info)
52     {
53       m_ArgsInfo= args_info;
54       m_Verbose=m_ArgsInfo.verbose_flag;
55     }
56
57     //============================================== 
58     //Get members
59     InterpolatorPointer GetInterpolatorPointer(void);
60     
61     //==============================================
62   protected:
63     GenericInterpolator();
64     ~GenericInterpolator() {};
65
66   private:
67     args_info_type m_ArgsInfo;
68     InterpolatorPointer m_Interpolator;
69     bool m_Verbose;
70   };
71
72 } // end namespace clitk
73 #ifndef ITK_MANUAL_INSTANTIATION
74 #include "clitkGenericInterpolator.txx"
75 #endif
76
77 #endif // #define __clitkGenericInterpolator_h