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

itkLabelPerimeterEstimationCalculator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLabelPerimeterEstimationCalculator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-07-30 18:25:06 $
00007   Version:   $Revision: 1.1 $
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 __itkLabelPerimeterEstimationCalculator_h
00018 #define __itkLabelPerimeterEstimationCalculator_h
00019 
00020 #include "itkObject.h"
00021 
00022 namespace itk {
00023 
00038 template<class TInputImage>
00039 class ITK_EXPORT LabelPerimeterEstimationCalculator : 
00040     public Object
00041 {
00042 public:
00044   typedef LabelPerimeterEstimationCalculator Self;
00045   typedef Object                             Superclass;
00046   typedef SmartPointer<Self>                 Pointer;
00047   typedef SmartPointer<const Self>           ConstPointer;
00048 
00050   typedef TInputImage                             InputImageType;
00051   typedef typename InputImageType::Pointer        InputImagePointer;
00052   typedef typename InputImageType::ConstPointer   InputImageConstPointer;
00053   typedef typename InputImageType::RegionType     InputImageRegionType;
00054   typedef typename InputImageType::PixelType      InputImagePixelType;
00055 
00056   typedef typename InputImageType::RegionType     RegionType;
00057   typedef typename InputImageType::SizeType       SizeType;
00058   typedef typename InputImageType::IndexType      IndexType;
00059   
00060   typedef typename std::map< InputImagePixelType, double > PerimetersType;
00061   
00063   itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
00064 
00066   itkNewMacro(Self);  
00067 
00069   itkTypeMacro(LabelPerimeterEstimationCalculator, Object);
00070 
00077   itkSetMacro(FullyConnected, bool);
00078   itkGetConstReferenceMacro(FullyConnected, bool);
00079   itkBooleanMacro(FullyConnected);
00081 
00082   void SetImage( const InputImageType * img )
00083     {
00084     m_Image = img;
00085     }
00086 
00087   const InputImageType * GetImage() const
00088     {
00089     return m_Image;
00090     }
00091     
00092   void Compute();
00093   
00094   const PerimetersType & GetPerimeters() const
00095     {
00096     return m_Perimeters;
00097     }
00098     
00099   const double & GetPerimeter( const InputImagePixelType & label ) const
00100     {
00101     if( m_Perimeters.find( label ) != m_Perimeters.end() )
00102       {
00103       return m_Perimeters.find( label )->second;
00104       }
00105     itkExceptionMacro( << "Unknown label: " << static_cast<typename NumericTraits<InputImagePixelType>::PrintType>(label) );
00106     }
00107 
00108   bool HasLabel( const InputImagePixelType & label ) const
00109     {
00110     if( m_Perimeters.find( label ) != m_Perimeters.end() )
00111       {
00112       return true;
00113       }
00114     return false;
00115     }
00116 
00117 protected:
00118   LabelPerimeterEstimationCalculator();
00119   ~LabelPerimeterEstimationCalculator() {};
00120   void PrintSelf(std::ostream& os, Indent indent) const;
00121 
00122 
00123 private:
00124   LabelPerimeterEstimationCalculator(const Self&); //purposely not implemented
00125   void operator=(const Self&); //purposely not implemented
00126 
00127   bool m_FullyConnected;
00128 
00129   const InputImageType * m_Image;
00130   
00131   PerimetersType m_Perimeters;
00132 
00133 }; // end of class
00134 
00135 } // end namespace itk
00136   
00137 #ifndef ITK_MANUAL_INSTANTIATION
00138 #include "itkLabelPerimeterEstimationCalculator.txx"
00139 #endif
00140 
00141 #endif
00142 

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