OTB  7.1.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-2019 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
void SetInput(const InputImageType *input) override
void SetVectorInput(const VectorInputImageType *input)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.