Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkInvertIntensityImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkInvertIntensityImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-01 14:36:25 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkInvertIntensityImageFilter_h
00018 #define __itkInvertIntensityImageFilter_h
00019 
00020 #include "itkUnaryFunctorImageFilter.h"
00021 
00022 namespace itk
00023 {
00024 
00025 namespace Functor {  
00026  
00027 template< typename TInput, typename  TOutput>
00028 class InvertIntensityTransform
00029 {
00030 public:
00031   typedef typename NumericTraits< TInput >::RealType RealType;
00032   InvertIntensityTransform() {m_Maximum = NumericTraits< TInput >::max();}
00033   ~InvertIntensityTransform() {}
00034 
00035   void SetMaximum( TOutput max ) { m_Maximum = max; }
00036 
00037   bool operator!=( const InvertIntensityTransform & other ) const
00038     {
00039     if( m_Maximum != other.m_Maximum )
00040       {
00041       return true;
00042       }
00043     return false;
00044     }
00045 
00046   bool operator==( const InvertIntensityTransform & other ) const
00047     {
00048     return !(*this != other);
00049     }
00050 
00051   inline TOutput operator()( const TInput & x ) const
00052     {
00053     TOutput  result = static_cast<TOutput>( m_Maximum - x );
00054     return result;
00055     }
00056 private:
00057   TInput  m_Maximum;
00058 }; 
00059 
00060 }  // end namespace functor
00061 
00062 
00078 template <typename  TInputImage, typename  TOutputImage=TInputImage>
00079 class ITK_EXPORT InvertIntensityImageFilter :
00080     public
00081     UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00082                             Functor::InvertIntensityTransform< 
00083   typename TInputImage::PixelType, 
00084   typename TOutputImage::PixelType>   >
00085 {
00086 public:
00088   typedef InvertIntensityImageFilter    Self;
00089   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00090                                   Functor::InvertIntensityTransform< 
00091     typename TInputImage::PixelType, 
00092     typename TOutputImage::PixelType> > Superclass;
00093   typedef SmartPointer<Self>            Pointer;
00094   typedef SmartPointer<const Self>      ConstPointer;
00095 
00096   typedef typename TOutputImage::PixelType                 OutputPixelType;
00097   typedef typename TInputImage::PixelType                  InputPixelType;
00098   typedef typename NumericTraits<InputPixelType>::RealType RealType;
00099 
00101   itkNewMacro(Self);
00102 
00104   itkTypeMacro(InvertIntensityImageFilter, 
00105                UnaryFunctorImageFilter);
00106 
00107   itkSetMacro( Maximum, InputPixelType );
00108   itkGetConstReferenceMacro( Maximum, InputPixelType );
00109 
00111   void PrintSelf(std::ostream& os, Indent indent) const;
00112 
00114   void BeforeThreadedGenerateData(void);
00115 
00116 #ifdef ITK_USE_CONCEPT_CHECKING
00117 
00118   itkConceptMacro(InputHasNumericTraitsCheck,
00119                   (Concept::HasNumericTraits<InputPixelType>));
00120 
00122 #endif
00123 
00124 protected:
00125   InvertIntensityImageFilter();
00126   virtual ~InvertIntensityImageFilter() {};
00127 
00128 private:
00129   InvertIntensityImageFilter(const Self&); //purposely not implemented
00130   void operator=(const Self&); //purposely not implemented
00131 
00132   InputPixelType        m_Maximum;
00133 };
00134 
00135 
00136   
00137 } // end namespace itk
00138   
00139 #ifndef ITK_MANUAL_INSTANTIATION
00140 #include "itkInvertIntensityImageFilter.txx"
00141 #endif
00142   
00143 #endif
00144 

Generated at Fri Apr 16 18:47:16 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000