ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkAbsImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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() {}
37  ~Abs() {}
38  bool operator!=(const Abs &) const
39  {
40  return false;
41  }
42 
43  bool operator==(const Abs & other) const
44  {
45  return !( *this != other );
46  }
47 
48  inline TOutput operator()(const TInput & A) const
49  {
50  return static_cast<TOutput>( vnl_math_abs( A ) );
51  }
52 };
53 }
54 
68 template< typename TInputImage, typename TOutputImage >
70  public
71  UnaryFunctorImageFilter< TInputImage, TOutputImage,
72  Functor::Abs<
73  typename TInputImage::PixelType,
74  typename TOutputImage::PixelType > >
75 {
76 public:
79  typedef UnaryFunctorImageFilter< TInputImage, TOutputImage,
80  Functor::Abs< typename TInputImage::PixelType,
81  typename TOutputImage::PixelType > > Superclass;
84 
86  itkNewMacro(Self);
87 
89  itkTypeMacro(AbsImageFilter,
91 
92  typedef typename TInputImage::PixelType InputPixelType;
93  typedef typename TOutputImage::PixelType OutputPixelType;
94 
95 #ifdef ITK_USE_CONCEPT_CHECKING
96  // Begin concept checking
97  itkConceptMacro( ConvertibleCheck,
99  itkConceptMacro( InputGreaterThanIntCheck,
101  // End concept checking
102 #endif
103 
104 protected:
106  virtual ~AbsImageFilter() {}
107 
108 private:
109  AbsImageFilter(const Self &) ITK_DELETE_FUNCTION;
110  void operator=(const Self &) ITK_DELETE_FUNCTION;
111 };
112 } // end namespace itk
113 
114 #endif
bool operator==(const Abs &other) const
TInputImage::PixelType InputPixelType
TOutput operator()(const TInput &A) const
Base class for all process objects that output image data.
SmartPointer< const Self > ConstPointer
bool operator!=(const Abs &) const
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::Abs< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
Implements pixel-wise generic operation on one image.
Computes the absolute value of each pixel.
Computes the absolute value of a pixel.
#define itkConceptMacro(name, concept)
SmartPointer< Self > Pointer
TOutputImage::PixelType OutputPixelType