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