RTK  2.1.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 : public itk::ImageToImageFilter<TInputImage, TOutputImage>
39 {
40 public:
41  ITK_DISALLOW_COPY_AND_ASSIGN(DownsampleImageFilter);
42 
48 
50  itkNewMacro(Self);
51 
54 
56  using OutputImageType = TOutputImage;
57  using InputImageType = TInputImage;
58  using OutputImagePointer = typename OutputImageType::Pointer;
59  using InputImagePointer = typename InputImageType::Pointer;
60  using InputImageConstPointer = typename InputImageType::ConstPointer;
61 
63  using OutputImageRegionType = typename TOutputImage::RegionType;
64 
66  itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
67 
70  void
71  SetFactors(const unsigned int factors[]);
72 
75  void
76  SetFactor(unsigned int dimension, unsigned int factor);
77 
85  void
86  GenerateOutputInformation() override;
87 
93  void
94  GenerateInputRequestedRegion() override;
95 
96 protected:
98  ~DownsampleImageFilter() override = default;
99 
110  void
111  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
112 
113 private:
114  unsigned int m_Factors[ImageDimension];
115  int m_Offsets[ImageDimension];
116 };
117 
118 
119 } // end namespace rtk
120 
121 #ifndef rtk_MANUAL_INSTANTIATION
122 # include "rtkDownsampleImageFilter.hxx"
123 #endif
124 
125 #endif
typename OutputImageType::Pointer OutputImagePointer
TInputImage InputImageType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename InputImageType::ConstPointer InputImageConstPointer
Downsamples an image by a factor in each dimension.