OTB  9.0.0
Orfeo Toolbox
otbComplexToIntensityImageFilter.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 otbComplexToIntensityImageFilter_h
22 #define otbComplexToIntensityImageFilter_h
23 
24 #include "itkUnaryFunctorImageFilter.h"
25 #include "vnl/vnl_math.h"
26 
27 namespace otb
28 {
29 
39 namespace Function
40 {
41 
42 template <class TInput, class TOutput>
44 {
45 public:
47  {
48  }
50  {
51  }
52  bool operator!=(const ComplexToIntensity&) const
53  {
54  return false;
55  }
56  bool operator==(const ComplexToIntensity& other) const
57  {
58  return !(*this != other);
59  }
60  inline TOutput operator()(const TInput& A) const
61  {
62  return static_cast<TOutput>(A.real() * A.real() + A.imag() * A.imag());
63  }
64 };
65 }
66 
67 template <class TInputImage, class TOutputImage>
69  : public itk::UnaryFunctorImageFilter<TInputImage, TOutputImage,
70  Function::ComplexToIntensity<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
71 {
72 public:
75  typedef itk::UnaryFunctorImageFilter<TInputImage, TOutputImage,
78  typedef itk::SmartPointer<Self> Pointer;
79  typedef itk::SmartPointer<const Self> ConstPointer;
80 
82  itkNewMacro(Self);
83 
85  itkTypeMacro(ComplexToIntensityImageFilter, UnaryFunctorImageFilter);
86 
87  typedef typename TInputImage::PixelType InputPixelType;
88  typedef typename TOutputImage::PixelType OutputPixelType;
89  typedef typename itk::NumericTraits<InputPixelType>::ValueType InputPixelValueType;
90 
91 #ifdef ITK_USE_CONCEPT_CHECKING
92 
93  itkConceptMacro(InputConvertibleToOutputCheck, (itk::Concept::Convertible<InputPixelValueType, OutputPixelType>));
94 
96 #endif
97 
98 
99 protected:
101  {
102  }
104  {
105  }
106 
107 private:
108  ComplexToIntensityImageFilter(const Self&) = delete;
109  void operator=(const Self&) = delete;
110 };
111 
112 } // end namespace otb
113 
114 #endif
otb::ComplexToIntensityImageFilter::ComplexToIntensityImageFilter
ComplexToIntensityImageFilter()
Definition: otbComplexToIntensityImageFilter.h:100
otb::ComplexToIntensityImageFilter
Computes pixel-wise the intensity of a complex image.
Definition: otbComplexToIntensityImageFilter.h:68
otb::ComplexToIntensityImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbComplexToIntensityImageFilter.h:78
otb::ComplexToIntensityImageFilter::OutputPixelType
TOutputImage::PixelType OutputPixelType
Definition: otbComplexToIntensityImageFilter.h:88
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ComplexToIntensityImageFilter::InputPixelValueType
itk::NumericTraits< InputPixelType >::ValueType InputPixelValueType
Definition: otbComplexToIntensityImageFilter.h:89
otb::ComplexToIntensityImageFilter::Self
ComplexToIntensityImageFilter Self
Definition: otbComplexToIntensityImageFilter.h:74
otb::ComplexToIntensityImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbComplexToIntensityImageFilter.h:79
otb::ComplexToIntensityImageFilter::InputPixelType
TInputImage::PixelType InputPixelType
Definition: otbComplexToIntensityImageFilter.h:85
otb::Function::ComplexToIntensity::operator!=
bool operator!=(const ComplexToIntensity &) const
Definition: otbComplexToIntensityImageFilter.h:52
otb::Function::ComplexToIntensity::~ComplexToIntensity
~ComplexToIntensity()
Definition: otbComplexToIntensityImageFilter.h:49
otb::Function::ComplexToIntensity
Definition: otbComplexToIntensityImageFilter.h:43
otb::ComplexToIntensityImageFilter::Superclass
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, Function::ComplexToIntensity< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
Definition: otbComplexToIntensityImageFilter.h:77
otb::ComplexToIntensityImageFilter::~ComplexToIntensityImageFilter
~ComplexToIntensityImageFilter() override
Definition: otbComplexToIntensityImageFilter.h:103
otb::Function::ComplexToIntensity::operator()
TOutput operator()(const TInput &A) const
Definition: otbComplexToIntensityImageFilter.h:60
otb::Function::ComplexToIntensity::ComplexToIntensity
ComplexToIntensity()
Definition: otbComplexToIntensityImageFilter.h:46
otb::Function::ComplexToIntensity::operator==
bool operator==(const ComplexToIntensity &other) const
Definition: otbComplexToIntensityImageFilter.h:56