OTB  9.0.0
Orfeo Toolbox
otbSubsampleImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 
29 // Just to get the forward/inverse definitions
30 #include "otbWaveletOperatorBase.h"
31 
32 namespace otb
33 {
34 
53 template <class TInputImage, class TOutputImage, Wavelet::WaveletDirection TDirectionOfTransformation>
54 class ITK_EXPORT SubsampleImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
55 {
56 public:
59  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
60  typedef itk::SmartPointer<Self> Pointer;
61  typedef itk::SmartPointer<const Self> ConstPointer;
62 
64  itkNewMacro(Self);
65 
67  itkTypeMacro(SubsampleImageFilter, ImageToImageFilter);
68 
70  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
71  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
73 
76  itkStaticConstMacro(DirectionOfTransformation, DirectionOfTransformationEnumType, TDirectionOfTransformation);
77 
79  typedef TInputImage InputImageType;
80  typedef typename InputImageType::RegionType InputImageRegionType;
81  typedef typename InputImageType::IndexType InputImageIndexType;
82  typedef typename InputImageIndexType::IndexValueType InputImageIndexValueType;
83 
84  typedef TOutputImage OutputImageType;
85  typedef typename OutputImageType::Pointer OutputImagePointerType;
86  typedef typename OutputImageType::RegionType OutputImageRegionType;
87  typedef typename OutputImageType::SizeType OutputImageSizeType;
88  typedef typename OutputImageType::IndexType OutputImageIndexType;
89  typedef typename OutputImageType::PixelType OutputPixelType;
90 
92  itkGetMacro(SubsampleFactor, const InputImageIndexType&);
93  itkSetMacro(SubsampleFactor, InputImageIndexType&);
95  {
96  InputImageIndexType indexFactor;
97  indexFactor.Fill(factor);
98  SetSubSampleFactor(indexFactor);
99  }
101 
102 protected:
104  {
105  m_SubsampleFactor.Fill(1);
106  }
108  {
109  }
110 
112  bool IsSubsampleFactorOne() const;
113 
117  void CallCopyOutputRegionToInputRegion(InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) override;
118  void CallCopyInputRegionToOutputRegion(OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) override;
120 
124  void GenerateOutputInformation() override;
125 
127  void BeforeThreadedGenerateData() override;
128 
130  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
131 
132  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
133 
134 private:
135  SubsampleImageFilter(const Self&) = delete;
136  void operator=(const Self&) = delete;
137 
139 }; // end of class
140 
141 } // end of namespace otb
142 
143 #ifndef OTB_MANUAL_INSTANTIATION
145 #endif
146 
147 #endif
otbWaveletOperatorBase.h
otb::SubsampleImageFilter::OutputImageSizeType
OutputImageType::SizeType OutputImageSizeType
Definition: otbSubsampleImageFilter.h:87
otb::SubsampleImageFilter::OutputImagePointerType
OutputImageType::Pointer OutputImagePointerType
Definition: otbSubsampleImageFilter.h:85
otb::SubsampleImageFilter::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbSubsampleImageFilter.h:80
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::SubsampleImageFilter::OutputImageIndexType
OutputImageType::IndexType OutputImageIndexType
Definition: otbSubsampleImageFilter.h:88
otb::SubsampleImageFilter::m_SubsampleFactor
InputImageIndexType m_SubsampleFactor
Definition: otbSubsampleImageFilter.h:138
otb::SubsampleImageFilter
Performs a down sampling of an image.
Definition: otbSubsampleImageFilter.h:54
otb::SubsampleImageFilter::OutputPixelType
OutputImageType::PixelType OutputPixelType
Definition: otbSubsampleImageFilter.h:89
otb::SubsampleImageFilter::Self
SubsampleImageFilter Self
Definition: otbSubsampleImageFilter.h:58
otb::SubsampleImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbSubsampleImageFilter.h:84
otb::SubsampleImageFilter::DirectionOfTransformationEnumType
Wavelet::WaveletDirection DirectionOfTransformationEnumType
Definition: otbSubsampleImageFilter.h:75
otb::SubsampleImageFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbSubsampleImageFilter.h:59
otb::Wavelet::WaveletDirection
WaveletDirection
Definition: otbWaveletOperatorBase.h:36
otb::SubsampleImageFilter::InputImageIndexType
InputImageType::IndexType InputImageIndexType
Definition: otbSubsampleImageFilter.h:81
otb::SubsampleImageFilter::InputImageType
TInputImage InputImageType
Definition: otbSubsampleImageFilter.h:79
otb::SubsampleImageFilter::InputImageIndexValueType
InputImageIndexType::IndexValueType InputImageIndexValueType
Definition: otbSubsampleImageFilter.h:82
otb::SubsampleImageFilter::SubsampleImageFilter
SubsampleImageFilter()
Definition: otbSubsampleImageFilter.h:103
otb::SubsampleImageFilter::~SubsampleImageFilter
~SubsampleImageFilter() override
Definition: otbSubsampleImageFilter.h:107
otb::SubsampleImageFilter::SetSubSampleFactor
void SetSubSampleFactor(InputImageIndexValueType factor)
Definition: otbSubsampleImageFilter.h:94
otb::SubsampleImageFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbSubsampleImageFilter.h:86
otb::SubsampleImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbSubsampleImageFilter.h:60
otbSubsampleImageFilter.hxx
otb::SubsampleImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbSubsampleImageFilter.h:61