OTB  10.0.0
Orfeo Toolbox
otbSubsampleImageFilter.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 otbSubsampleImageFilter_h
24 #define otbSubsampleImageFilter_h
25 
26 #include "itkImageToImageFilter.h"
27 #include "itkImage.h"
28 #include "otbMacro.h" //for
29 
30 // Just to get the forward/inverse definitions
31 #include "otbWaveletOperatorBase.h"
32 
33 namespace otb
34 {
35 
54 template <class TInputImage, class TOutputImage, Wavelet::WaveletDirection TDirectionOfTransformation>
55 class ITK_EXPORT SubsampleImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
56 {
57 public:
60  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
61  typedef itk::SmartPointer<Self> Pointer;
62  typedef itk::SmartPointer<const Self> ConstPointer;
63 
65  itkNewMacro(Self);
66 
68  itkTypeMacro(SubsampleImageFilter, ImageToImageFilter);
69 
71  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
72  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
74 
77  itkStaticConstMacro(DirectionOfTransformation, DirectionOfTransformationEnumType, TDirectionOfTransformation);
78 
80  typedef TInputImage InputImageType;
81  typedef typename InputImageType::RegionType InputImageRegionType;
82  typedef typename InputImageType::IndexType InputImageIndexType;
83  typedef typename InputImageIndexType::IndexValueType InputImageIndexValueType;
84 
85  typedef TOutputImage OutputImageType;
86  typedef typename OutputImageType::Pointer OutputImagePointerType;
87  typedef typename OutputImageType::RegionType OutputImageRegionType;
88  typedef typename OutputImageType::SizeType OutputImageSizeType;
89  typedef typename OutputImageType::IndexType OutputImageIndexType;
90  typedef typename OutputImageType::PixelType OutputPixelType;
91 
93  itkGetMacro(SubsampleFactor, const InputImageIndexType&);
94  itkSetMacro(SubsampleFactor, InputImageIndexType&);
96  {
97  InputImageIndexType indexFactor;
98  indexFactor.Fill(factor);
99  SetSubSampleFactor(indexFactor);
100  }
102 
103 protected:
105  {
106  m_SubsampleFactor.Fill(1);
107  this->DynamicMultiThreadingOn();
108  }
110  {
111  }
112 
114  bool IsSubsampleFactorOne() const;
115 
119  void CallCopyOutputRegionToInputRegion(InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) override;
120  void CallCopyInputRegionToOutputRegion(OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) override;
122 
126  void GenerateOutputInformation() override;
127 
129  void BeforeThreadedGenerateData() override;
130 
132  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
133 
134  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
135 
136 private:
137  SubsampleImageFilter(const Self&) = delete;
138  void operator=(const Self&) = delete;
139 
141 }; // end of class
142 
143 } // end of namespace otb
144 
145 #ifndef OTB_MANUAL_INSTANTIATION
147 #endif
148 
149 #endif
Performs a down sampling of an image.
OutputImageType::IndexType OutputImageIndexType
OutputImageType::RegionType OutputImageRegionType
SubsampleImageFilter(const Self &)=delete
OutputImageType::SizeType OutputImageSizeType
InputImageType::RegionType InputImageRegionType
itk::SmartPointer< const Self > ConstPointer
InputImageType::IndexType InputImageIndexType
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
void operator=(const Self &)=delete
itk::SmartPointer< Self > Pointer
InputImageIndexType m_SubsampleFactor
InputImageIndexType::IndexValueType InputImageIndexValueType
OutputImageType::PixelType OutputPixelType
void SetSubSampleFactor(InputImageIndexValueType factor)
Wavelet::WaveletDirection DirectionOfTransformationEnumType
OutputImageType::Pointer OutputImagePointerType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.