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://www.centreleonberard.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 //--------------------------------------------------------------------
32 template <class InputImageType, class OutputImageType=InputImageType>
33 class ITK_EXPORT ResampleImageWithOptionsFilter:
34 public itk::ImageToImageFilter<InputImageType, OutputImageType> {
37 /** Standard class typedefs. */
38 typedef ResampleImageWithOptionsFilter Self;
39 typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
40 typedef itk::SmartPointer<Self> Pointer;
41 typedef itk::SmartPointer<const Self> ConstPointer;
43 /** Method for creation through the object factory. */
46 /** Run-time type information (and related methods). */
47 itkTypeMacro(ResampleImageWithOptionsFilter, ImageToImageFilter);
49 /** Some convenient typedefs. */
50 typedef typename InputImageType::ConstPointer InputImageConstPointer;
51 typedef typename InputImageType::Pointer InputImagePointer;
52 typedef typename InputImageType::RegionType InputImageRegionType;
53 typedef typename InputImageType::PixelType InputImagePixelType;
54 typedef typename InputImageType::SpacingType InputImageSpacingType;
55 typedef typename InputImageType::SizeType InputImageSizeType;
57 typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
58 typedef typename OutputImageType::Pointer OutputImagePointer;
59 typedef typename OutputImageType::RegionType OutputImageRegionType;
60 typedef typename OutputImageType::PixelType OutputImagePixelType;
61 typedef typename OutputImageType::SpacingType OutputImageSpacingType;
62 typedef typename OutputImageType::SizeType OutputImageSizeType;
64 typedef itk::AffineTransform<double, InputImageType::ImageDimension> TransformType;
65 typedef typename InputImageType::SpacingType GaussianSigmaType;
67 /** Interpolation types */
74 } InterpolationTypeEnumeration;
76 /** ImageDimension constants */
77 itkStaticConstMacro(InputImageDimension, unsigned int,
78 InputImageType::ImageDimension);
79 itkStaticConstMacro(OutputImageDimension, unsigned int,
80 OutputImageType::ImageDimension);
81 itkConceptMacro(SameDimensionCheck,
82 (itk::Concept::SameDimension<InputImageDimension, OutputImageDimension>));
84 /** Input : image to resample */
85 void SetInput(const InputImageType * image);
87 /** ImageDimension constants */
88 itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
91 itkGetMacro(LastDimensionIsTime, bool);
92 itkSetMacro(LastDimensionIsTime, bool);
93 itkSetMacro(OutputIsoSpacing, double);
94 itkGetMacro(OutputIsoSpacing, double);
95 itkSetMacro(OutputSpacing, OutputImageSpacingType);
96 itkGetMacro(OutputSpacing, OutputImageSpacingType);
97 itkSetMacro(OutputSize, OutputImageSizeType);
98 itkGetMacro(OutputSize, OutputImageSizeType);
99 itkGetMacro(InterpolationType, InterpolationTypeEnumeration);
100 itkSetMacro(InterpolationType, InterpolationTypeEnumeration);
101 itkGetMacro(GaussianFilteringEnabled, bool);
102 itkSetMacro(GaussianFilteringEnabled, bool);
103 itkGetMacro(BSplineOrder, int);
104 itkSetMacro(BSplineOrder, int);
105 itkGetMacro(BLUTSamplingFactor, int);
106 itkSetMacro(BLUTSamplingFactor, int);
107 itkGetMacro(Transform, typename TransformType::Pointer);
108 itkSetMacro(Transform, typename TransformType::Pointer);
109 itkGetMacro(GaussianSigma, GaussianSigmaType);
110 itkSetMacro(GaussianSigma, GaussianSigmaType);
111 itkGetMacro(DefaultPixelValue, OutputImagePixelType);
112 itkSetMacro(DefaultPixelValue, OutputImagePixelType);
113 itkGetMacro(VerboseOptions, bool);
114 itkSetMacro(VerboseOptions, bool);
117 ResampleImageWithOptionsFilter();
118 virtual ~ResampleImageWithOptionsFilter() {}
120 bool m_LastDimensionIsTime;
121 double m_OutputIsoSpacing;
122 InterpolationTypeEnumeration m_InterpolationType;
123 bool m_GaussianFilteringEnabled;
125 int m_BLUTSamplingFactor;
126 OutputImageSizeType m_OutputSize;
127 OutputImageSpacingType m_OutputSpacing;
128 typename TransformType::Pointer m_Transform;
129 GaussianSigmaType m_GaussianSigma;
130 OutputImagePixelType m_DefaultPixelValue;
131 bool m_VerboseOptions;
132 OutputImageRegionType m_OutputRegion;
134 virtual void GenerateInputRequestedRegion();
135 virtual void GenerateOutputInformation();
136 virtual void GenerateData();
139 ResampleImageWithOptionsFilter(const Self&); //purposely not implemented
140 void operator=(const Self&); //purposely not implemented
143 //--------------------------------------------------------------------
145 // Convenient function
146 template<class InputImageType>
147 typename InputImageType::Pointer ResampleImageSpacing(typename InputImageType::Pointer input,
148 typename InputImageType::SpacingType spacing,
149 int interpolationType=0);
151 } // end namespace clitk
152 //--------------------------------------------------------------------
154 #ifndef ITK_MANUAL_INSTANTIATION
155 #include "clitkResampleImageWithOptionsFilter.txx"