]> Creatis software - clitk.git/blob - itk/clitkGenericVectorInterpolator.txx
639fe4f47f28c30a1e08ddd26a69b4968645c784
[clitk.git] / itk / clitkGenericVectorInterpolator.txx
1 #ifndef __clitkGenericVectorInterpolator_txx    
2 #define __clitkGenericVectorInterpolator_txx
3
4 #include "clitkGenericVectorInterpolator.h"
5
6
7 namespace clitk
8 {
9
10   //=========================================================================================================================
11   //constructor
12   template <class args_info_type, class ImageType, class TCoordRep> 
13   GenericVectorInterpolator<args_info_type, ImageType, TCoordRep>::GenericVectorInterpolator()
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 GenericVectorInterpolator<args_info_type, ImageType, TCoordRep>::InterpolatorPointer 
24   GenericVectorInterpolator<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.interpVF_arg )
32       {
33       case 0: 
34
35         interpolator= itk::VectorNearestNeighborInterpolateImageFunction< ImageType,TCoordRep >::New();
36         if (m_Verbose) std::cout<<"Using nearestneighbor interpolation..."<<std::endl;
37         break;
38  
39       case 1:
40
41         interpolator = itk::VectorLinearInterpolateImageFunction< ImageType,TCoordRep >::New();
42         if (m_Verbose) std::cout<<"Using linear interpolation..."<<std::endl;
43         break;  
44       
45       case 2:
46         {
47           typename clitk::VectorBSplineInterpolateImageFunction< ImageType,TCoordRep >::Pointer m =clitk::VectorBSplineInterpolateImageFunction< ImageType,TCoordRep >::New();
48           m->SetSplineOrder(m_ArgsInfo.interpVFOrder_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 clitk::VectorBSplineInterpolateImageFunctionWithLUT< ImageType,TCoordRep >::Pointer m =clitk::VectorBSplineInterpolateImageFunctionWithLUT< ImageType,TCoordRep >::New();
57           m->SetSplineOrder(m_ArgsInfo.interpVFOrder_arg);
58           m->SetLUTSamplingFactor(m_ArgsInfo.interpVFSF_arg);
59           interpolator=m;
60           if (m_Verbose) std::cout<<"Using BLUT interpolation..."<<std::endl;
61           break;
62         } 
63
64       }//end of switch
65     
66     
67     //============================================================================
68     //return the pointer
69     return interpolator;
70   }
71   
72 }
73
74 #endif