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: 2006/04/04 13:20:13 $
00007   Version:   $Revision: 1.44 $
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 "itkConceptChecking.h"
00029 #include <algorithm>
00030 #include <functional>
00031 
00032 namespace itk
00033 {
00034 
00167 template <class TInputImage, class TOutputImage>
00168 class ITK_EXPORT KLMRegionGrowImageFilter : public RegionGrowImageFilter<TInputImage,TOutputImage>
00169 {
00170 public:
00172   typedef KLMRegionGrowImageFilter              Self;
00173   typedef RegionGrowImageFilter< TInputImage, TOutputImage > Superclass;
00174   typedef SmartPointer< Self >                  Pointer;
00175   typedef SmartPointer< const Self >            ConstPointer;
00176 
00178   itkNewMacro(Self);
00179 
00181   itkTypeMacro(KLMRegionGrowImageFilter, RegionGrowImageFilter);
00182 
00184   typedef TInputImage                           InputImageType;
00185   typedef typename TInputImage::Pointer         InputImagePointer;
00186   typedef typename TInputImage::ConstPointer    InputImageConstPointer;
00187 
00189   typedef typename TInputImage::PixelType       InputImagePixelType;
00190 
00192   typedef typename TInputImage::PixelType::VectorType InputImageVectorType;
00193 
00195   itkStaticConstMacro(InputImageVectorDimension, unsigned int,
00196                       InputImagePixelType::Dimension);
00197 
00199   typedef typename TInputImage::IndexType       InputImageIndexType;
00200 
00202   typedef ImageRegionIterator< TInputImage >      InputImageIterator;
00203   typedef ImageRegionConstIterator< TInputImage > InputImageConstIterator;
00204 
00206   typedef typename TInputImage::RegionType      InputRegionType;
00207 
00210   typedef typename Superclass::GridSizeType     GridSizeType;
00211 
00213   typedef TOutputImage                          OutputImageType;
00214   typedef typename TOutputImage::Pointer        OutputImagePointer;
00215 
00217   itkStaticConstMacro(InputImageDimension, unsigned int,
00218                       TInputImage::ImageDimension);
00219 
00221   itkStaticConstMacro(OutputImageDimension, unsigned int,
00222                       TOutputImage::ImageDimension);
00223 
00225   typedef typename TOutputImage::PixelType      OutputImagePixelType;
00226 
00228   typedef typename TOutputImage::PixelType::VectorType OutputImageVectorType;
00229 
00231   itkStaticConstMacro(OutputImageVectorDimension, unsigned int,
00232                       OutputImagePixelType::Dimension);
00233 
00235   typedef typename TOutputImage::IndexType      OutputImageIndexType;
00236 
00238   typedef ImageRegionIterator< TOutputImage >   OutputImageIterator;
00239 
00241   typedef typename KLMSegmentationRegion::RegionLabelType RegionLabelType;
00242 
00244   itkStaticConstMacro(LabelImageDimension, RegionLabelType,
00245                       InputImageDimension);
00246 
00248   typedef Image< RegionLabelType, itkGetStaticConstMacro(LabelImageDimension) > LabelImageType;
00249 
00251   typedef typename LabelImageType::Pointer      LabelImagePointer;
00252 
00254   typedef typename LabelImageType::PixelType    LabelImagePixelType;
00255 
00257   typedef typename LabelImageType::IndexType    LabelImageIndexType;
00258 
00260   typedef ImageRegionIterator< LabelImageType > LabelImageIterator;
00261 
00263   typedef vnl_vector< double > MeanRegionIntensityType;
00264 
00266   typedef KLMSegmentationBorder                 BorderType;
00267 
00269   typedef KLMDynamicBorderArray< BorderType >   KLMSegmentationBorderArrayPtr;
00270 
00274   itkSetMacro(MaximumLambda, double);
00275   itkGetConstReferenceMacro(MaximumLambda, double);
00277 
00279   itkSetMacro(NumberOfRegions, unsigned int);
00280   itkGetConstReferenceMacro(NumberOfRegions, unsigned int);
00282 
00284   LabelImagePointer GetLabelledImage(void);
00285 
00287   void PrintAlgorithmRegionStats(void);
00288 
00290   void PrintAlgorithmBorderStats(void);
00291 
00292 #ifdef ITK_USE_CONCEPT_CHECKING
00293 
00294   itkConceptMacro(InputHasNumericTraitsCheck,
00295     (Concept::HasNumericTraits<typename InputImagePixelType::ValueType>));
00296   itkConceptMacro(SameDimension,
00297     (Concept::SameDimension<itkGetStaticConstMacro(InputImageDimension),
00298                             itkGetStaticConstMacro(OutputImageDimension)>));
00299 #if THIS_CONCEPT_FAILS_ON_GCC
00300 
00303   itkConceptMacro(SameVectorDimension,
00304     (Concept::SameDimension<itkGetStaticConstMacro(InputImageVectorDimension),
00305                             itkGetStaticConstMacro(OutputImageVectorDimension)>));
00306 #endif
00307 
00309 #endif
00310 
00311 protected:
00312   KLMRegionGrowImageFilter();
00313   ~KLMRegionGrowImageFilter();
00314   void PrintSelf(std::ostream& os, Indent indent) const;
00315 
00319   virtual void GenerateData();
00320 
00324   virtual void GenerateInputRequestedRegion();
00325 
00330   virtual void EnlargeOutputRequestedRegion( DataObject * );
00331 
00334   void ApplyRegionGrowImageFilter();
00335 
00339   virtual void MergeRegions();
00340 
00342   virtual void GenerateOutputImage();
00343 
00345   void ApplyKLM();
00346 
00348   void InitializeKLM();
00349 
00351   LabelImagePointer GenerateLabelledImage( LabelImageType *labelImagePtr );
00352 
00358   virtual void InitializeRegionParameters( InputRegionType region );
00359 
00363   virtual void ResolveRegions();
00364 
00365 private:
00366   KLMRegionGrowImageFilter(const Self&); // purposely not implemented
00367   void operator=(const Self&); // purposely not implemented
00368 
00369   typedef typename TInputImage::SizeType           InputImageSizeType;
00370   typedef typename KLMSegmentationRegion::Pointer  KLMSegmentationRegionPtr;
00371   typedef typename KLMSegmentationBorder::Pointer  KLMSegmentationBorderPtr;
00372 
00373   double                  m_MaximumLambda;
00374   unsigned int            m_NumberOfRegions;
00375 
00378   double                  m_InternalLambda;
00379   unsigned int            m_InitialNumberOfRegions;
00380   double                  m_TotalBorderLength;
00381 
00382   std::vector< KLMSegmentationRegionPtr >       m_RegionsPointer;
00383   std::vector< KLMSegmentationBorderPtr >       m_BordersPointer;
00384   std::vector< KLMSegmentationBorderArrayPtr >  m_BordersDynamicPointer;
00385   KLMSegmentationBorderArrayPtr                *m_BorderCandidate;
00386 
00387   MeanRegionIntensityType          m_InitialRegionMean;
00388   double                           m_InitialRegionArea;
00389 
00390 }; // class KLMRegionGrowImageFilter
00391 
00392 } // namespace itk
00393 
00394 #ifndef ITK_MANUAL_INSTANTIATION
00395 #include "itkKLMRegionGrowImageFilter.txx"
00396 #endif
00397 
00398 
00399 #endif
00400 

Generated at Sun Sep 23 13:19:47 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000