]> Creatis software - clitk.git/blob - filters/clitkVFResampleGenericFilter.h
- new GF system
[clitk.git] / filters / clitkVFResampleGenericFilter.h
1 #ifndef CLITKIMAGERESAMPLEGENERICFILTER_H
2 #define CLITKIMAGERESAMPLEGENERICFILTER_H
3
4 /**
5  -------------------------------------------------------------------
6  * @file   clitkVFResampleGenericFilter.h
7  * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
8  * @date   23 Feb 2008 08:37:53
9
10  * @brief  
11  -------------------------------------------------------------------*/
12
13 // clitk include
14 #include "clitkCommon.h"
15 #include "clitkImageCommon.h"
16 #include "clitkImageToImageGenericFilter.h"
17
18 // itk include
19 #include "itkImage.h"
20 #include "itkVectorImage.h"
21 #include "itkFixedArray.h"
22 #include "itkImageFileReader.h"
23 #include "itkImageSeriesReader.h"
24 #include "itkImageFileWriter.h"
25 #include "itkRecursiveGaussianImageFilter.h"
26 #include "itkVectorResampleImageFilter.h"
27 #include "itkAffineTransform.h"
28 #include "itkVectorNearestNeighborInterpolateImageFunction.h"
29 #include "itkVectorLinearInterpolateImageFunction.h"
30 #include "itkBSplineInterpolateImageFunction.h"
31 #include "itkBSplineInterpolateImageFunctionWithLUT.h"
32 #include "itkCommand.h"
33
34 namespace clitk {
35   
36   //--------------------------------------------------------------------
37   class VFResampleGenericFilter: 
38     public clitk::ImageToImageGenericFilter<VFResampleGenericFilter> {
39     
40   public: 
41     // constructor
42     VFResampleGenericFilter();
43
44     // Types
45     typedef VFResampleGenericFilter       Self;
46     typedef itk::SmartPointer<Self>       Pointer;
47     typedef itk::SmartPointer<const Self> ConstPointer;
48
49     // New
50     itkNewMacro(Self);
51     
52     void SetOutputSize(const std::vector<int> & size);
53     void SetOutputSpacing(const std::vector<double> & spacing);
54     void SetGaussianSigma(const std::vector<double> & sigma);
55     void SetInterpolationName(const std::string & inter);
56     void SetDefaultPixelValue(double dpv) { mDefaultPixelValue = dpv;}
57     void SetBSplineOrder(int o) { mBSplineOrder = o; }
58     void SetBLUTSampling(int b) { mSamplingFactors.resize(1); mSamplingFactors[0] = b; }
59
60    //--------------------------------------------------------------------
61     // Main function called each time the filter is updated
62     template<class InputImageType>  
63     void UpdateWithInputImageType();
64
65   protected:
66     template<unsigned int Dim> void InitializeImageType();
67     //--------------------------------------------------------------------
68     std::string mInterpolatorName;
69     std::vector<int> mOutputSize;
70     std::vector<double> mOutputSpacing;
71     std::vector<double> mOutputOrigin;
72     double mDefaultPixelValue;
73     bool mApplyGaussianFilterBefore;
74     std::vector<double> mSigma;
75     int mBSplineOrder;
76     std::vector<int> mSamplingFactors;
77
78     //--------------------------------------------------------------------
79     template<unsigned int Dim, class PixelType, unsigned int DimCompo> 
80     void Update_WithDimAndPixelTypeAndComponent();
81     template<class ImageType>
82     typename ImageType::Pointer ComputeImage(typename ImageType::Pointer inputImage);
83     
84   }; // end class VFResampleGenericFilter
85   //--------------------------------------------------------------------
86     
87 #include "clitkVFResampleGenericFilter.txx"
88
89 } // end namespace
90 //--------------------------------------------------------------------
91     
92 #endif /* end #define CLITKIMAGERESAMPLEGENERICFILTER_H */
93