NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkInvertIntensityBetweenMaxAndMinImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: itkInvertIntensityBetweenMaxAndMinImageFilter.h
5  Language: C++
6  Date: $Date$
7  Version: $Revision$
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef itkInvertIntensityBetweenMaxAndMinImageFilter_h
18 #define itkInvertIntensityBetweenMaxAndMinImageFilter_h
19 
20 #include "itkUnaryFunctorImageFilter.h"
21 
22 namespace itk
23 {
24 
25 namespace Functor {
26 
27 template< typename TInput, typename TOutput>
29 {
30 public:
31  typedef typename NumericTraits< TInput >::RealType RealType;
33  m_Maximum = NumericTraits< TInput >::ZeroValue();
34  m_Minimum = NumericTraits< TInput >::ZeroValue();
35  }
37 
38  void SetMaximum( TOutput max ) { m_Maximum = max; }
39  void SetMinimum( TOutput min ) { m_Minimum = min; }
40 
42  {
43  if( ( m_Maximum != other.m_Maximum ) ||
44  ( m_Minimum != other.m_Minimum ) )
45  {
46  return true;
47  }
48  return false;
49  }
50 
52  {
53  return !(*this != other);
54  }
55 
56  inline TOutput operator()( const TInput & x ) const
57  {
58  TOutput result = static_cast<TOutput>( m_Maximum - x + m_Minimum );
59  return result;
60  }
61 private:
62  TInput m_Maximum;
63  TInput m_Minimum;
64 };
65 
66 } // end namespace functor
67 
68 
86 template <typename TInputImage, typename TOutputImage=TInputImage>
88  public
89  UnaryFunctorImageFilter<TInputImage,TOutputImage,
90  Functor::InvertIntensityBetweenMaxAndMinTransform<
91  typename TInputImage::PixelType,
92  typename TOutputImage::PixelType> >
93 {
94 public:
97  typedef UnaryFunctorImageFilter<TInputImage,TOutputImage,
99  typename TInputImage::PixelType,
101  typedef SmartPointer<Self> Pointer;
102  typedef SmartPointer<const Self> ConstPointer;
103 
105  typedef typename TInputImage::PixelType InputPixelType;
106  typedef typename NumericTraits<InputPixelType>::RealType RealType;
107 
109  itkNewMacro(Self);
110 
113  UnaryFunctorImageFilter);
114 
115  itkGetConstReferenceMacro( Maximum, InputPixelType );
116  itkGetConstReferenceMacro( Minimum, InputPixelType );
117 
119  void PrintSelf(std::ostream& os, Indent indent) const;
120 
122  void BeforeThreadedGenerateData(void);
123 
124 #ifdef ITK_USE_CONCEPT_CHECKING
125 
126  itkConceptMacro(InputHasNumericTraitsCheck,
127  (Concept::HasNumericTraits<InputPixelType>));
129 #endif
130 
131 protected:
134 
135 private:
136  InvertIntensityBetweenMaxAndMinImageFilter(const Self&); //purposely not implemented
137  void operator=(const Self&); //purposely not implemented
138 
139  InputPixelType m_Maximum;
140  InputPixelType m_Minimum;
141 };
142 
143 
144 
145 } // end namespace itk
146 
147 #ifndef ITK_MANUAL_INSTANTIATION
148 #include "itkInvertIntensityBetweenMaxAndMinImageFilter.txx"
149 #endif
150 
151 #endif
bool operator==(const InvertIntensityBetweenMaxAndMinTransform &other) const
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:51
bool operator!=(const InvertIntensityBetweenMaxAndMinTransform &other) const
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:41
SmartPointer< Self > Pointer
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:101
Definition: niftkITKAffineResampleImage.cxx:74
void SetMaximum(TOutput max)
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:38
GLuint64EXT * result
Definition: glew.h:12084
NumericTraits< InputPixelType >::RealType RealType
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:106
TOutputImage::PixelType OutputPixelType
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:104
Invert intensity of an image.
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:87
~InvertIntensityBetweenMaxAndMinTransform()
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:36
SmartPointer< const Self > ConstPointer
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:102
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:28
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
TOutput operator()(const TInput &x) const
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:56
TInputImage::PixelType InputPixelType
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:105
InvertIntensityBetweenMaxAndMinTransform()
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:32
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::InvertIntensityBetweenMaxAndMinTransform< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:100
virtual ~InvertIntensityBetweenMaxAndMinImageFilter()
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:133
void SetMinimum(TOutput min)
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:39
GLint GLint GLint GLint GLint x
Definition: glew.h:1236
InvertIntensityBetweenMaxAndMinImageFilter Self
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:96
NumericTraits< TInput >::RealType RealType
Definition: itkInvertIntensityBetweenMaxAndMinImageFilter.h:31