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

itkWatershedSegmentTreeGenerator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkWatershedSegmentTreeGenerator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/05/10 22:56:16 $
00007   Version:   $Revision: 1.6 $
00008 
00009   Copyright (c) 2002 Insight 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 __itkWatershedSegmentTreeGenerator_h
00018 #define __itkWatershedSegmentTreeGenerator_h
00019 
00020 #include "itkWatershedSegmentTable.h"
00021 #include "itkWatershedSegmentTree.h"
00022 #include "itkWatershedEquivalencyTable.h"
00023 #include "itkWatershedOneWayEquivalencyTable.h"
00024 
00025 #include <algorithm>
00026 #include <utility>
00027 
00028 namespace itk
00029 {
00030 namespace watershed
00031 {
00032  
00076 template <class TScalarType>
00077 class SegmentTreeGenerator  : public ProcessObject
00078 {
00079 public:
00081   typedef SegmentTreeGenerator Self;
00082   typedef ProcessObject Superclass;
00083   typedef SmartPointer<Self> Pointer;
00084   typedef SmartPointer<const Self> ConstPointer;
00085   itkNewMacro(Self);
00086   itkTypeMacro(SegmentTreeGenerator, ProcessObject);
00087 
00089   typedef TScalarType ScalarType;
00090   typedef SegmentTable<ScalarType> SegmentTableType;
00091   typedef SegmentTree<ScalarType>  SegmentTreeType;
00092   typedef EquivalencyTable         EquivalencyTableType;
00093   typedef OneWayEquivalencyTable   OneWayEquivalencyTableType;
00094   typedef DataObject::Pointer      DataObjectPointer;
00095 
00097   typedef typename SegmentTableType::Pointer SegmentTableTypePointer;
00098   typedef typename OneWayEquivalencyTableType::Pointer
00099     OneWayEquivalencyTableTypePointer;
00100   typedef typename SegmentTreeType::Pointer SegmentTreeTypePointer;
00101   
00102 
00104   SegmentTableType * GetInputSegmentTable()
00105     { return static_cast<SegmentTableType *>
00106         (this->ProcessObject::GetInput(0)); }
00107   EquivalencyTableType * GetInputEquivalencyTable()
00108     { return static_cast<EquivalencyTableType *>
00109         (this->ProcessObject::GetInput(1)); }
00110 
00114   void SetInputEquivalencyTable(EquivalencyTableType *eq)
00115     { this->ProcessObject::SetNthInput(1, eq); }
00116   void SetInputSegmentTable(SegmentTableType *st)
00117     { this->ProcessObject::SetNthInput(0, st); }
00118 
00120   SegmentTreeType * GetOutputSegmentTree()
00121     { return static_cast<SegmentTreeType *>
00122         (this->ProcessObject::GetOutput(0)); }
00123 
00125   void GenerateData();
00126 
00131   itkSetMacro(Merge, bool);
00132   itkGetMacro(Merge, bool);
00133 
00139   void SetFloodLevel(double);
00140   itkGetMacro(FloodLevel, double);
00141 
00145   itkSetMacro(HighestCalculatedFloodLevel, double);
00146   itkGetMacro(HighestCalculatedFloodLevel, double);
00147 
00152   itkSetMacro(ConsumeInput, bool);
00153   itkGetMacro(ConsumeInput, bool);
00154 
00157   void static MergeSegments(SegmentTableTypePointer,
00158                             OneWayEquivalencyTableTypePointer,
00159                             const unsigned long,
00160                             const unsigned long);
00161 
00164   void static PruneMergeSegments(SegmentTableTypePointer,
00165                                  OneWayEquivalencyTableTypePointer,
00166                                  const unsigned long,
00167                                  const unsigned long,
00168                                  ScalarType);
00169 
00171   virtual DataObjectPointer MakeOutput(unsigned int idx);
00172   
00173 protected:
00174   SegmentTreeGenerator();
00175   virtual ~SegmentTreeGenerator() {}
00176   SegmentTreeGenerator(const Self&) {}
00177   void operator=(const Self&) {}
00178   void PrintSelf(std::ostream& os, Indent indent) const;
00179   
00182   void CompileMergeList(SegmentTableTypePointer, SegmentTreeTypePointer);
00183 
00186   void ExtractMergeHierarchy(SegmentTableTypePointer, SegmentTreeTypePointer);
00187 
00188   void MergeEquivalencies();
00189 
00191   void GenerateOutputRequestedRegion(DataObject *output);
00192   void GenerateInputRequestedRegion();
00193   
00194 private:
00195   bool m_Merge;
00196   double m_FloodLevel;
00197   bool m_ConsumeInput;
00198   OneWayEquivalencyTableType::Pointer m_MergedSegmentsTable;
00199   
00203   double m_HighestCalculatedFloodLevel;
00204 };
00205   
00206 }// end namespace watershed
00207 }// end namespace itk
00208 
00209 #ifndef ITK_MANUAL_INSTANTIATION
00210 #include "itkWatershedSegmentTreeGenerator.txx"
00211 #endif
00212 
00213 #endif
00214 

Generated at Wed Mar 12 01:13:14 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000