OTB  10.0.0
Orfeo Toolbox
otbMultiChannelExtractROI.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbMultiChannelExtractROI_h
22 #define otbMultiChannelExtractROI_h
23 
24 #include "otbExtractROIBase.h"
25 #include "otbVectorImage.h"
26 #include "OTBImageBaseExport.h"
27 
28 #include "itkMacro.h"
29 #include <vector>
30 
31 namespace otb
32 {
33 
46 template <class TInputPixelType, class TOutputPixelType>
47 class OTBImageBase_EXPORT_TEMPLATE MultiChannelExtractROI : public ExtractROIBase<VectorImage<TInputPixelType, 2>, VectorImage<TOutputPixelType, 2>>
48 {
49 public:
53  typedef itk::SmartPointer<Self> Pointer;
54  typedef itk::SmartPointer<const Self> ConstPointer;
55 
57  itkNewMacro(Self);
58 
61 
64  typedef typename Superclass::OutputImageType OutputImageType;
65 
67  typedef typename OutputImageType::InternalPixelType OutputValueType;
68 
70  typedef typename OutputImageType::RegionType OutputImageRegionType;
72 
74  typedef typename OutputImageType::PixelType OutputImagePixelType;
76 
78  typedef typename OutputImageType::IndexType OutputImageIndexType;
80  typedef typename OutputImageType::SizeType OutputImageSizeType;
82 
83  void SetFirstChannel(unsigned int id);
84  itkGetConstMacro(FirstChannel, unsigned int);
85  void SetLastChannel(unsigned int id);
86  itkGetConstMacro(LastChannel, unsigned int);
87 
89  typedef typename std::vector<unsigned int> ChannelsType;
90 
93  {
94  return (m_Channels);
95  }
96 
98  unsigned int GetNbChannels() const
99  {
100  return (m_Channels.size());
101  }
102 
105  void SetChannel(unsigned int channel);
106 
108  void ClearChannels(void);
109 
111  itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension);
112  itkStaticConstMacro(OutputImageDimension, unsigned int, OutputImageType::ImageDimension);
114 
115 protected:
118  {
119  }
120  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
121 
130  void GenerateOutputInformation() override;
131 
133  void ChannelsReInitialization();
134 
136  void SetChannelsWorkWithLimits();
137 
141  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
142 
143 private:
144  MultiChannelExtractROI(const Self&) = delete;
145  void operator=(const Self&) = delete;
146 
148  unsigned int m_FirstChannel;
149  unsigned int m_LastChannel;
150 
153 
156 
159 };
160 
161 } // end namespace otb
162 
163 #ifndef OTB_MANUAL_INSTANTIATION
165 #endif
166 
167 #endif
Base class to extract area of images.
Extract a spatial or spectral subset of a multi-channel image.
OutputImageType::InternalPixelType OutputValueType
itk::SmartPointer< const Self > ConstPointer
InputImageType::SizeType InputImageSizeType
ExtractROIBase< VectorImage< TInputPixelType, 2 >, VectorImage< TOutputPixelType, 2 > > Superclass
InputImageType::RegionType InputImageRegionType
OutputImageType::IndexType OutputImageIndexType
OutputImageType::PixelType OutputImagePixelType
std::vector< unsigned int > ChannelsType
Superclass::InputImageType InputImageType
itk::SmartPointer< Self > Pointer
InputImageType::PixelType InputImagePixelType
Superclass::OutputImageType OutputImageType
InputImageType::IndexType InputImageIndexType
void operator=(const Self &)=delete
OutputImageType::RegionType OutputImageRegionType
OutputImageType::SizeType OutputImageSizeType
MultiChannelExtractROI(const Self &)=delete
Creation of an "otb" vector image which contains metadata.
Superclass::PixelType PixelType
Superclass::IndexType IndexType
Superclass::SizeType SizeType
Superclass::RegionType RegionType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.