]> Creatis software - clitk.git/blob - tools/clitkVFInterpolateGenericFilter.h
Add clitkImage2Dicom tool
[clitk.git] / tools / clitkVFInterpolateGenericFilter.h
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 CLITKIMAGERESAMPLEGENERICFILTER_H
19 #define CLITKIMAGERESAMPLEGENERICFILTER_H
20 /**
21  -------------------------------------------------------------------
22  * @file   clitkVFInterpolateGenericFilter.h
23  * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
24  * @date   23 Feb 2008 08:37:53
25
26  * @brief  
27  -------------------------------------------------------------------*/
28
29 // clitk include
30 #include "clitkCommon.h"
31 #include "clitkImageCommon.h"
32 #include "clitkImageToImageGenericFilter.h"
33
34 // itk include
35 #include "itkImage.h"
36 #include "itkVectorImage.h"
37 #include "itkFixedArray.h"
38 #include "itkImageFileReader.h"
39 #include "itkImageSeriesReader.h"
40 #include "itkImageFileWriter.h"
41 #include "itkRecursiveGaussianImageFilter.h"
42 #include "itkInterpolateImageFilter.h"
43 #include "itkAffineTransform.h"
44 #include "itkVectorNearestNeighborInterpolateImageFunction.h"
45 #include "itkVectorLinearInterpolateImageFunction.h"
46 #include "itkBSplineInterpolateImageFunction.h"
47 #include "itkBSplineInterpolateImageFunctionWithLUT.h"
48 #include "itkCommand.h"
49
50 namespace clitk {
51   
52   //--------------------------------------------------------------------
53   class VFInterpolateGenericFilter: 
54     public clitk::ImageToImageGenericFilter<VFInterpolateGenericFilter> {
55     
56   public: 
57     // constructor
58     VFInterpolateGenericFilter();
59
60     // Types
61     typedef VFInterpolateGenericFilter       Self;
62     typedef itk::SmartPointer<Self>       Pointer;
63     typedef itk::SmartPointer<const Self> ConstPointer;
64
65     // New
66     itkNewMacro(Self);
67     
68     void SetInputFilename1(const std::string& file) { mInputFilename1 = file; }
69     void SetInputFilename2(const std::string& file) { mInputFilename2 = file; }
70     void SetInterpolationName(const std::string & inter);
71     void SetDistance(double distance) { mDistance = distance; }
72     void SetBSplineOrder(int o) { mBSplineOrder = o; }
73     void SetBLUTSampling(int b) { mSamplingFactors.resize(1); mSamplingFactors[0] = b; }
74
75    //--------------------------------------------------------------------
76     // Main function called each time the filter is updated
77     template<class InputImageType>  
78     void UpdateWithInputImageType();
79
80   protected:
81     template<unsigned int Dim> void InitializeImageType();
82     //--------------------------------------------------------------------
83     std::string mInputFilename1, mInputFilename2;
84     std::string mInterpolatorName;
85     int mBSplineOrder;
86     std::vector<int> mSamplingFactors;
87     double mDistance;
88
89     //--------------------------------------------------------------------
90     template<unsigned int Dim, class PixelType, unsigned int DimCompo> 
91     void Update_WithDimAndPixelTypeAndComponent();
92     template<class ImageType>
93     typename ImageType::Pointer ComputeImage(typename ImageType::Pointer inputImage1, typename ImageType::Pointer inputImage2);
94     
95   }; // end class VFInterpolateGenericFilter
96   //--------------------------------------------------------------------
97     
98 } // end namespace
99 //--------------------------------------------------------------------
100     
101 #endif /* end #define CLITKIMAGERESAMPLEGENERICFILTER_H */
102