OTB  7.4.0
Orfeo Toolbox
otbVectorImageToAmplitudeImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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 otbVectorImageToAmplitudeImageFilter_h
22 #define otbVectorImageToAmplitudeImageFilter_h
23 
24 #include "itkUnaryFunctorImageFilter.h"
25 #include "otbMath.h"
26 #include "itkConceptChecking.h"
27 
28 namespace otb
29 {
30 namespace Functor
31 {
32 template <class TInput, class TOutput>
34 {
35 public:
37  {
38  }
40  {
41  }
42 
43  inline TOutput operator()(const TInput& A)
44  {
45  return static_cast<TOutput>(A.GetNorm());
46  }
47 
48  itkConceptMacro(OutputShouldNotBeVectorImageCheck, (itk::Concept::Convertible<TOutput, double>));
49 
50 }; // end namespace Functor
51 }
52 
62 template <class TInputImage, class TOutputImage>
64  : public itk::UnaryFunctorImageFilter<TInputImage, TOutputImage,
65  Functor::VectorToAmplitudeFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
66 {
67 public:
70  typedef itk::UnaryFunctorImageFilter<TInputImage, TOutputImage,
73  typedef itk::SmartPointer<Self> Pointer;
74  typedef itk::SmartPointer<const Self> ConstPointer;
75 
77  itkNewMacro(Self);
78 
80  itkTypeMacro(VectorImageToAmplitudeImageFilter, UnaryFunctorImageFilter);
81 
82 protected:
85 
88  {
89  }
90 
92  void PrintSelf(std::ostream& os, itk::Indent indent) const override
93  {
94  Superclass::PrintSelf(os, indent);
95  }
96 
97 private:
98  VectorImageToAmplitudeImageFilter(const Self&) = delete;
99  void operator=(const Self&) = delete;
100 };
101 
102 } // End namespace otb
103 #endif
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::VectorToAmplitudeFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
This filter returns the the amplitude of the pixel vector.