OTB  9.0.0
Orfeo Toolbox
otbROIdataConversion.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 
22 #ifndef otbROIdataConversion_h
23 #define otbROIdataConversion_h
24 
25 #include <vector>
26 #include "otbImage.h"
27 #include "itkImageToImageFilter.h"
28 
29 namespace otb
30 {
31 
40 template <class TInputImage, class TInputROIImage>
41 class ROIdataConversion : public itk::ImageToImageFilter<TInputImage, otb::Image<typename TInputImage::PixelType, 1>>
42 {
43 public:
45  typedef itk::ImageToImageFilter<TInputImage, otb::Image<typename TInputImage::PixelType, 1>> Superclass;
46  typedef itk::SmartPointer<Self> Pointer;
47  typedef itk::SmartPointer<const Self> ConstPointer;
48 
49  itkNewMacro(Self);
50  itkTypeMacro(ROIdataConversion, itk::ImageToImageFilter);
51 
52  typedef TInputImage InputImageType;
53  typedef typename TInputImage::PixelType InputImagePixelType;
54  typedef typename TInputImage::Pointer InputImagePointerType;
55  typedef TInputROIImage InputROIImageType;
56  typedef typename TInputROIImage::Pointer InputROIImagePointerType;
57  typedef typename Superclass::OutputImageType OutputImageType;
58  typedef typename OutputImageType::Pointer OutputImagePointerType;
59 
60  typedef typename OutputImageType::SizeType::SizeValueType SizeValueType;
61 
64  {
65  return this->Superclass::GetInput();
66  }
67  void SetInputImage(const InputImageType* img)
68  {
69  this->Superclass::SetInput(img);
70  }
72 
75  {
76  return static_cast<InputROIImageType*>(this->itk::ProcessObject::GetInput(1));
77  }
78  void SetROIImage(const InputROIImageType* img)
79  {
80  this->itk::ProcessObject::SetNthInput(1, const_cast<InputROIImageType*>(img));
81  }
83 
84 protected:
86  ~ROIdataConversion() override
87  {
88  }
89  void GenerateOutputInformation() override;
90  void GenerateInputRequestedRegion() override;
91  void PrintSelf(std::ostream& os, itk::Indent indent) const override
92  {
93  Superclass::PrintSelf(os, indent);
94  }
95 
97  void GenerateData() override;
98 
101 };
102 
103 } // end of namespace otb
104 
105 #ifndef OTB_MANUAL_INSTANTIATION
106 #include "otbROIdataConversion.hxx"
107 #endif
108 
109 #endif
otb::ROIdataConversion::Self
ROIdataConversion Self
Definition: otbROIdataConversion.h:44
otb::ROIdataConversion::SetROIImage
void SetROIImage(const InputROIImageType *img)
Definition: otbROIdataConversion.h:78
otb::ROIdataConversion::SizeValueType
OutputImageType::SizeType::SizeValueType SizeValueType
Definition: otbROIdataConversion.h:60
otb::ROIdataConversion::GenerateData
void GenerateData() override
Definition: otbROIdataConversion.hxx:59
otb::ROIdataConversion::GetInputImage
const InputImageType * GetInputImage()
Definition: otbROIdataConversion.h:63
otbImage.h
otb::ROIdataConversion::SetInputImage
void SetInputImage(const InputImageType *img)
Definition: otbROIdataConversion.h:67
otbROIdataConversion.hxx
otb::ROIdataConversion::Superclass
itk::ImageToImageFilter< TInputImage, otb::Image< typename TInputImage::PixelType, 1 > > Superclass
Definition: otbROIdataConversion.h:45
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ROIdataConversion::GenerateOutputInformation
void GenerateOutputInformation() override
Definition: otbROIdataConversion.hxx:41
otb::ROIdataConversion::InputROIImagePointerType
TInputROIImage::Pointer InputROIImagePointerType
Definition: otbROIdataConversion.h:56
otb::ROIdataConversion::OutputImageType
Superclass::OutputImageType OutputImageType
Definition: otbROIdataConversion.h:57
otb::ROIdataConversion::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbROIdataConversion.h:47
otb::ROIdataConversion::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbROIdataConversion.h:91
otb::ROIdataConversion::InputImagePointerType
TInputImage::Pointer InputImagePointerType
Definition: otbROIdataConversion.h:54
otb::ROIdataConversion::ROIdataConversion
ROIdataConversion()
Definition: otbROIdataConversion.hxx:34
otb::ROIdataConversion::~ROIdataConversion
~ROIdataConversion() override
Definition: otbROIdataConversion.h:86
otb::ROIdataConversion::InputROIImageType
TInputROIImage InputROIImageType
Definition: otbROIdataConversion.h:55
otb::ROIdataConversion::InputImagePixelType
TInputImage::PixelType InputImagePixelType
Definition: otbROIdataConversion.h:53
otb::ROIdataConversion::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbROIdataConversion.h:46
otb::ROIdataConversion::OutputImagePointerType
OutputImageType::Pointer OutputImagePointerType
Definition: otbROIdataConversion.h:58
otb::ROIdataConversion
image data to vector conversion.
Definition: otbROIdataConversion.h:41
otb::ROIdataConversion::GetNumberOfSample
SizeValueType GetNumberOfSample()
Definition: otbROIdataConversion.hxx:92
otb::ROIdataConversion::GetROIImage
InputROIImageType * GetROIImage()
Definition: otbROIdataConversion.h:74
otb::ROIdataConversion::InputImageType
TInputImage InputImageType
Definition: otbROIdataConversion.h:50
otb::ROIdataConversion::GenerateInputRequestedRegion
void GenerateInputRequestedRegion() override
Definition: otbROIdataConversion.hxx:50