OTB  6.7.0
Orfeo Toolbox
otbROIdataConversion.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 
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>
42  : public itk::ImageToImageFilter<TInputImage, otb::Image<typename TInputImage::PixelType, 1> >
43 {
44 public:
49 
50  itkNewMacro(Self);
52 
53  typedef TInputImage InputImageType;
54  typedef typename TInputImage::PixelType InputImagePixelType;
55  typedef typename TInputImage::Pointer InputImagePointerType;
56  typedef TInputROIImage InputROIImageType;
57  typedef typename TInputROIImage::Pointer InputROIImagePointerType;
59  typedef typename OutputImageType::Pointer OutputImagePointerType;
60 
61  typedef typename OutputImageType::SizeType::SizeValueType SizeValueType;
62 
65  {
66  return this->Superclass::GetInput();
67  }
68  void SetInputImage(const InputImageType * img)
69  {
70  this->Superclass::SetInput(img);
71  }
73 
76  {
77  return static_cast<InputROIImageType *> (this->itk::ProcessObject::GetInput(1));
78  }
79  void SetROIImage(const InputROIImageType * img)
80  {
81  this->itk::ProcessObject::SetNthInput(1, const_cast<InputROIImageType *>(img));
82  }
84 
85 protected:
87  ~ROIdataConversion() override {}
88  void GenerateOutputInformation() override;
89  void GenerateInputRequestedRegion() override;
90  void PrintSelf(std::ostream& os, itk::Indent indent) const override
91  {
92  Superclass::PrintSelf(os, indent);
93  }
94 
96  void GenerateData() override;
97 
100 };
101 
102 } // end of namespace otb
103 
104 #ifndef OTB_MANUAL_INSTANTIATION
105 #include "otbROIdataConversion.hxx"
106 #endif
107 
108 #endif
void SetROIImage(const InputROIImageType *img)
const InputImageType * GetInputImage()
virtual void PrintSelf(std::ostream &os, Indent indent) const override
TInputImage::Pointer InputImagePointerType
void GenerateInputRequestedRegion() override
OutputImageType::SizeType::SizeValueType SizeValueType
InputROIImageType * GetROIImage()
void SetInputImage(const InputImageType *img)
unsigned long SizeValueType
virtual void SetInput(const InputImageType *image)
void GenerateOutputInformation() override
TInputROIImage InputROIImageType
TInputROIImage::Pointer InputROIImagePointerType
const InputImageType * GetInput() const
DataObject * GetInput(const DataObjectIdentifierType &key)
itk::ImageToImageFilter< TInputImage, otb::Image< typename TInputImage::PixelType, 1 > > Superclass
TInputImage::PixelType InputImagePixelType
OutputImageType::Pointer OutputImagePointerType
image data to vector conversion.
Superclass::OutputImageType OutputImageType
void PrintSelf(std::ostream &os, itk::Indent indent) const override
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)
TOutputImage OutputImageType
itk::SmartPointer< Self > Pointer
itk::SmartPointer< const Self > ConstPointer