OTB  6.7.0
Orfeo Toolbox
otbMultiChannelExtractROI.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 :
48  public ExtractROIBase<VectorImage<TInputPixelType, 2>, VectorImage<TOutputPixelType, 2> >
49 {
50 public:
56 
58  itkNewMacro(Self);
59 
62 
64  typedef typename Superclass::InputImageType InputImageType;
65  typedef typename Superclass::OutputImageType OutputImageType;
66 
68  typedef typename OutputImageType::InternalPixelType OutputValueType;
69 
71  typedef typename OutputImageType::RegionType OutputImageRegionType;
72  typedef typename InputImageType::RegionType InputImageRegionType;
73 
75  typedef typename OutputImageType::PixelType OutputImagePixelType;
76  typedef typename InputImageType::PixelType InputImagePixelType;
77 
83 
84  void SetFirstChannel(unsigned int id);
85  itkGetConstMacro(FirstChannel, unsigned int);
86  void SetLastChannel(unsigned int id);
87  itkGetConstMacro(LastChannel, unsigned int);
88 
90  typedef typename std::vector<unsigned int> ChannelsType;
91 
94  {
95  return (m_Channels);
96  }
97 
99  unsigned int GetNbChannels() const
100  {
101  return (m_Channels.size());
102  }
103 
106  void SetChannel(unsigned int channel);
107 
109  void ClearChannels(void);
110 
112  itkStaticConstMacro(InputImageDimension, unsigned int,
113  InputImageType::ImageDimension);
114  itkStaticConstMacro(OutputImageDimension, unsigned int,
115  OutputImageType::ImageDimension);
117 
118 protected:
121  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
122 
131  void GenerateOutputInformation() override;
132 
134  void ChannelsReInitialization();
135 
137  void SetChannelsWorkWithLimits();
138 
142  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
143  itk::ThreadIdType threadId) override;
144 
145 private:
146  MultiChannelExtractROI(const Self &) = delete;
147  void operator =(const Self&) = delete;
148 
150  unsigned int m_FirstChannel;
151  unsigned int m_LastChannel;
152 
155 
158 
161 };
162 
163 } // end namespace otb
164 
165 #ifndef OTB_MANUAL_INSTANTIATION
167 #endif
168 
169 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
OutputImageType::InternalPixelType OutputValueType
InputImageType::SizeType InputImageSizeType
InputImageType::IndexType InputImageIndexType
Superclass::OutputImageType OutputImageType
itk::SmartPointer< Self > Pointer
Superclass::InputImageType InputImageType
Extract a spatial or spectral subset of a multi-channel image.
OutputImageType::PixelType OutputImagePixelType
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
std::vector< unsigned int > ChannelsType
InputImageType::RegionType InputImageRegionType
OutputImageType::SizeType OutputImageSizeType
unsigned int ThreadIdType
OutputImageType::IndexType OutputImageIndexType
ExtractROIBase< VectorImage< TInputPixelType, 2 >, VectorImage< TOutputPixelType, 2 > > Superclass
itk::SmartPointer< const Self > ConstPointer
OutputImageType::RegionType OutputImageRegionType
Base class to extract area of images.
InputImageType::PixelType InputImagePixelType