itkShapeLabelMapFilter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00092
00093
00094
00095
00096
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&);
00137 void operator=(const Self&);
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 };
00156
00157 }
00158
00159 #ifndef ITK_MANUAL_INSTANTIATION
00160 #include "itkShapeLabelMapFilter.txx"
00161 #endif
00162
00163 #endif
00164