1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
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.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
19 #ifndef CLITKRESAMPLEIMAGEWITHOPTIONSFILTER_H
20 #define CLITKRESAMPLEIMAGEWITHOPTIONSFILTER_H
22 #include "itkImageToImageFilter.h"
23 #include "itkAffineTransform.h"
27 //--------------------------------------------------------------------
29 Image resampling with several interpolations and Gaussian filtering included.
31 //--------------------------------------------------------------------
33 template <class TInputImage, class TOutputImage=TInputImage>
34 class ITK_EXPORT ResampleImageWithOptionsFilter:
35 public itk::ImageToImageFilter<TInputImage, TOutputImage> {
38 /** Standard class typedefs. */
39 typedef ResampleImageWithOptionsFilter Self;
40 typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
41 typedef itk::SmartPointer<Self> Pointer;
42 typedef itk::SmartPointer<const Self> ConstPointer;
44 /** Method for creation through the object factory. */
47 /** Run-time type information (and related methods). */
48 itkTypeMacro(ResampleImageWithOptionsFilter, ImageToImageFilter);
50 /** Some convenient typedefs. */
51 typedef TInputImage InputImageType;
52 typedef typename InputImageType::ConstPointer InputImageConstPointer;
53 typedef typename InputImageType::Pointer InputImagePointer;
54 typedef typename InputImageType::RegionType InputImageRegionType;
55 typedef typename InputImageType::PixelType InputImagePixelType;
56 typedef typename InputImageType::SpacingType InputImageSpacingType;
57 typedef typename InputImageType::SizeType InputImageSizeType;
59 typedef TOutputImage OutputImageType;
60 typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
61 typedef typename OutputImageType::Pointer OutputImagePointer;
62 typedef typename OutputImageType::RegionType OutputImageRegionType;
63 typedef typename OutputImageType::PixelType OutputImagePixelType;
64 typedef typename OutputImageType::SpacingType OutputImageSpacingType;
65 typedef typename OutputImageType::SizeType OutputImageSizeType;
67 typedef itk::AffineTransform<double, InputImageType::ImageDimension> TransformType;
68 typedef typename InputImageType::SpacingType GaussianSigmaType;
70 /** ImageDimension constants */
71 itkStaticConstMacro(InputImageDimension, unsigned int,
72 TInputImage::ImageDimension);
73 itkStaticConstMacro(OutputImageDimension, unsigned int,
74 TOutputImage::ImageDimension);
75 itkConceptMacro(SameDimensionCheck,
76 (itk::Concept::SameDimension<InputImageDimension, OutputImageDimension>));
78 /** Interpolation types */
84 } InterpolationTypeEnumeration;
86 /** Input : image to resample */
87 void SetInput(const InputImageType * image);
89 /** ImageDimension constants */
90 itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
93 itkGetMacro(LastDimensionIsTime, bool);
94 itkSetMacro(LastDimensionIsTime, bool);
95 itkSetMacro(OutputIsoSpacing, double);
96 itkGetMacro(OutputIsoSpacing, double);
97 itkSetMacro(OutputSpacing, OutputImageSpacingType);
98 itkGetMacro(OutputSpacing, OutputImageSpacingType);
99 itkSetMacro(OutputSize, OutputImageSizeType);
100 itkGetMacro(OutputSize, OutputImageSizeType);
101 itkGetMacro(InterpolationType, InterpolationTypeEnumeration);
102 itkSetMacro(InterpolationType, InterpolationTypeEnumeration);
103 itkGetMacro(GaussianFilteringEnabled, bool);
104 itkSetMacro(GaussianFilteringEnabled, bool);
105 itkGetMacro(BSplineOrder, int);
106 itkSetMacro(BSplineOrder, int);
107 itkGetMacro(BLUTSamplingFactor, int);
108 itkSetMacro(BLUTSamplingFactor, int);
109 itkGetMacro(Transform, typename TransformType::Pointer);
110 itkSetMacro(Transform, typename TransformType::Pointer);
111 itkGetMacro(GaussianSigma, GaussianSigmaType);
112 itkSetMacro(GaussianSigma, GaussianSigmaType);
113 itkGetMacro(DefaultPixelValue, OutputImagePixelType);
114 itkSetMacro(DefaultPixelValue, OutputImagePixelType);
115 itkGetMacro(VerboseOptions, bool);
116 itkSetMacro(VerboseOptions, bool);
119 ResampleImageWithOptionsFilter();
120 virtual ~ResampleImageWithOptionsFilter() {}
122 bool m_LastDimensionIsTime;
123 double m_OutputIsoSpacing;
124 InterpolationTypeEnumeration m_InterpolationType;
125 bool m_GaussianFilteringEnabled;
127 int m_BLUTSamplingFactor;
128 OutputImageSizeType m_OutputSize;
129 OutputImageSpacingType m_OutputSpacing;
130 typename TransformType::Pointer m_Transform;
131 GaussianSigmaType m_GaussianSigma;
132 OutputImagePixelType m_DefaultPixelValue;
133 bool m_VerboseOptions;
134 OutputImageRegionType m_OutputRegion;
136 virtual void GenerateInputRequestedRegion();
137 virtual void GenerateOutputInformation();
138 virtual void GenerateData();
141 ResampleImageWithOptionsFilter(const Self&); //purposely not implemented
142 void operator=(const Self&); //purposely not implemented
145 //--------------------------------------------------------------------
147 } // end namespace clitk
148 //--------------------------------------------------------------------
150 #ifndef ITK_MANUAL_INSTANTIATION
151 #include "clitkResampleImageWithOptionsFilter.txx"