OTB  10.0.0
Orfeo Toolbox
otbComplexToIntensityImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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  using Superclass = itk::UnaryFunctorImageFilter<TInputImage, TOutputImage,
77  using Pointer = itk::SmartPointer<Self>;
78  using ConstPointer = itk::SmartPointer<const Self>;
79 
81  itkNewMacro(Self);
82 
84  itkTypeMacro(ComplexToIntensityImageFilter, UnaryFunctorImageFilter);
85 
86  using InputPixelType = typename TInputImage::PixelType;
87  using OutputPixelType = typename TOutputImage::PixelType;
88  using InputPixelValueType = typename itk::NumericTraits<InputPixelType>::ValueType;
89 
90 #ifdef ITK_USE_CONCEPT_CHECKING
92  itkConceptMacro(InputConvertibleToOutputCheck, (itk::Concept::Convertible<InputPixelValueType, OutputPixelType>));
93 
95 #endif
96 
97 
98 protected:
100  ~ComplexToIntensityImageFilter() override = default;
101 
102 private:
104  void operator=(const Self&) = delete;
105 };
106 
107 } // end namespace otb
108 
109 #endif
Computes pixel-wise the intensity of a complex image.
typename itk::NumericTraits< InputPixelType >::ValueType InputPixelValueType
void operator=(const Self &)=delete
typename TOutputImage::PixelType OutputPixelType
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, Function::ComplexToIntensity< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
~ComplexToIntensityImageFilter() override=default
ComplexToIntensityImageFilter(const Self &)=delete
typename TInputImage::PixelType InputPixelType
bool operator==(const ComplexToIntensity &other) const
bool operator!=(const ComplexToIntensity &) const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.