OTB  9.0.0
Orfeo Toolbox
otbExtractROIBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbExtractROIBase_h
22 #define otbExtractROIBase_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "itkSmartPointer.h"
26 #include "itkExtractImageFilterRegionCopier.h"
27 
28 namespace otb
29 {
30 
47 template <class TInputImage, class TOutputImage>
48 class ExtractROIBase : public itk::ImageToImageFilter<TInputImage, TOutputImage>
49 {
50 public:
53  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
54  typedef itk::SmartPointer<Self> Pointer;
55  typedef itk::SmartPointer<const Self> ConstPointer;
56 
58  itkNewMacro(Self);
59 
61  itkTypeMacro(ExtractROIBase, itk::ImageToImageFilter);
62 
64  typedef TInputImage InputImageType;
65  typedef TOutputImage OutputImageType;
66 
68  typedef typename TOutputImage::RegionType OutputImageRegionType;
69  typedef typename TInputImage::RegionType InputImageRegionType;
70 
72  typedef typename TOutputImage::PixelType OutputImagePixelType;
73  typedef typename TInputImage::PixelType InputImagePixelType;
74 
76  typedef typename TOutputImage::IndexType OutputImageIndexType;
77  typedef typename TInputImage::IndexType InputImageIndexType;
78  typedef typename TOutputImage::SizeType OutputImageSizeType;
79  typedef typename TInputImage::SizeType InputImageSizeType;
80 
82  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
83  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
85 
86  typedef itk::ImageToImageFilterDetail::ExtractImageFilterRegionCopier<itkGetStaticConstMacro(InputImageDimension),
87  itkGetStaticConstMacro(OutputImageDimension)>
89 
90  itkGetMacro(ExtractionRegion, InputImageRegionType);
91 
94 
96  itkSetMacro(StartX, unsigned long);
97  itkGetConstMacro(StartX, unsigned long);
98  itkSetMacro(StartY, unsigned long);
99  itkGetConstMacro(StartY, unsigned long);
100 
102  itkSetMacro(SizeX, unsigned long);
103  itkGetConstMacro(SizeX, unsigned long);
104  itkSetMacro(SizeY, unsigned long);
105  itkGetConstMacro(SizeY, unsigned long);
107 
108 protected:
109  ExtractROIBase();
110  ~ExtractROIBase() override
111  {
112  }
113  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
114 
115  void GenerateInputRequestedRegion() override;
116 
125  void GenerateOutputInformation() override;
126 
137  void CallCopyOutputRegionToInputRegion(InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) override;
138 
149  // ATTENTION bizarre
150 
151  void ThreadedGenerateData(const OutputImageRegionType& /*outputRegionForThread*/, itk::ThreadIdType /*threadId*/) override
152 
153  {
154  }
155 
162 
165 
166 private:
167  ExtractROIBase(const Self&) = delete;
168  void operator=(const Self&) = delete;
169 
171  unsigned long m_StartX;
172  unsigned long m_StartY;
173 
175  unsigned long m_SizeX;
176  unsigned long m_SizeY;
177 };
178 
179 } // end namespace otb
180 
181 #ifndef OTB_MANUAL_INSTANTIATION
182 #include "otbExtractROIBase.hxx"
183 #endif
184 
185 #endif
otb::ExtractROIBase::m_OutputImageRegion
OutputImageRegionType m_OutputImageRegion
Definition: otbExtractROIBase.h:164
otb::ExtractROIBase::Self
ExtractROIBase Self
Definition: otbExtractROIBase.h:52
otb::ExtractROIBase::~ExtractROIBase
~ExtractROIBase() override
Definition: otbExtractROIBase.h:110
otb::ExtractROIBase::SetInternalExtractionRegion
void SetInternalExtractionRegion(InputImageRegionType extractRegion)
Definition: otbExtractROIBase.hxx:69
otb::ExtractROIBase::GenerateOutputInformation
void GenerateOutputInformation() override
Definition: otbExtractROIBase.hxx:153
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ExtractROIBase::GenerateInputRequestedRegion
void GenerateInputRequestedRegion() override
Definition: otbExtractROIBase.hxx:116
otb::ExtractROIBase::OutputImageIndexType
TOutputImage::IndexType OutputImageIndexType
Definition: otbExtractROIBase.h:76
otb::ExtractROIBase::Superclass
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbExtractROIBase.h:53
otb::ExtractROIBase::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbExtractROIBase.hxx:46
otb::ExtractROIBase::InputImageDimension
static const unsigned int InputImageDimension
Definition: otbExtractROIBase.h:82
otb::ExtractROIBase::ExtractROIBaseRegionCopierType
itk::ImageToImageFilterDetail::ExtractImageFilterRegionCopier< itkGetStaticConstMacro(InputImageDimension), itkGetStaticConstMacro(OutputImageDimension)> ExtractROIBaseRegionCopierType
Definition: otbExtractROIBase.h:88
otb::ExtractROIBase::InputImageIndexType
TInputImage::IndexType InputImageIndexType
Definition: otbExtractROIBase.h:77
otb::ExtractROIBase::InputImageSizeType
TInputImage::SizeType InputImageSizeType
Definition: otbExtractROIBase.h:79
otb::ExtractROIBase
Base class to extract area of images.
Definition: otbExtractROIBase.h:48
otb::ExtractROIBase::SetExtractionRegion
void SetExtractionRegion(InputImageRegionType roi)
Definition: otbExtractROIBase.hxx:105
otb::ExtractROIBase::m_SizeY
unsigned long m_SizeY
Definition: otbExtractROIBase.h:176
otb::ExtractROIBase::OutputImageType
TOutputImage OutputImageType
Definition: otbExtractROIBase.h:65
otbExtractROIBase.hxx
otb::ExtractROIBase::OutputImageDimension
static const unsigned int OutputImageDimension
Definition: otbExtractROIBase.h:83
otb::ExtractROIBase::operator=
void operator=(const Self &)=delete
otb::ExtractROIBase::OutputImageSizeType
TOutputImage::SizeType OutputImageSizeType
Definition: otbExtractROIBase.h:78
otb::ExtractROIBase::OutputImageRegionType
TOutputImage::RegionType OutputImageRegionType
Definition: otbExtractROIBase.h:68
otb::ExtractROIBase::m_ExtractionRegion
InputImageRegionType m_ExtractionRegion
Definition: otbExtractROIBase.h:163
otb::ExtractROIBase::m_StartX
unsigned long m_StartX
Definition: otbExtractROIBase.h:171
otb::ExtractROIBase::ExtractROIBase
ExtractROIBase()
Definition: otbExtractROIBase.hxx:37
otb::ExtractROIBase::m_StartY
unsigned long m_StartY
Definition: otbExtractROIBase.h:172
otb::ExtractROIBase::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbExtractROIBase.h:54
otb::ExtractROIBase::CallCopyOutputRegionToInputRegion
void CallCopyOutputRegionToInputRegion(InputImageRegionType &destRegion, const OutputImageRegionType &srcRegion) override
Definition: otbExtractROIBase.hxx:55
otb::ExtractROIBase::InputImagePixelType
TInputImage::PixelType InputImagePixelType
Definition: otbExtractROIBase.h:73
otb::ExtractROIBase::OutputImagePixelType
TOutputImage::PixelType OutputImagePixelType
Definition: otbExtractROIBase.h:72
otb::ExtractROIBase::ThreadedGenerateData
void ThreadedGenerateData(const OutputImageRegionType &, itk::ThreadIdType) override
Definition: otbExtractROIBase.h:151
otb::ExtractROIBase::InputImageType
TInputImage InputImageType
Definition: otbExtractROIBase.h:61
otb::ExtractROIBase::m_SizeX
unsigned long m_SizeX
Definition: otbExtractROIBase.h:175
otb::ExtractROIBase::InputImageRegionType
TInputImage::RegionType InputImageRegionType
Definition: otbExtractROIBase.h:69
otb::ExtractROIBase::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbExtractROIBase.h:55