RTK  1.4.0
Reconstruction Toolkit
rtkDownsampleImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright RTK Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef rtkDownsampleImageFilter_h
20 #define rtkDownsampleImageFilter_h
21 
22 #include "itkImageToImageFilter.h"
23 
24 namespace rtk
25 {
26 
37 template <class TInputImage, class TOutputImage = TInputImage>
38 class ITK_EXPORT DownsampleImageFilter:
39  public itk::ImageToImageFilter<TInputImage,TOutputImage>
40 {
41 public:
47 
49  itkNewMacro(Self);
50 
53 
55  typedef TOutputImage OutputImageType;
56  typedef TInputImage InputImageType;
57  typedef typename OutputImageType::Pointer OutputImagePointer;
58  typedef typename InputImageType::Pointer InputImagePointer;
59  typedef typename InputImageType::ConstPointer InputImageConstPointer;
60 
62  typedef typename TOutputImage::RegionType OutputImageRegionType;
63 
65  itkStaticConstMacro(ImageDimension, unsigned int,
66  TInputImage::ImageDimension );
67 
70  void SetFactors(unsigned int factors[]);
71 
74  void SetFactor(unsigned int dimension, unsigned int factor);
75 
83  void GenerateOutputInformation() ITK_OVERRIDE;
84 
90  void GenerateInputRequestedRegion() ITK_OVERRIDE;
91 
92 protected:
94  virtual ~DownsampleImageFilter() ITK_OVERRIDE {}
95 
106 // virtual void BeforeThreadedGenerateData();
107 #if ITK_VERSION_MAJOR<5
108  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) ITK_OVERRIDE;
109 #else
110  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) ITK_OVERRIDE;
111 #endif
112 // virtual void AfterThreadedGenerateData();
114 
115 private:
116  DownsampleImageFilter(const Self&); //purposely not implemented
117  void operator=(const Self&); //purposely not implemented
118 
119  unsigned int m_Factors[ImageDimension];
120  int m_Offsets[ImageDimension];
121 };
122 
123 
124 } // end namespace rtk
125 
126 #ifndef rtk_MANUAL_INSTANTIATION
127 #include "rtkDownsampleImageFilter.hxx"
128 #endif
129 
130 #endif
itk::SmartPointer< Self > Pointer
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
InputImageType::Pointer InputImagePointer
itk::SmartPointer< const Self > ConstPointer
unsigned int ThreadIdType
TOutputImage::RegionType OutputImageRegionType
OutputImageType::Pointer OutputImagePointer
InputImageType::ConstPointer InputImageConstPointer
Downsamples an image by a factor in each dimension.