ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkInvertIntensityImageFilter.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 __itkInvertIntensityImageFilter_h
19 #define __itkInvertIntensityImageFilter_h
20 
22 
23 namespace itk
24 {
25 namespace Functor
26 {
32 template< typename TInput, typename TOutput >
34 {
35 public:
40 
41  void SetMaximum(TOutput max) { m_Maximum = max; }
42 
43  bool operator!=(const InvertIntensityTransform & other) const
44  {
45  if ( m_Maximum != other.m_Maximum )
46  {
47  return true;
48  }
49  return false;
50  }
51 
52  bool operator==(const InvertIntensityTransform & other) const
53  {
54  return !( *this != other );
55  }
56 
57  inline TOutput operator()(const TInput & x) const
58  {
59  TOutput result = static_cast< TOutput >( m_Maximum - x );
60 
61  return result;
62  }
63 
64 private:
65  TInput m_Maximum;
66 };
67 } // end namespace functor
68 
89 template< typename TInputImage, typename TOutputImage = TInputImage >
91  public
92  UnaryFunctorImageFilter< TInputImage, TOutputImage,
93  Functor::InvertIntensityTransform<
94  typename TInputImage::PixelType,
95  typename TOutputImage::PixelType > >
96 {
97 public:
100  typedef UnaryFunctorImageFilter< TInputImage, TOutputImage,
102  typename TInputImage::PixelType,
103  typename TOutputImage::PixelType > > Superclass;
106 
107  typedef typename TOutputImage::PixelType OutputPixelType;
108  typedef typename TInputImage::PixelType InputPixelType;
110 
112  itkNewMacro(Self);
113 
115  itkTypeMacro(InvertIntensityImageFilter,
117 
118  itkSetMacro(Maximum, InputPixelType);
119  itkGetConstReferenceMacro(Maximum, InputPixelType);
120 
122  void PrintSelf(std::ostream & os, Indent indent) const;
123 
125  void BeforeThreadedGenerateData(void);
126 
127 #ifdef ITK_USE_CONCEPT_CHECKING
128  // Begin concept checking
129  itkConceptMacro( InputHasNumericTraitsCheck,
131  // End concept checking
132 #endif
133 
134 protected:
137 
138 private:
139  InvertIntensityImageFilter(const Self &); //purposely not implemented
140  void operator=(const Self &); //purposely not implemented
141 
143 };
144 } // end namespace itk
145 
146 #ifndef ITK_MANUAL_INSTANTIATION
147 #include "itkInvertIntensityImageFilter.hxx"
148 #endif
149 
150 #endif
bool operator!=(const InvertIntensityTransform &other) const
void operator=(const Self &)
Base class for all process objects that output image data.
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::InvertIntensityTransform< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
static T max(const T &)
void PrintSelf(std::ostream &os, Indent indent) const
Implements pixel-wise generic operation on one image.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Define additional traits for native types such as int or float.
#define itkConceptMacro(name, concept)
Invert the intensity of an image.
bool operator==(const InvertIntensityTransform &other) const
NumericTraits< InputPixelType >::RealType RealType