OTB  7.1.0
Orfeo Toolbox
otbComplexToIntensityImageFilter.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 #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
bool operator==(const ComplexToIntensity &other) const
Computes pixel-wise the intensity of a complex image.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, Function::ComplexToIntensity< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
bool operator!=(const ComplexToIntensity &) const
itk::NumericTraits< InputPixelType >::ValueType InputPixelValueType