]> Creatis software - clitk.git/blob - itk/clitkGenericInterpolator.txx
10aecbbbd0c576dfc1f2a6fb1854bf467d72c03b
[clitk.git] / itk / clitkGenericInterpolator.txx
1 #ifndef __clitkGenericInterpolator_txx  
2 #define __clitkGenericInterpolator_txx
3 #include "clitkGenericInterpolator.h"
4
5
6 namespace clitk
7 {
8
9   //=========================================================================================================================
10   //constructor
11   template <class args_info_type,  class ImageType, class TCoordRep> 
12   GenericInterpolator<args_info_type, ImageType, TCoordRep>::GenericInterpolator()
13   {
14     m_Interpolator=NULL;
15     m_Verbose=false;
16   }
17   
18   
19   //=========================================================================================================================
20   //Get the pointer
21   template <class args_info_type,  class ImageType, class TCoordRep> 
22   typename GenericInterpolator<args_info_type, ImageType, TCoordRep>::InterpolatorPointer 
23   GenericInterpolator<args_info_type, ImageType, TCoordRep>::GetInterpolatorPointer()
24   {
25     //============================================================================
26     // We retrieve the type of interpolation from the command line
27     //============================================================================
28     typename InterpolatorType::Pointer interpolator;  
29   
30     switch ( m_ArgsInfo.interp_arg )
31       {
32       case 0: 
33
34         interpolator= itk::NearestNeighborInterpolateImageFunction< ImageType,TCoordRep >::New();
35         if (m_Verbose) std::cout<<"Using nearestneighbor interpolation..."<<std::endl;
36         break;
37  
38       case 1:
39
40         interpolator = itk::LinearInterpolateImageFunction< ImageType,TCoordRep >::New();
41         if (m_Verbose) std::cout<<"Using linear interpolation..."<<std::endl;
42         break;  
43       
44       case 2:
45         {       
46           typename itk::BSplineInterpolateImageFunction< ImageType,TCoordRep >::Pointer m =itk::BSplineInterpolateImageFunction< ImageType,TCoordRep >::New();
47           m->SetSplineOrder(m_ArgsInfo.interpOrder_arg);
48           interpolator=m;
49           if (m_Verbose) std::cout<<"Using Bspline interpolation..."<<std::endl;
50           break; 
51         }
52
53       case 3:
54         {
55           typename itk::BSplineInterpolateImageFunctionWithLUT< ImageType,TCoordRep >::Pointer m =itk::BSplineInterpolateImageFunctionWithLUT< ImageType,TCoordRep >::New();
56           m->SetSplineOrder(m_ArgsInfo.interpOrder_arg);
57           m->SetLUTSamplingFactor(m_ArgsInfo.interpSF_arg);
58           interpolator=m;
59           if (m_Verbose) std::cout<<"Using BLUT interpolation..."<<std::endl;
60           break;
61         } 
62
63
64       }//end of switch
65     
66     
67     //============================================================================
68     //return the pointer
69     return interpolator;
70   }
71   
72 }
73
74 #endif