OTB  9.0.0
Orfeo Toolbox
otbRealAndImaginaryImageToComplexImageFilter.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 #ifndef otbRealAndImaginaryImageToComplexImageFilter_h
22 #define otbRealAndImaginaryImageToComplexImageFilter_h
23 
24 #include "itkBinaryFunctorImageFilter.h"
25 #include "vnl/vnl_math.h"
26 
27 namespace otb
28 {
29 
39 namespace Function
40 {
41 
42 template <class TInputImageRealPart, class TInputImageImaginaryPart, class TOutput>
44 {
45 public:
46  typedef typename TOutput::value_type OutputValueType;
47 
49  {
50  }
52  {
53  }
55  {
56  return false;
57  }
58  bool operator==(const RealAndImaginaryToComplex& other) const
59  {
60  return !(*this != other);
61  }
62  inline TOutput operator()(const TInputImageRealPart& real, const TInputImageImaginaryPart& imaginary) const
63  {
64  return TOutput(static_cast<OutputValueType>(real), static_cast<OutputValueType>(imaginary));
65  }
66 };
67 }
68 
69 template <class TInputImageRealPart, class TInputImageImaginaryPart, class TOutputImage>
71  : public itk::BinaryFunctorImageFilter<TInputImageRealPart, TInputImageImaginaryPart, TOutputImage,
72  Function::RealAndImaginaryToComplex<typename TInputImageRealPart::PixelType,
73  typename TInputImageImaginaryPart::PixelType, typename TOutputImage::PixelType>>
74 {
75 public:
78  typedef itk::BinaryFunctorImageFilter<TInputImageRealPart, TInputImageImaginaryPart, TOutputImage,
79  Function::RealAndImaginaryToComplex<typename TInputImageRealPart::PixelType,
80  typename TInputImageImaginaryPart::PixelType, typename TOutputImage::PixelType>>
82  typedef itk::SmartPointer<Self> Pointer;
83  typedef itk::SmartPointer<const Self> ConstPointer;
84 
86  itkNewMacro(Self);
87 
90 
91  typedef typename TInputImageRealPart::PixelType InputRealPartPixelType;
92  typedef typename TInputImageImaginaryPart::PixelType InputImaginaryPartPixelType;
93  typedef typename TOutputImage::PixelType OutputPixelType;
94  typedef typename itk::NumericTraits<OutputPixelType>::ValueType OutputPixelValueType;
95 
96  //#ifdef ITK_USE_CONCEPT_CHECKING
98  // itkConceptMacro(InputConvertibleToOutputCheck,
99  // (Concept::Convertible<InputRealPartPixelType, OutputPixelValueType>));
100  // itkConceptMacro(InputConvertibleToOutputCheck,
101  // (Concept::Convertible<InputImaginaryPartPixelType, OutputPixelValueType>));
102 
104  //#endif
105 
106  void SetInputRealPart(const TInputImageRealPart* imageRealPart)
107  {
108  this->SetInput1(imageRealPart);
109  }
110 
111  void SetInputImaginaryPart(const TInputImageImaginaryPart* imageImaginaryPart)
112  {
113  this->SetInput2(imageImaginaryPart);
114  }
115 
116 protected:
118  {
119  }
121  {
122  }
123 
124 private:
125  RealAndImaginaryImageToComplexImageFilter(const Self&) = delete;
126  void operator=(const Self&) = delete;
127 };
128 
129 } // end namespace otb
130 
131 #endif
otb::BinaryFunctorImageFilter
Implements pixel-wise generic operation on two images.
Definition: otbBinaryFunctorImageFilter.h:44
otb::RealAndImaginaryImageToComplexImageFilter
Computes pixel-wise the complex image of a real and imaginary image.
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:70
otb::Function::RealAndImaginaryToComplex::operator!=
bool operator!=(const RealAndImaginaryToComplex &) const
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:54
otb::RealAndImaginaryImageToComplexImageFilter::OutputPixelType
TOutputImage::PixelType OutputPixelType
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:93
otb::RealAndImaginaryImageToComplexImageFilter::Superclass
itk::BinaryFunctorImageFilter< TInputImageRealPart, TInputImageImaginaryPart, TOutputImage, Function::RealAndImaginaryToComplex< typename TInputImageRealPart::PixelType, typename TInputImageImaginaryPart::PixelType, typename TOutputImage::PixelType > > Superclass
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:81
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Function::RealAndImaginaryToComplex::RealAndImaginaryToComplex
RealAndImaginaryToComplex()
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:48
otb::RealAndImaginaryImageToComplexImageFilter::OutputPixelValueType
itk::NumericTraits< OutputPixelType >::ValueType OutputPixelValueType
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:94
otb::RealAndImaginaryImageToComplexImageFilter::RealAndImaginaryImageToComplexImageFilter
RealAndImaginaryImageToComplexImageFilter()
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:117
otb::Function::RealAndImaginaryToComplex::OutputValueType
TOutput::value_type OutputValueType
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:46
otb::RealAndImaginaryImageToComplexImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:83
otb::Function::RealAndImaginaryToComplex::~RealAndImaginaryToComplex
~RealAndImaginaryToComplex()
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:51
otb::RealAndImaginaryImageToComplexImageFilter::Self
RealAndImaginaryImageToComplexImageFilter Self
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:77
otb::Function::RealAndImaginaryToComplex::operator==
bool operator==(const RealAndImaginaryToComplex &other) const
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:58
otb::RealAndImaginaryImageToComplexImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:82
otb::RealAndImaginaryImageToComplexImageFilter::InputImaginaryPartPixelType
TInputImageImaginaryPart::PixelType InputImaginaryPartPixelType
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:92
otb::RealAndImaginaryImageToComplexImageFilter::~RealAndImaginaryImageToComplexImageFilter
~RealAndImaginaryImageToComplexImageFilter() override
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:120
otb::RealAndImaginaryImageToComplexImageFilter::SetInputRealPart
void SetInputRealPart(const TInputImageRealPart *imageRealPart)
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:106
otb::Function::RealAndImaginaryToComplex
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:43
otb::Function::RealAndImaginaryToComplex::operator()
TOutput operator()(const TInputImageRealPart &real, const TInputImageImaginaryPart &imaginary) const
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:62
otb::RealAndImaginaryImageToComplexImageFilter::SetInputImaginaryPart
void SetInputImaginaryPart(const TInputImageImaginaryPart *imageImaginaryPart)
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:111
otb::RealAndImaginaryImageToComplexImageFilter::InputRealPartPixelType
TInputImageRealPart::PixelType InputRealPartPixelType
Definition: otbRealAndImaginaryImageToComplexImageFilter.h:89