ITK  5.4.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 * https://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
24namespace itk
25{
26namespace Functor
27{
32template <typename TInput, typename TOutput>
33class Abs
34{
35public:
36 bool
37 operator==(const Abs &) const
38 {
39 return true;
40 }
41
43
44 inline TOutput
45 operator()(const TInput & A) const
46 {
47 return static_cast<TOutput>(itk::Math::abs(A));
48 }
49};
50} // namespace Functor
51
65template <typename TInputImage, typename TOutputImage>
66class ITK_TEMPLATE_EXPORT AbsImageFilter : public UnaryGeneratorImageFilter<TInputImage, TOutputImage>
67{
68public:
69 ITK_DISALLOW_COPY_AND_MOVE(AbsImageFilter);
70
77
79 itkNewMacro(Self);
80
82 itkOverrideGetNameOfClassMacro(AbsImageFilter);
83
84 using InputPixelType = typename TInputImage::PixelType;
85 using OutputPixelType = typename TOutputImage::PixelType;
86
87
88#ifdef ITK_USE_CONCEPT_CHECKING
89 // Begin concept checking
92 // End concept checking
93#endif
94
95protected:
97 {
98#if !defined(ITK_WRAPPING_PARSER)
99 Superclass::SetFunctor(FunctorType());
100#endif
101 }
102
103 ~AbsImageFilter() override = default;
104};
105} // end namespace itk
106
107#endif
Computes the absolute value of each pixel.
typename TInputImage::PixelType InputPixelType
~AbsImageFilter() override=default
typename TOutputImage::PixelType OutputPixelType
Computes the absolute value of a pixel.
TOutput operator()(const TInput &A) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Abs)
bool operator==(const Abs &) const
Base class for all process objects that output image data.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Implements pixel-wise generic "operation" on one image.
Functor::Add2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
#define itkConceptMacro(name, concept)
bool abs(bool x)
Definition: itkMath.h:844
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....