]> Creatis software - clitk.git/blob - registration/clitkGenericVectorInterpolator.txx
With ITKv5, change VectorResample and VectorCast Image Filter to Resample and Cast...
[clitk.git] / registration / clitkGenericVectorInterpolator.txx
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_txx    
19 #define __clitkGenericVectorInterpolator_txx
20 #include "clitkGenericVectorInterpolator.h"
21
22
23 namespace clitk
24 {
25
26   //=========================================================================================================================
27   //constructor
28   template <class args_info_type, class ImageType, class TCoordRep> 
29   GenericVectorInterpolator<args_info_type, ImageType, TCoordRep>::GenericVectorInterpolator()
30   {
31     m_Interpolator=NULL;
32     m_Verbose=false;
33   }
34   
35   
36   //=========================================================================================================================
37   //Get the pointer
38   template <class args_info_type, class ImageType, class TCoordRep> 
39   typename GenericVectorInterpolator<args_info_type, ImageType, TCoordRep>::InterpolatorPointer 
40   GenericVectorInterpolator<args_info_type, ImageType, TCoordRep>::GetInterpolatorPointer()
41   {
42     //============================================================================
43     // We retrieve the type of interpolation from the command line
44     //============================================================================
45     typename InterpolatorType::Pointer interpolator;  
46   
47     switch ( m_ArgsInfo.interpVF_arg )
48       {
49       case 0: 
50
51 #if ( ITK_VERSION_MAJOR < 5 )
52         interpolator= itk::VectorNearestNeighborInterpolateImageFunction< ImageType,TCoordRep >::New();
53 #else
54         interpolator= itk::NearestNeighborInterpolateImageFunction< ImageType,TCoordRep >::New();
55 #endif
56         if (m_Verbose) std::cout<<"Using nearestneighbor interpolation..."<<std::endl;
57         break;
58  
59       case 1:
60
61 #if ( ITK_VERSION_MAJOR < 5 )
62         interpolator = itk::VectorLinearInterpolateImageFunction< ImageType,TCoordRep >::New();
63 #else
64         interpolator = itk::LinearInterpolateImageFunction< ImageType,TCoordRep >::New();
65 #endif
66         if (m_Verbose) std::cout<<"Using linear interpolation..."<<std::endl;
67         break;  
68       
69 /*      case 2:
70         {
71           typename clitk::VectorBSplineInterpolateImageFunction< ImageType,TCoordRep >::Pointer m =clitk::VectorBSplineInterpolateImageFunction< ImageType,TCoordRep >::New();
72           m->SetSplineOrder(m_ArgsInfo.interpVFOrder_arg);
73           interpolator=m;
74           if (m_Verbose) std::cout<<"Using Bspline interpolation..."<<std::endl;
75           break; 
76         }
77         
78       case 3:
79         {
80           typename clitk::VectorBSplineInterpolateImageFunctionWithLUT< ImageType,TCoordRep >::Pointer m =clitk::VectorBSplineInterpolateImageFunctionWithLUT< ImageType,TCoordRep >::New();
81           m->SetSplineOrder(m_ArgsInfo.interpVFOrder_arg);
82           m->SetLUTSamplingFactor(m_ArgsInfo.interpVFSF_arg);
83           interpolator=m;
84           if (m_Verbose) std::cout<<"Using BLUT interpolation..."<<std::endl;
85           break;
86         } 
87 */
88       }//end of switch
89     
90     
91     //============================================================================
92     //return the pointer
93     return interpolator;
94   }
95   
96 }
97
98 #endif