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

itkVoronoiSegmentationImageFilterBase.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkVoronoiSegmentationImageFilterBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:40 $ 00007 Version: $Revision: 1.26 $ 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 _itkVoronoiSegmentationImageFilterBase_h 00018 #define _itkVoronoiSegmentationImageFilterBase_h 00019 00020 #include "itkImageToImageFilter.h" 00021 #include "itkVoronoiDiagram2D.h" 00022 #include "itkVoronoiDiagram2DGenerator.h" 00023 #include "itkImage.h" 00024 00025 namespace itk 00026 { 00027 00058 template <class TInputImage, class TOutputImage> 00059 class ITK_EXPORT VoronoiSegmentationImageFilterBase: 00060 public ImageToImageFilter<TInputImage,TOutputImage> 00061 { 00062 public: 00064 typedef VoronoiSegmentationImageFilterBase Self; 00065 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass; 00066 typedef SmartPointer <Self> Pointer; 00067 typedef SmartPointer<const Self> ConstPointer; 00068 00070 itkNewMacro(Self); 00071 00073 itkTypeMacro(VoronoiSegmentationImageFilterBase,ImageToImageFilter); 00074 00076 itkStaticConstMacro(ImageDimension, unsigned int, 00077 TInputImage::ImageDimension); 00078 00080 typedef TInputImage InputImageType; 00081 typedef typename TInputImage::Pointer InputImagePointer; 00082 typedef typename TInputImage::ConstPointer InputImageConstPointer; 00083 typedef TOutputImage OutputImageType; 00084 typedef typename TInputImage::IndexType IndexType; 00085 typedef typename TInputImage::SizeType SizeType; 00086 typedef typename TInputImage::RegionType RegionType; 00087 typedef typename TInputImage::PixelType PixelType; 00088 typedef typename TOutputImage::PixelType OutputPixelType; 00089 typedef VoronoiDiagram2D<double> VoronoiDiagram; 00090 typedef VoronoiDiagram2DGenerator<double> VoronoiDiagramGenerator; 00091 typedef typename VoronoiDiagram::PointType PointType; 00092 typedef typename VoronoiDiagram::CellType CellType; 00093 typedef typename VoronoiDiagram::CellAutoPointer CellAutoPointer; 00094 typedef typename VoronoiDiagram::Pointer VoronoiPointer; 00095 typedef typename CellType::PointIdIterator PointIdIterator; 00096 typedef typename VoronoiDiagram::SeedsType SeedsType; 00097 typedef typename VoronoiDiagram::SeedsIterator SeedsIterator; 00098 typedef typename VoronoiDiagram::NeighborIdIterator NeighborIdIterator; 00099 typedef typename VoronoiDiagram::VoronoiEdgeIterator EdgeIterator; 00100 typedef typename VoronoiDiagram::VoronoiEdge EdgeInfo; 00101 typedef std::vector<PointType> PointTypeVector; 00102 typedef std::deque<PointType> PointTypeDeque; 00103 typedef Image<bool,2> BinaryObjectImage; 00104 typedef typename BinaryObjectImage::Pointer BinaryObjectImagePointer; 00105 typedef std::vector<IndexType> IndexList; 00106 00108 typedef Image<unsigned char,2> VDImage; 00109 typedef typename VDImage::Pointer VDImagePointer; 00110 00112 itkSetMacro(NumberOfSeeds, int); 00113 itkGetMacro(NumberOfSeeds, int); 00114 00116 itkSetMacro(MinRegion, int); 00117 itkGetMacro(MinRegion, int); 00118 00121 itkSetMacro(Steps, int); 00122 itkGetMacro(Steps, int); 00123 00125 itkGetMacro(LastStepSeeds, int); 00126 00128 itkGetMacro(NumberOfSeedsToAdded, int); 00129 00131 itkSetMacro(UseBackgroundInAPrior, bool); 00132 itkGetMacro(UseBackgroundInAPrior, bool); 00133 00135 itkSetMacro(OutputBoundary, bool); 00136 itkGetMacro(OutputBoundary, bool); 00137 00140 itkSetMacro(InteractiveSegmentation, bool); 00141 itkGetMacro(InteractiveSegmentation, bool); 00142 itkBooleanMacro(InteractiveSegmentation); 00143 00145 itkSetMacro(MeanDeviation, double); 00146 itkGetMacro(MeanDeviation, double); 00147 00150 virtual void TakeAPrior(BinaryObjectImage*){}; 00151 00153 void RunSegment(void); 00154 00156 void RunSegmentOneStep(void); 00157 00159 virtual void MakeSegmentBoundary(void); 00160 virtual void MakeSegmentObject(void); 00161 00163 VoronoiPointer GetVoronoiDiagram(void) 00164 { return m_WorkingVD; } 00165 00169 void SetSeeds(int num, SeedsIterator begin) 00170 { 00171 m_NumberOfSeeds = num; 00172 m_WorkingVD->SetSeeds(num,begin); 00173 }; 00174 00176 PointType GetSeed(int SeedID) 00177 { return m_WorkingVD->GetSeed(SeedID); } 00178 00180 void DrawDiagram(VDImagePointer result,unsigned char incolor, 00181 unsigned char outcolor,unsigned char boundcolor); 00182 00183 void BeforeNextStep(void); 00184 00187 virtual void GenerateInputRequestedRegion(); 00188 00191 virtual void EnlargeOutputRequestedRegion(DataObject *output); 00192 00193 protected: 00194 VoronoiSegmentationImageFilterBase(); 00195 ~VoronoiSegmentationImageFilterBase(); 00196 virtual void PrintSelf(std::ostream& os, Indent indent) const; 00197 00198 void GenerateData(void); //general pipeline function. 00199 00200 SizeType m_Size; 00201 int m_NumberOfSeeds; 00202 int m_MinRegion; 00203 int m_Steps; 00204 int m_LastStepSeeds; 00205 int m_NumberOfSeedsToAdded; 00206 int m_NumberOfBoundary; 00207 std::vector<int> m_NumberOfPixels; 00208 std::vector<unsigned char> m_Label; 00209 double m_MeanDeviation; 00210 bool m_UseBackgroundInAPrior; 00211 bool m_OutputBoundary; //if =1 then output the boundaries, if = 0 then output the object. 00212 bool m_InteractiveSegmentation; 00213 00214 typename VoronoiDiagram::Pointer m_WorkingVD; 00215 typename VoronoiDiagramGenerator::Pointer m_VDGenerator; 00216 00217 std::vector<PointType> m_SeedsToAdded; 00218 00219 // private methods: 00220 // Classify all the voronoi cells as interior , exterior or boundary. 00221 virtual void ClassifyDiagram(void); 00222 00223 // Generate the seeds to be added by dividing the boundary cells. 00224 virtual void GenerateAddingSeeds(void); 00225 00226 // Compute the statistics of the pixels inside the cell. 00227 void GetPixelIndexFromPolygon(PointTypeDeque VertList, IndexList *PixelPool); 00228 virtual bool TestHomogeneity(IndexList&){return 1;} 00229 00230 void FillPolygon(PointTypeDeque vertlist, OutputPixelType color=1); 00231 00232 // Draw a straight line to the output image. 00233 void drawLine(PointType p1,PointType p2); 00234 00235 // Draw the intermedia Voronoi Diagram structure. 00236 void drawVDline(VDImagePointer result,PointType p1,PointType p2, unsigned char color); 00237 00238 private: 00239 VoronoiSegmentationImageFilterBase(const Self&); //purposely not implemented 00240 void operator=(const Self&); //purposely not implemented 00241 00242 }; 00243 00244 }//end namespace 00245 00246 00247 #ifndef ITK_MANUAL_INSTANTIATION 00248 #include "itkVoronoiSegmentationImageFilterBase.txx" 00249 #endif 00250 00251 #endif 00252 00253 00254 00255

Generated at Sat Mar 31 02:34:25 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000