]> Creatis software - clitk.git/blob - filters/clitkVFResampleGenericFilter.h
Initial revision
[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: public clitk::ImageToImageGenericFilter {
38     
39   public: 
40     // constructor
41     VFResampleGenericFilter();
42
43     // Types
44     typedef VFResampleGenericFilter    Self;
45     typedef ImageToImageGenericFilter     Superclass;
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     void Update();    
61
62   protected:
63     //--------------------------------------------------------------------
64     std::string mInterpolatorName;
65     std::vector<int> mOutputSize;
66     std::vector<double> mOutputSpacing;
67     std::vector<double> mOutputOrigin;
68     double mDefaultPixelValue;
69     bool mApplyGaussianFilterBefore;
70     std::vector<double> mSigma;
71     int mBSplineOrder;
72     std::vector<int> mSamplingFactors;
73
74     //--------------------------------------------------------------------
75     template<unsigned int Dim> void Update_WithDim();
76     template<unsigned int Dim, class PixelType> void Update_WithDimAndPixelType();
77     template<unsigned int Dim, class PixelType, unsigned int DimCompo> 
78     void Update_WithDimAndPixelTypeAndComponent();
79
80     //--------------------------------------------------------------------
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