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

itkKLMRegionGrowImageFilter.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkKLMRegionGrowImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:33 $ 00007 Version: $Revision: 1.36 $ 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 _itkKLMRegionGrowImageFilter_h 00018 #define _itkKLMRegionGrowImageFilter_h 00019 00020 #include "itkImage.h" 00021 #include "itkObject.h" 00022 #include "itkImageToImageFilter.h" 00023 #include "itkRegionGrowImageFilter.h" 00024 #include "itkKLMSegmentationRegion.h" 00025 #include "itkKLMSegmentationBorder.h" 00026 #include "itkImageRegionIterator.h" 00027 #include "itkImageRegionConstIterator.h" 00028 #include <algorithm> 00029 #include <functional> 00030 00031 namespace itk 00032 { 00033 00156 template <class TInputImage, class TOutputImage> 00157 class ITK_EXPORT KLMRegionGrowImageFilter : public RegionGrowImageFilter<TInputImage,TOutputImage> 00158 { 00159 public: 00161 typedef KLMRegionGrowImageFilter Self; 00162 typedef RegionGrowImageFilter<TInputImage,TOutputImage> Superclass; 00163 typedef SmartPointer<Self> Pointer; 00164 typedef SmartPointer<const Self> ConstPointer; 00165 00167 itkNewMacro(Self); 00168 00170 itkTypeMacro(KLMRegionGrowImageFilter,RegionGrowImageFilter); 00171 00173 typedef TInputImage InputImageType; 00174 typedef typename TInputImage::Pointer InputImagePointer; 00175 typedef typename TInputImage::ConstPointer InputImageConstPointer; 00176 00178 typedef typename TInputImage::PixelType InputImagePixelType; 00179 00181 typedef typename TInputImage::PixelType::VectorType InputImageVectorType; 00182 00184 typedef typename TInputImage::IndexType InputImageIndexType; 00185 00187 typedef typename TInputImage::OffsetType InputImageOffsetType; 00188 00190 typedef ImageRegionIterator< TInputImage > InputImageIterator; 00191 typedef ImageRegionConstIterator< TInputImage > InputImageConstIterator; 00192 00194 typedef TOutputImage OutputImageType; 00195 typedef typename TOutputImage::Pointer OutputImagePointer; 00196 00198 typedef typename TOutputImage::PixelType OutputImagePixelType; 00199 00201 typedef typename TOutputImage::IndexType OutputImageIndexType; 00202 00204 typedef typename TOutputImage::OffsetType OutputImageOffsetType; 00205 00207 typedef ImageRegionIterator< TOutputImage > OutputImageIterator; 00208 00210 typedef typename TOutputImage::PixelType::VectorType OutputImageVectorType; 00211 00213 itkStaticConstMacro(LabelImageDimension, unsigned int, 00214 TInputImage::ImageDimension); 00215 00217 typedef Image<unsigned short,itkGetStaticConstMacro(LabelImageDimension)> LabelImageType; 00218 00220 typedef typename LabelImageType::Pointer LabelImagePointer; 00221 00223 typedef typename LabelImageType::PixelType LabelImagePixelType; 00224 00226 typedef typename LabelImageType::IndexType LabelImageIndexType; 00227 00229 typedef typename LabelImageType::OffsetType LabelImageOffsetType; 00230 00232 typedef ImageRegionIterator< LabelImageType > LabelImageIterator; 00233 00235 typedef vnl_matrix<double> VecDblType; 00236 00238 typedef KLMSegmentationBorder BorderType; 00239 00241 typedef KLMDynamicBorderArray<BorderType> SegmentationBorderPtr; 00242 00246 itkSetMacro(MaxLambda, unsigned int); 00247 00249 itkGetMacro(MaxLambda, unsigned int); 00250 00251 00253 LabelImagePointer GetLabelledImage(void); 00254 00256 void PrintAlgorithmRegionStats(void); 00257 00259 void PrintAlgorithmBorderStats(void); 00260 00262 void PrintAlgorithmBorderStats(bool smartBorderPointerUseFlag); 00263 00269 virtual void CalculateInitRegionStats( int regionRowIndex, 00270 int regionColIndex, 00271 int regionRowGridSize, 00272 int regionColGridSize ); 00273 00279 virtual void CalculateInitRegionStats( int regionRowIndex, 00280 int regionColIndex, 00281 int regionSliceIndex, 00282 int regionRowGridSize, 00283 int regionColGridSize, 00284 int regionSliceGridSize ); 00285 00286 protected: 00287 KLMRegionGrowImageFilter(); 00288 ~KLMRegionGrowImageFilter(); 00289 void PrintSelf(std::ostream& os, Indent indent) const; 00290 00291 virtual void GenerateData(); 00292 virtual void GenerateInputRequestedRegion(); 00293 virtual void EnlargeOutputRequestedRegion( DataObject * ); 00294 virtual void GenerateOutputInformation(); 00295 00298 void ApplyRegionGrowImageFilter(); 00299 00306 virtual void MergeRegions(); 00307 00309 void GenerateOutputImage(unsigned int imgWidth, 00310 unsigned int imgHeight); 00311 00313 void GenerateOutputImage(unsigned int imgWidth, 00314 unsigned int imgHeight, 00315 unsigned int imgDepth); 00316 00317 00319 void ApplyKLM(); 00320 00322 void InitializeKLM(unsigned int imgWidth, 00323 unsigned int imgHeight); 00324 00326 void InitializeKLM(unsigned int imgWidth, 00327 unsigned int imgHeight, 00328 unsigned int imgDepth ); 00329 00331 LabelImagePointer localfn_generate_labeled2Dimage( 00332 LabelImageType *labelImagePtr ); 00333 00335 LabelImagePointer localfn_generate_labeled3Dimage( 00336 LabelImageType *labelImagePtr ); 00337 00338 private: 00339 KLMRegionGrowImageFilter(const Self&); //purposely not implemented 00340 void operator=(const Self&); //purposely not implemented 00341 00342 typedef typename TInputImage::SizeType InputImageSize; 00343 typedef typename KLMSegmentationRegion::Pointer KLMSegmentationRegionPtr; 00344 00345 typedef typename KLMSegmentationBorder::Pointer KLMSegmentationBorderPtr; 00346 00349 typedef std::vector< SegmentationBorderPtr > BordersDynamicPointerType; 00350 00352 typedef BordersDynamicPointerType::iterator BordersDynamicPointerIterator; 00353 00354 00355 unsigned int m_MaxLambda; 00356 unsigned int m_NumberOfBorders; 00357 unsigned int m_NumRegions; 00358 unsigned int m_InitRegionArea; 00359 SegmentationBorderPtr *m_BordersCandidateDynamicPointer; 00360 SegmentationBorder *m_BordersCandidatePointer; 00361 unsigned int m_ImgWidth; 00362 unsigned int m_ImgHeight; 00363 unsigned int m_ImgDepth; 00364 00365 unsigned int m_TotalBorderLength; 00366 double m_RegionLambda; 00367 00368 VecDblType m_InitRegionMean; 00369 00370 00371 std::vector< KLMSegmentationRegionPtr > m_RegionsPointer; 00372 std::vector< KLMSegmentationBorderPtr > m_BordersPointer; 00373 std::vector< SegmentationBorderPtr > m_BordersDynamicPointer; 00374 00375 00379 void UnionBorders(KLMSegmentationRegion *pRegion1, 00380 KLMSegmentationRegion *pRegion2); 00381 00385 void UpdateBordersDynamicPointer(); 00386 00389 void ResolveRegionLabels(unsigned int imgWidth, 00390 unsigned int imgHeight); 00391 00394 void ResolveRegionLabels(unsigned int imgWidth, 00395 unsigned int imgHeight, 00396 unsigned int imgDepth); 00397 00398 }; // class KLMRegionGrowImageFilter 00399 00400 } // namespace itk 00401 00402 #ifndef ITK_MANUAL_INSTANTIATION 00403 #include "itkKLMRegionGrowImageFilter.txx" 00404 #endif 00405 00406 00407 00408 #endif

Generated at Sun Apr 1 02:36:30 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000