]> Creatis software - clitk.git/blob - itk/clitkGenericInterpolator.h
added the new headers
[clitk.git] / itk / clitkGenericInterpolator.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
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 copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #ifndef __clitkGenericInterpolator_h
19 #define __clitkGenericInterpolator_h
20 #include "clitkImageCommon.h"
21
22 //itk include
23 #include "itkNearestNeighborInterpolateImageFunction.h"
24 #include "itkLinearInterpolateImageFunction.h"
25 #include "itkBSplineInterpolateImageFunction.h"
26 #include "itkBSplineInterpolateImageFunctionWithLUT.h"
27
28
29 /*
30
31 Requires at least the following section is the .ggo file
32
33 option "interp"         -       "Interpolation: 0=NN, 1=Linear, 2=BSpline, 3=BLUT"      int     no  default="1"
34 option "interpOrder"    -       "Order if BLUT or BSpline (0-5)"                        int     no  default="3"
35 option "interpSF"       -       "Sampling factor if BLUT"                               int     no  default="20"
36
37 The use will something like
38
39 typedef clitk::GenericVectorInterpolator<InputImageType, double> GenericVectorInterpolatorType;
40 typename GenericVectorInterpolatorType::Pointer genericInterpolator=GenericVectorInterpolatorType::New();
41 genericInterpolator->SetArgsInfo(m_ArgsInfo);
42 typedef itk::VectorInterpolateImageFunction<InputImageType, double> InterpolatorType; 
43 typename InterpolatorType::Pointer interpolator=genericInterpolator->GetInterpolatorPointer();
44
45 */
46
47 namespace clitk
48 {
49   
50   template <class args_info_type,  class ImageType,  class TCoordRep >  
51   class GenericInterpolator : public itk::LightObject
52   {
53   public:
54     //==============================================
55     typedef GenericInterpolator     Self;
56     typedef itk::LightObject     Superclass;
57     typedef itk::SmartPointer<Self>            Pointer;
58     typedef itk::SmartPointer<const Self>      ConstPointer;
59
60     typedef itk::InterpolateImageFunction<ImageType, TCoordRep> InterpolatorType;
61     typedef typename InterpolatorType::Pointer InterpolatorPointer;   
62      
63     /** Method for creation through the object factory. */
64     itkNewMacro(Self);  
65   
66     //============================================== 
67     //Set members
68     void SetArgsInfo(args_info_type args_info)
69     {
70       m_ArgsInfo= args_info;
71       m_Verbose=m_ArgsInfo.verbose_flag;
72     }
73
74     //============================================== 
75     //Get members
76     InterpolatorPointer GetInterpolatorPointer(void);
77     
78     //==============================================
79   protected:
80     GenericInterpolator();
81     ~GenericInterpolator() {};
82
83   private:
84     args_info_type m_ArgsInfo;
85     InterpolatorPointer m_Interpolator;
86     bool m_Verbose;
87   };
88
89 } // end namespace clitk
90 #ifndef ITK_MANUAL_INSTANTIATION
91 #include "clitkGenericInterpolator.txx"
92 #endif
93
94 #endif // #define __clitkGenericInterpolator_h