]> Creatis software - clitk.git/blob - filters/clitkImageResampleGenericFilter.h
Initial revision
[clitk.git] / filters / clitkImageResampleGenericFilter.h
1 #ifndef CLITKIMAGERESAMPLEGENERICFILTER_H
2 #define CLITKIMAGERESAMPLEGENERICFILTER_H
3
4 /**
5  -------------------------------------------------------------------
6  * @file   clitkImageResampleGenericFilter.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 "itkImageFileReader.h"
21 #include "itkImageSeriesReader.h"
22 #include "itkImageFileWriter.h"
23 #include "itkRecursiveGaussianImageFilter.h"
24 #include "itkResampleImageFilter.h"
25 #include "itkAffineTransform.h"
26 #include "itkNearestNeighborInterpolateImageFunction.h"
27 #include "itkLinearInterpolateImageFunction.h"
28 #include "itkBSplineInterpolateImageFunction.h"
29 #include "itkBSplineInterpolateImageFunctionWithLUT.h"
30 #include "itkCommand.h"
31
32 namespace clitk {
33   
34   //--------------------------------------------------------------------
35   class ImageResampleGenericFilter: public clitk::ImageToImageGenericFilter {
36     
37   public: 
38     // constructor
39     ImageResampleGenericFilter();
40
41     // Types
42     typedef ImageResampleGenericFilter    Self;
43     typedef ImageToImageGenericFilter     Superclass;
44     typedef itk::SmartPointer<Self>       Pointer;
45     typedef itk::SmartPointer<const Self> ConstPointer;
46
47     // New
48     itkNewMacro(Self);
49     
50     void SetOutputSize(const std::vector<int> & size);
51     void SetOutputSpacing(const std::vector<double> & spacing);
52     void SetGaussianSigma(const std::vector<double> & sigma);
53     void SetInterpolationName(const std::string & inter);
54     void SetDefaultPixelValue(double dpv) { mDefaultPixelValue = dpv;}
55     void SetBSplineOrder(int o) { mBSplineOrder = o; }
56     void SetBLUTSampling(int b) { mSamplingFactors.resize(1); mSamplingFactors[0] = b; }
57
58     void Update();    
59
60   protected:
61     //--------------------------------------------------------------------
62     std::string mInterpolatorName;
63     std::vector<int> mOutputSize;
64     std::vector<double> mOutputSpacing;
65     std::vector<double> mOutputOrigin;
66     double mDefaultPixelValue;
67     bool mApplyGaussianFilterBefore;
68     std::vector<double> mSigma;
69     int mBSplineOrder;
70     std::vector<int> mSamplingFactors;
71
72     //--------------------------------------------------------------------
73     template<unsigned int Dim> void Update_WithDim();
74     template<unsigned int Dim, class PixelType> void Update_WithDimAndPixelType();
75
76     //--------------------------------------------------------------------
77     template<class ImageType>
78     typename ImageType::Pointer ComputeImage(typename ImageType::Pointer inputImage);
79     
80   }; // end class ImageResampleGenericFilter
81   //--------------------------------------------------------------------
82     
83 #include "clitkImageResampleGenericFilter.txx"
84
85 } // end namespace
86 //--------------------------------------------------------------------
87     
88 #endif /* end #define CLITKIMAGERESAMPLEGENERICFILTER_H */
89