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

itkShapeLabelMapFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkShapeLabelMapFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-08-11 14:24:44 $
00007   Version:   $Revision: 1.6 $
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 __itkShapeLabelMapFilter_h
00018 #define __itkShapeLabelMapFilter_h
00019 #include "itkLabelPerimeterEstimationCalculator.h"
00020 
00021 #include "itkInPlaceLabelMapFilter.h"
00022 
00023 namespace itk {
00024 
00050 template<class TImage, class TLabelImage=Image< ITK_TYPENAME TImage::PixelType, ::itk::GetImageDimension<TImage>::ImageDimension> > 
00051 class ITK_EXPORT ShapeLabelMapFilter : 
00052 public
00053 InPlaceLabelMapFilter<TImage>
00054 {
00055 public:
00057   typedef ShapeLabelMapFilter           Self;
00058   typedef InPlaceLabelMapFilter<TImage> Superclass;
00059   typedef SmartPointer<Self>            Pointer;
00060   typedef SmartPointer<const Self>      ConstPointer;
00061 
00063   typedef TImage                               ImageType;
00064   typedef typename ImageType::Pointer          ImagePointer;
00065   typedef typename ImageType::ConstPointer     ImageConstPointer;
00066   typedef typename ImageType::PixelType        PixelType;
00067   typedef typename ImageType::IndexType        IndexType;
00068   typedef typename ImageType::SizeType         SizeType;
00069   typedef typename ImageType::LabelObjectType  LabelObjectType;
00070   typedef typename LabelObjectType::MatrixType MatrixType;
00071   typedef typename LabelObjectType::VectorType VectorType;
00072 
00073   typedef TLabelImage                              LabelImageType;
00074   typedef typename LabelImageType::Pointer         LabelImagePointer;
00075   typedef typename LabelImageType::ConstPointer    LabelImageConstPointer;
00076   typedef typename LabelImageType::PixelType       LabelPixelType;
00077   
00079   itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension );
00080 
00081   typedef LabelPerimeterEstimationCalculator< LabelImageType > PerimeterCalculatorType;
00082 
00084   itkNewMacro(Self);  
00085 
00087   itkTypeMacro(ShapeLabelMapFilter, InPlaceLabelMapFilter );
00088 
00089 #ifdef ITK_USE_CONCEPT_CHECKING
00090 
00091 /*  itkConceptMacro(InputEqualityComparableCheck,
00092     (Concept::EqualityComparable<InputImagePixelType>));
00093   itkConceptMacro(IntConvertibleToInputCheck,
00094     (Concept::Convertible<int, InputImagePixelType>));
00095   itkConceptMacro(InputOStreamWritableCheck,
00096     (Concept::OStreamWritable<InputImagePixelType>));*/
00097 
00099 #endif
00100 
00105   itkSetMacro( ComputeFeretDiameter, bool );
00106   itkGetConstReferenceMacro( ComputeFeretDiameter, bool );
00107   itkBooleanMacro( ComputeFeretDiameter );
00109 
00114   itkSetMacro( ComputePerimeter, bool );
00115   itkGetConstReferenceMacro( ComputePerimeter, bool );
00116   itkBooleanMacro( ComputePerimeter );
00118 
00120   void SetLabelImage( const TLabelImage *input )
00121     {
00122     m_LabelImage = input;
00123     }
00124 
00125 protected:
00126   ShapeLabelMapFilter();
00127   ~ShapeLabelMapFilter() {};
00128 
00129   virtual void ThreadedProcessLabelObject( LabelObjectType * labelObject );
00130   virtual void BeforeThreadedGenerateData();
00131   virtual void AfterThreadedGenerateData();
00132 
00133   void PrintSelf(std::ostream& os, Indent indent) const;
00134 
00135 private:
00136   ShapeLabelMapFilter(const Self&); //purposely not implemented
00137   void operator=(const Self&); //purposely not implemented
00138 
00139   bool                                      m_ComputeFeretDiameter;
00140   bool                                      m_ComputePerimeter;
00141   LabelImageConstPointer                    m_LabelImage;
00142   typename PerimeterCalculatorType::Pointer m_PerimeterCalculator;
00143 
00144   void ComputeFeretDiameter( LabelObjectType * labelObject );
00145 
00147   static long Factorial( long n );
00148   static long DoubleFactorial( long n );
00149   static double GammaN2p1( long n );
00150   static double HyperSphereVolume( double radius );
00151   static double HyperSpherePerimeter( double radius );
00152   static double HyperSphereRadiusFromVolume( double volume );
00154 
00155 }; // end of class
00156 
00157 } // end namespace itk
00158   
00159 #ifndef ITK_MANUAL_INSTANTIATION
00160 #include "itkShapeLabelMapFilter.txx"
00161 #endif
00162 
00163 #endif
00164 

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