OTB  9.0.0
Orfeo Toolbox
otbMultiChannelExtractROI.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 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 ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) 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
otb::VectorImage< TInputPixelType, 2 >::RegionType
Superclass::RegionType RegionType
Definition: otbVectorImage.h:113
otbVectorImage.h
otb::MultiChannelExtractROI::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMultiChannelExtractROI.h:53
otb::MultiChannelExtractROI::InputImagePixelType
InputImageType::PixelType InputImagePixelType
Definition: otbMultiChannelExtractROI.h:75
otb::MultiChannelExtractROI::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbMultiChannelExtractROI.h:54
otb::MultiChannelExtractROI::m_LastChannel
unsigned int m_LastChannel
Definition: otbMultiChannelExtractROI.h:149
otb::MultiChannelExtractROI::InputImageType
Superclass::InputImageType InputImageType
Definition: otbMultiChannelExtractROI.h:60
otb::MultiChannelExtractROI::m_ChannelsWorks
ChannelsType m_ChannelsWorks
Definition: otbMultiChannelExtractROI.h:155
otb::VectorImage< TInputPixelType, 2 >::SizeType
Superclass::SizeType SizeType
Definition: otbVectorImage.h:107
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::MultiChannelExtractROI::OutputImageIndexType
OutputImageType::IndexType OutputImageIndexType
Definition: otbMultiChannelExtractROI.h:78
otb::MultiChannelExtractROI::OutputValueType
OutputImageType::InternalPixelType OutputValueType
Definition: otbMultiChannelExtractROI.h:67
otb::MultiChannelExtractROI::ChannelsType
std::vector< unsigned int > ChannelsType
Definition: otbMultiChannelExtractROI.h:86
otb::MultiChannelExtractROI::Superclass
ExtractROIBase< VectorImage< TInputPixelType, 2 >, VectorImage< TOutputPixelType, 2 > > Superclass
Definition: otbMultiChannelExtractROI.h:52
otb::MultiChannelExtractROI::m_Channels
ChannelsType m_Channels
Definition: otbMultiChannelExtractROI.h:152
otb::MultiChannelExtractROI::~MultiChannelExtractROI
~MultiChannelExtractROI() override
Definition: otbMultiChannelExtractROI.h:117
otb::MultiChannelExtractROI
Extract a spatial or spectral subset of a multi-channel image.
Definition: otbMultiChannelExtractROI.h:47
otb::MultiChannelExtractROI::Self
MultiChannelExtractROI Self
Definition: otbMultiChannelExtractROI.h:51
otb::ExtractROIBase
Base class to extract area of images.
Definition: otbExtractROIBase.h:48
otb::MultiChannelExtractROI::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbMultiChannelExtractROI.h:70
otbMultiChannelExtractROI.hxx
otb::MultiChannelExtractROI::m_ChannelsKind
int m_ChannelsKind
Definition: otbMultiChannelExtractROI.h:158
otb::VectorImage< TInputPixelType, 2 >::PixelType
Superclass::PixelType PixelType
Definition: otbVectorImage.h:63
otb::MultiChannelExtractROI::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbMultiChannelExtractROI.h:71
otb::MultiChannelExtractROI::OutputImagePixelType
OutputImageType::PixelType OutputImagePixelType
Definition: otbMultiChannelExtractROI.h:74
otb::VectorImage< TInputPixelType, 2 >::IndexType
Superclass::IndexType IndexType
Definition: otbVectorImage.h:101
otb::MultiChannelExtractROI::GetChannels
ChannelsType GetChannels() const
Definition: otbMultiChannelExtractROI.h:92
otbExtractROIBase.h
otb::MultiChannelExtractROI::InputImageSizeType
InputImageType::SizeType InputImageSizeType
Definition: otbMultiChannelExtractROI.h:81
otb::MultiChannelExtractROI::InputImageIndexType
InputImageType::IndexType InputImageIndexType
Definition: otbMultiChannelExtractROI.h:79
otb::MultiChannelExtractROI::OutputImageSizeType
OutputImageType::SizeType OutputImageSizeType
Definition: otbMultiChannelExtractROI.h:80
otb::MultiChannelExtractROI::m_FirstChannel
unsigned int m_FirstChannel
Definition: otbMultiChannelExtractROI.h:148
otb::MultiChannelExtractROI::GetNbChannels
unsigned int GetNbChannels() const
Definition: otbMultiChannelExtractROI.h:98
otb::MultiChannelExtractROI::OutputImageType
Superclass::OutputImageType OutputImageType
Definition: otbMultiChannelExtractROI.h:64
otb::VectorImage< TOutputPixelType, 2 >