OTB  9.0.0
Orfeo Toolbox
otbImageAndVectorImageOperationFilter.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbImageAndVectorImageOperationFilter_hxx
23 #define otbImageAndVectorImageOperationFilter_hxx
24 
26 #include "itkObjectFactory.h"
27 
28 namespace otb
29 {
30 
31 template <class TInputImage, class TVectorInputImage, class TOutputImage>
33 {
34  this->UseAddition();
35 }
36 
37 template <class TInputImage, class TVectorInputImage, class TOutputImage>
39 {
40 }
41 
42 template <class TInputImage, class TVectorInputImage, class TOutputImage>
44 {
45  this->SetNthInput(0, const_cast<InputImageType*>(input));
46 }
47 
48 template <class TInputImage, class TVectorInputImage, class TOutputImage>
50 {
51  this->SetNthInput(1, const_cast<VectorInputImageType*>(input));
52 }
53 
54 template <class TInputImage, class TVectorInputImage, class TOutputImage>
57 {
58  if (this->GetNumberOfInputs() < 1)
59  return 0;
60 
61  return dynamic_cast<const InputImageType*>(this->GetInput(0));
62 }
63 
64 template <class TInputImage, class TVectorInputImage, class TOutputImage>
67 {
68  if (this->GetNumberOfInputs() < 2)
69  return nullptr;
70 
71  return dynamic_cast<const VectorInputImageType*>(this->itk::ProcessObject::GetInput(1));
72 }
76 template <class TInputImage, class TVectorInputImage, class TOutputImage>
78 {
79  // call the superclass' implementation of this method
80  Superclass::GenerateOutputInformation();
81  this->GetOutput()->SetNumberOfComponentsPerPixel(this->GetVectorInput()->GetNumberOfComponentsPerPixel());
82 }
84 
85 } // end namespace otb
86 
87 #endif
otbImageAndVectorImageOperationFilter.h
otb::ImageAndVectorImageOperationFilter::~ImageAndVectorImageOperationFilter
~ImageAndVectorImageOperationFilter() override
Definition: otbImageAndVectorImageOperationFilter.hxx:38
otb::ImageAndVectorImageOperationFilter::GetInput
const InputImageType * GetInput()
Definition: otbImageAndVectorImageOperationFilter.hxx:56
otb::ImageAndVectorImageOperationFilter::SetVectorInput
void SetVectorInput(const VectorInputImageType *input)
Definition: otbImageAndVectorImageOperationFilter.hxx:49
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ImageAndVectorImageOperationFilter::ImageAndVectorImageOperationFilter
ImageAndVectorImageOperationFilter()
Definition: otbImageAndVectorImageOperationFilter.hxx:32
otb::ImageAndVectorImageOperationFilter::VectorInputImageType
TVectorInputImage VectorInputImageType
Definition: otbImageAndVectorImageOperationFilter.h:152
otb::ImageAndVectorImageOperationFilter::InputImageType
TInputImage InputImageType
Definition: otbImageAndVectorImageOperationFilter.h:147
otb::ImageAndVectorImageOperationFilter::GenerateOutputInformation
void GenerateOutputInformation() override
Definition: otbImageAndVectorImageOperationFilter.hxx:77
otb::ImageAndVectorImageOperationFilter::GetVectorInput
const VectorInputImageType * GetVectorInput()
Definition: otbImageAndVectorImageOperationFilter.hxx:66
otb::ImageAndVectorImageOperationFilter::SetInput
void SetInput(const InputImageType *input) override
Definition: otbImageAndVectorImageOperationFilter.hxx:43