]> Creatis software - clitk.git/blob - registration/clitkGenericVectorInterpolator.h
With ITKv5, change VectorResample and VectorCast Image Filter to Resample and Cast...
[clitk.git] / registration / clitkGenericVectorInterpolator.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://www.centreleonberard.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 __clitkGenericVectorInterpolator_h
19 #define __clitkGenericVectorInterpolator_h
20 #include "clitkImageCommon.h"
21
22 //itk include
23 #if ( ITK_VERSION_MAJOR < 5 )
24 #include "itkVectorNearestNeighborInterpolateImageFunction.h"
25 #include "itkVectorLinearInterpolateImageFunction.h"
26 #else
27 #include "itkNearestNeighborInterpolateImageFunction.h"
28 #include "itkLinearInterpolateImageFunction.h"
29 #endif
30 #include "clitkVectorBSplineInterpolateImageFunction.h"
31 #include "clitkVectorBSplineInterpolateImageFunctionWithLUT.h"
32
33 /*
34
35 Requires at least the following section is the .ggo file
36
37 option "interpVF"               -       "Interpolation: 0=NN, 1=Linear, 2=BSpline, 3=BLUT"      int     no  default="1"
38 option "interpVFOrder"  -       "Order if BLUT or BSpline (0-5)"                        int     no  default="3"
39 option "interpVFSF"     -       "Sampling factor if BLUT"                               int     no  default="20"
40
41 The use will look something like
42
43 typedef clitk::GenericVectorInterpolator<InputImageType, double> GenericVectorInterpolatorType;
44 typename GenericVectorInterpolatorType::Pointer genericInterpolator=GenericVectorInterpolatorType::New();
45 genericInterpolator->SetArgsInfo(m_ArgsInfo);
46 typedef itk::VectorInterpolateImageFunction<InputImageType, double> InterpolatorType; 
47 typename InterpolatorType::Pointer interpolator=genericInterpolator->GetInterpolatorPointer();
48
49 */
50
51 namespace clitk
52 {
53   
54   template <class args_info_type,   class ImageType,  class TCoordRep >  
55   class GenericVectorInterpolator : public itk::LightObject
56   {
57   public:
58     //==============================================
59     typedef GenericVectorInterpolator     Self;
60     typedef itk::LightObject     Superclass;
61     typedef itk::SmartPointer<Self>            Pointer;
62     typedef itk::SmartPointer<const Self>      ConstPointer;
63
64 #if ( ITK_VERSION_MAJOR < 5 )
65     typedef itk::VectorInterpolateImageFunction<ImageType, TCoordRep> InterpolatorType;
66 #else
67     typedef itk::InterpolateImageFunction<ImageType, TCoordRep> InterpolatorType;
68 #endif
69     typedef typename InterpolatorType::Pointer InterpolatorPointer;   
70      
71     /** Method for creation through the object factory. */
72     itkNewMacro(Self);  
73   
74     //============================================== 
75     //Set members
76     void SetArgsInfo(args_info_type args_info)
77     {
78       m_ArgsInfo= args_info;
79       m_Verbose=m_ArgsInfo.verbose_flag;
80     }
81
82     //============================================== 
83     //Get members
84     InterpolatorPointer GetInterpolatorPointer(void);
85     
86     //==============================================
87   protected:
88     GenericVectorInterpolator();
89     ~GenericVectorInterpolator() {};
90
91   private:
92     args_info_type m_ArgsInfo;
93     InterpolatorPointer m_Interpolator;
94     bool m_Verbose;
95   };
96
97 } // end namespace clitk
98 #ifndef ITK_MANUAL_INSTANTIATION
99 #include "clitkGenericVectorInterpolator.txx"
100 #endif
101
102 #endif // #define __clitkGenericVectorInterpolator_h