]> Creatis software - clitk.git/blob - registration/clitkGenericInterpolator.txx
Debug RTStruct conversion with empty struc
[clitk.git] / registration / clitkGenericInterpolator.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
19 #ifndef __clitkGenericInterpolator_txx
20 #define __clitkGenericInterpolator_txx
21
22 #include "clitkGenericInterpolator.h"
23
24
25 namespace clitk
26 {
27
28 //=========================================================================================================================
29 //constructor
30 template <class args_info_type,  class ImageType, class TCoordRep>
31 GenericInterpolator<args_info_type, ImageType, TCoordRep>::GenericInterpolator()
32 {
33   m_Interpolator=NULL;
34   m_Verbose=false;
35 }
36
37
38 //=========================================================================================================================
39 //Get the pointer
40 template <class args_info_type,  class ImageType, class TCoordRep>
41 typename GenericInterpolator<args_info_type, ImageType, TCoordRep>::InterpolatorPointer
42 GenericInterpolator<args_info_type, ImageType, TCoordRep>::GetInterpolatorPointer()
43 {
44   //============================================================================
45   // We retrieve the type of interpolation from the command line
46   //============================================================================
47   typename InterpolatorType::Pointer interpolator;
48
49   switch ( m_ArgsInfo.interp_arg ) {
50   case 0:
51
52     interpolator= itk::NearestNeighborInterpolateImageFunction< ImageType,TCoordRep >::New();
53     if (m_Verbose) std::cout<<"Using nearestneighbor interpolation..."<<std::endl;
54     break;
55
56   case 1:
57
58     interpolator = itk::LinearInterpolateImageFunction< ImageType,TCoordRep >::New();
59     if (m_Verbose) std::cout<<"Using linear interpolation..."<<std::endl;
60     break;
61
62   case 2: {
63     typename itk::BSplineInterpolateImageFunction< ImageType,TCoordRep >::Pointer m =itk::BSplineInterpolateImageFunction< ImageType,TCoordRep >::New();
64     m->SetSplineOrder(m_ArgsInfo.interpOrder_arg);
65     interpolator=m;
66     if (m_Verbose) std::cout<<"Using Bspline interpolation..."<<std::endl;
67     break;
68   }
69
70   case 3: {
71     typename itk::BSplineInterpolateImageFunctionWithLUT< ImageType,TCoordRep >::Pointer m =itk::BSplineInterpolateImageFunctionWithLUT< ImageType,TCoordRep >::New();
72     m->SetSplineOrder(m_ArgsInfo.interpOrder_arg);
73     m->SetLUTSamplingFactor(m_ArgsInfo.interpSF_arg);
74     interpolator=m;
75     if (m_Verbose) std::cout<<"Using BLUT interpolation..."<<std::endl;
76     break;
77   }
78
79
80   }//end of switch
81
82
83   //============================================================================
84   //return the pointer
85   return interpolator;
86 }
87
88 }
89
90 #endif