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

itkThresholdMaximumConnectedComponentsImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkThresholdMaximumConnectedComponentsImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/04/27 19:05:39 $
00007   Version:   $Revision: 1.4 $
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 
00018 #ifndef __itkThresholdMaximumConnectedComponentsImageFilter_h
00019 #define __itkThresholdMaximumConnectedComponentsImageFilter_h
00020 
00021 #include "itkInPlaceImageFilter.h"
00022 #include "itkBinaryThresholdImageFilter.h"
00023 #include "itkConnectedComponentImageFilter.h"
00024 #include "itkRelabelComponentImageFilter.h"
00025 #include "itkMinimumMaximumImageCalculator.h"
00026 #include "itkCastImageFilter.h"
00027 
00028 #include "itkConceptChecking.h"
00029 
00030 namespace itk
00031 {
00032 
00074 template <class TInputImage, class TOutputImage = TInputImage>
00075 class ITK_EXPORT ThresholdMaximumConnectedComponentsImageFilter : 
00076   public ImageToImageFilter< TInputImage , TOutputImage >
00077 {
00078 public:
00080   typedef ThresholdMaximumConnectedComponentsImageFilter Self;
00081   typedef ImageToImageFilter<TInputImage,TOutputImage>   Superclass;
00082   typedef SmartPointer<Self>                             Pointer;
00083   typedef SmartPointer<const Self>                       ConstPointer;
00084 
00086   itkNewMacro(Self);  
00087 
00089   itkTypeMacro( ThresholdMaximumConnectedComponentsImageFilter,
00090                 ImageToImageFilter );
00091 
00093   typedef typename TInputImage::PixelType   PixelType;
00094 
00096   itkConceptMacro(PixelTypeComparable, (Concept::Comparable<PixelType>));
00097 
00105   itkSetMacro( MinimumObjectSizeInPixels, unsigned int );
00106   itkGetMacro( MinimumObjectSizeInPixels, unsigned int );
00108 
00122   itkSetMacro( InsideValue, PixelType );
00123   itkSetMacro( OutsideValue, PixelType );
00124   itkSetMacro( UpperBoundary, PixelType );
00125   itkGetMacro( InsideValue, PixelType );
00126   itkGetMacro( OutsideValue, PixelType );
00127   itkGetMacro( UpperBoundary, PixelType );
00129 
00134  itkGetMacro( NumberOfObjects, unsigned long );
00135 
00139   itkGetMacro( ThresholdValue, PixelType );
00140 
00142   typedef TInputImage                           InputImageType;
00143   typedef typename InputImageType::ConstPointer InputImagePointer;
00144   typedef typename InputImageType::RegionType   InputImageRegionType;
00145   typedef typename InputImageType::PixelType    InputImagePixelType;
00146 
00148   typedef TOutputImage                         OutputImageType;
00149   typedef typename OutputImageType::Pointer    OutputImagePointer;
00150   typedef typename OutputImageType::RegionType OutputImageRegionType;
00151   typedef typename OutputImageType::PixelType  OutputImagePixelType;
00152 
00153 
00154 protected:
00155   ThresholdMaximumConnectedComponentsImageFilter();
00156   ~ThresholdMaximumConnectedComponentsImageFilter() {};
00157   void PrintSelf(std::ostream& os, Indent indent) const;
00158 
00161   void GenerateData(void);
00162 
00167   unsigned long int ComputeConnectedComponents(void); 
00168 
00169 
00170 private:
00171  
00173   typedef unsigned int FilterPixelType;
00174 
00175   itkStaticConstMacro( ImageDimension,
00176                        unsigned int,
00177                        TInputImage::ImageDimension );
00178 
00179   typedef itk::Image< FilterPixelType, itkGetStaticConstMacro(ImageDimension) >
00180  FilterImageType; 
00181 
00182   typedef typename FilterImageType::Pointer FilterImagePointer;
00183 
00184   //purposely not implemented
00185   ThresholdMaximumConnectedComponentsImageFilter(const Self&);
00186   void operator=(const Self&); //purposely not implemented
00187    
00188   
00189   //
00190   // Binary Threshold Filter
00191   //
00192   typedef BinaryThresholdImageFilter< InputImageType, OutputImageType >
00193   ThresholdFilterType;
00194 
00195   
00196   // 
00197   // Connected Components Filter  
00198   //
00199   typedef ConnectedComponentImageFilter< OutputImageType, FilterImageType >
00200   ConnectedFilterType;
00201 
00202   
00203   //
00204   // Relabeled Components Filter
00205   //
00206   typedef RelabelComponentImageFilter< FilterImageType, FilterImageType >
00207   RelabelFilterType;
00208 
00209   
00210   //
00211   // Minimum maximum calculator
00212   //
00213   typedef MinimumMaximumImageCalculator< InputImageType > MinMaxCalculatorType;
00214 
00215   // 
00216   // Declare member variables for the filters of the internal pipeline.
00217   //
00218   typename ThresholdFilterType::Pointer            m_ThresholdFilter;
00219   typename ConnectedFilterType::Pointer            m_ConnectedComponent;
00220   typename RelabelFilterType::Pointer              m_LabeledComponent;
00221   typename MinMaxCalculatorType::Pointer           m_MinMaxCalculator;
00222 
00223   // Variables defined by the user
00224   unsigned int m_MinimumObjectSizeInPixels;
00225   
00226   // Binary threshold variables
00227   PixelType  m_OutsideValue;
00228   PixelType  m_InsideValue;
00229   PixelType  m_LowerBoundary;
00230   PixelType  m_UpperBoundary;
00231 
00232   // Filter variables
00233   PixelType      m_ThresholdValue;
00234   unsigned long  m_NumberOfObjects;
00235   
00236 };
00237 
00238   
00239 } // end namespace itk
00240   
00241 #ifndef ITK_MANUAL_INSTANTIATION
00242 #include "itkThresholdMaximumConnectedComponentsImageFilter.txx"
00243 #endif
00244   
00245 #endif
00246 

Generated at Thu Nov 6 00:27:23 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000