ITK  5.2.0
Insight Toolkit
itkAbsImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkAbsImageFilter_h
19 #define itkAbsImageFilter_h
20 
22 #include "itkConceptChecking.h"
23 
24 namespace itk
25 {
26 namespace Functor
27 {
32 template <typename TInput, typename TOutput>
33 class Abs
34 {
35 public:
36  Abs() = default;
37  ~Abs() = default;
38  bool
39  operator!=(const Abs &) const
40  {
41  return false;
42  }
43 
44  bool
45  operator==(const Abs & other) const
46  {
47  return !(*this != other);
48  }
49 
50  inline TOutput
51  operator()(const TInput & A) const
52  {
53  return static_cast<TOutput>(itk::Math::abs(A));
54  }
55 };
56 } // namespace Functor
57 
71 template <typename TInputImage, typename TOutputImage>
72 class AbsImageFilter : public UnaryGeneratorImageFilter<TInputImage, TOutputImage>
73 {
74 public:
75  ITK_DISALLOW_COPY_AND_MOVE(AbsImageFilter);
76 
83 
85  itkNewMacro(Self);
86 
89 
90  using InputPixelType = typename TInputImage::PixelType;
91  using OutputPixelType = typename TOutputImage::PixelType;
92 
93 
94 #ifdef ITK_USE_CONCEPT_CHECKING
95  // Begin concept checking
98  // End concept checking
99 #endif
100 
101 protected:
103  {
104 #if !defined(ITK_WRAPPING_PARSER)
106 #endif
107  }
108 
109  ~AbsImageFilter() override = default;
110 };
111 } // end namespace itk
112 
113 #endif
itk::AbsImageFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkAbsImageFilter.h:90
itk::AbsImageFilter::~AbsImageFilter
~AbsImageFilter() override=default
itk::Functor::Abs::operator!=
bool operator!=(const Abs &) const
Definition: itkAbsImageFilter.h:39
itk::AbsImageFilter::AbsImageFilter
AbsImageFilter()
Definition: itkAbsImageFilter.h:102
itk::Concept::GreaterThanComparable
Definition: itkConceptChecking.h:284
itk::UnaryGeneratorImageFilter::SetFunctor
void SetFunctor(const std::function< ConstRefFunctionType > &f)
Definition: itkUnaryGeneratorImageFilter.h:92
itkConceptChecking.h
itk::UnaryGeneratorImageFilter
Implements pixel-wise generic "operation" on one image.
Definition: itkUnaryGeneratorImageFilter.h:55
itk::SmartPointer< Self >
itk::Functor::Abs
Computes the absolute value of a pixel.
Definition: itkAbsImageFilter.h:33
itkUnaryGeneratorImageFilter.h
itk::Functor::Abs::~Abs
~Abs()=default
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::Abs::operator()
TOutput operator()(const TInput &A) const
Definition: itkAbsImageFilter.h:51
itk::Functor::Abs::Abs
Abs()=default
itk::Functor::Abs::operator==
bool operator==(const Abs &other) const
Definition: itkAbsImageFilter.h:45
itk::AbsImageFilter
Computes the absolute value of each pixel.
Definition: itkAbsImageFilter.h:72
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::AbsImageFilter::FunctorType
Functor::Abs< typename TInputImage::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkAbsImageFilter.h:82
itk::AbsImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkAbsImageFilter.h:91