NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkNegateImageFilter.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkNegateImageFilter_h
16 #define itkNegateImageFilter_h
17 
18 #include <itkUnaryFunctorImageFilter.h>
19 #include <itkConceptChecking.h>
20 
21 namespace itk
22 {
23 
29 namespace Functor {
30 
31 template< typename TInput, typename TOutput>
32 class Negate
33 {
34 public:
35  Negate() {}
36  ~Negate() {}
37  bool operator!=( const Negate & ) const
38  {
39  return false;
40  }
41  bool operator==( const Negate & other ) const
42  {
43  return !(*this != other);
44  }
45  inline TOutput operator()( const TInput & A ) const
46  {
47  return -static_cast<TOutput>( A );
48  }
49 };
50 }
51 
52 template <typename TInputImage, typename TOutputImage>
53 class ITK_EXPORT NegateImageFilter :
54  public
55 UnaryFunctorImageFilter<TInputImage,TOutputImage,
56  Functor::Negate<
57  typename TInputImage::PixelType,
58  typename TOutputImage::PixelType> >
59 {
60 public:
63  typedef UnaryFunctorImageFilter<TInputImage,TOutputImage,
66  typedef SmartPointer<Self> Pointer;
67  typedef SmartPointer<const Self> ConstPointer;
68 
70  itkNewMacro(Self);
71 
73  itkTypeMacro(NegateImageFilter,
74  UnaryFunctorImageFilter);
75 
76 protected:
78  virtual ~NegateImageFilter() {}
79 
80 private:
81  NegateImageFilter(const Self&); //purposely not implemented
82  void operator=(const Self&); //purposely not implemented
83 
84 };
85 
86 } // end namespace itk
87 
88 
89 #endif
Definition: itkNegateImageFilter.h:32
SmartPointer< Self > Pointer
Definition: itkNegateImageFilter.h:66
Definition: niftkITKAffineResampleImage.cxx:74
~Negate()
Definition: itkNegateImageFilter.h:36
bool operator==(const Negate &other) const
Definition: itkNegateImageFilter.h:41
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
NegateImageFilter()
Definition: itkNegateImageFilter.h:77
Negate()
Definition: itkNegateImageFilter.h:35
virtual ~NegateImageFilter()
Definition: itkNegateImageFilter.h:78
SmartPointer< const Self > ConstPointer
Definition: itkNegateImageFilter.h:67
bool operator!=(const Negate &) const
Definition: itkNegateImageFilter.h:37
Computes the -1.0 * x pixel-wise.
Definition: itkNegateImageFilter.h:53
TOutput operator()(const TInput &A) const
Definition: itkNegateImageFilter.h:45
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::Negate< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
Definition: itkNegateImageFilter.h:65
NegateImageFilter Self
Definition: itkNegateImageFilter.h:62