OTB  10.0.0
Orfeo Toolbox
otbDecimateImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  * Copyright (C) 2007-2012 Institut Mines Telecom / Telecom Bretagne
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 
23 #ifndef otbDecimateImageFilter_h
24 #define otbDecimateImageFilter_h
25 
26 #include "itkImageToImageFilter.h"
27 #include "itkImage.h"
28 
29 namespace otb
30 {
31 
43 template <class TInputImage, class TOutputImage>
44 class ITK_EXPORT DecimateImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
45 {
46 public:
49  using Superclass = itk::ImageToImageFilter<TInputImage, TOutputImage>;
50  using Pointer = itk::SmartPointer<Self>;
51  using ConstPointer = itk::SmartPointer<const Self>;
52 
54  itkNewMacro(Self);
55 
57  itkTypeMacro(DecimateImageFilter, ImageToImageFilter);
58 
60  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
61  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
63 
65  using InputImageType = TInputImage;
66  using InputImageRegionType = typename InputImageType::RegionType;
67 
68  using OutputImageType = TOutputImage;
69  using OutputImageRegionType = typename OutputImageType::RegionType;
70  using OutputPixelType = typename OutputImageType::PixelType;
71 
73  itkGetMacro(DecimationFactor, unsigned int);
74  itkSetMacro(DecimationFactor, unsigned int);
76 
77 protected:
79  {
80  m_DecimationFactor = 1;
81  this->DynamicMultiThreadingOn();
82  }
83  virtual ~DecimateImageFilter() = default;
84 
88  void CallCopyOutputRegionToInputRegion(InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) override;
89  void CallCopyInputRegionToOutputRegion(OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) override;
91 
95  void GenerateOutputInformation() override;
96 
98  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
99 
100  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
101 
102 private:
103  DecimateImageFilter(const Self&) = delete;
104  void operator=(const Self&) = delete;
105 
106  unsigned int m_DecimationFactor;
107 }; // end of class
108 
109 } // end of namespace otb
110 
111 #ifndef OTB_MANUAL_INSTANTIATION
113 #endif
114 
115 #endif
Performs a down sampling of an image.
DecimateImageFilter(const Self &)=delete
typename InputImageType::RegionType InputImageRegionType
void operator=(const Self &)=delete
virtual ~DecimateImageFilter()=default
itk::SmartPointer< Self > Pointer
itk::SmartPointer< const Self > ConstPointer
typename OutputImageType::RegionType OutputImageRegionType
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
typename OutputImageType::PixelType OutputPixelType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.