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

itkBinaryThresholdImageFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBinaryThresholdImageFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/12/12 22:07:23 $
00007   Version:   $Revision: 1.8 $
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 _itkBinaryThresholdImageFunction_h
00018 #define _itkBinaryThresholdImageFunction_h
00019 
00020 #include "itkImageFunction.h"
00021 
00022 namespace itk
00023 {
00024 
00040 template <class TInputImage, class TCoordRep = float>
00041 class ITK_EXPORT BinaryThresholdImageFunction : 
00042   public ImageFunction<TInputImage,bool,TCoordRep> 
00043 {
00044 public:
00046   typedef BinaryThresholdImageFunction Self;
00047   typedef ImageFunction<TInputImage,bool,TCoordRep> Superclass;
00048   typedef SmartPointer<Self> Pointer;
00049   typedef SmartPointer<const Self>  ConstPointer;
00050   
00052   itkTypeMacro(BinaryThresholdImageFunction, ImageFunction);
00053 
00055   itkNewMacro(Self);
00056 
00058   typedef typename Superclass::InputImageType InputImageType;
00059   
00061   typedef typename TInputImage::PixelType PixelType;
00062 
00064   itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00065 
00067   typedef typename Superclass::PointType PointType;
00068 
00070   typedef typename Superclass::IndexType IndexType;
00071 
00073   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00074 
00084   virtual bool Evaluate( const PointType& point ) const
00085     {
00086     IndexType index;
00087     this->ConvertPointToNearestIndex( point, index );
00088     return ( this->EvaluateAtIndex( index ) );
00089     }
00090 
00099   virtual bool EvaluateAtContinuousIndex( 
00100     const ContinuousIndexType & index ) const
00101     {
00102       IndexType nindex;
00103 
00104       this->ConvertContinuousIndexToNearestIndex (index, nindex);
00105       return this->EvaluateAtIndex(nindex);
00106     }
00107 
00116   virtual bool EvaluateAtIndex( const IndexType & index ) const
00117     {
00118     PixelType value = this->GetInputImage()->GetPixel(index);
00119     return ( m_Lower <= value && value <= m_Upper);
00120     }
00121 
00123   itkGetConstReferenceMacro(Lower,PixelType);
00124 
00126   itkGetConstReferenceMacro(Upper,PixelType);
00127 
00129   void ThresholdAbove(PixelType thresh);
00130   
00132   void ThresholdBelow(PixelType thresh);
00133 
00135   void ThresholdBetween(PixelType lower, PixelType upper);
00136 
00137 protected:
00138   BinaryThresholdImageFunction();
00139   ~BinaryThresholdImageFunction(){};
00140   void PrintSelf(std::ostream& os, Indent indent) const;
00141 
00142 private:
00143   BinaryThresholdImageFunction( const Self& ); //purposely not implemented
00144   void operator=( const Self& ); //purposely not implemented
00145 
00146   PixelType m_Lower;
00147   PixelType m_Upper;
00148 };
00149 
00150 } // namespace itk
00151 
00152 #ifndef ITK_MANUAL_INSTANTIATION
00153 #include "itkBinaryThresholdImageFunction.txx"
00154 #endif
00155 
00156 #endif

Generated at Wed May 24 22:50:55 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000