Orfeo Toolbox  3.16
itkWatershedSegmentTreeGenerator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkWatershedSegmentTreeGenerator.h,v $
5  Language: C++
6  Date: $Date: 2010-03-02 03:40:36 $
7  Version: $Revision: 1.16 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkWatershedSegmentTreeGenerator_h
18 #define __itkWatershedSegmentTreeGenerator_h
19 
22 #include "itkEquivalencyTable.h"
24 
25 #include <algorithm>
26 #include <utility>
27 
28 namespace itk
29 {
30 namespace watershed
31 {
32 
76 template <class TScalarType>
78 {
79 public:
85  itkNewMacro(Self);
86  itkTypeMacro(WatershedSegmentTreeGenerator, ProcessObject);
87 
89  typedef TScalarType ScalarType;
95 
101 
102 
104  SegmentTableType* GetInputSegmentTable()
105  {
106  return static_cast<SegmentTableType *>(this->ProcessObject::GetInput(0));
107  }
108  void SetInputSegmentTable(SegmentTableType *st)
109  {
110  // Reset the highest calculated flood level if we are given a
111  // different input image.
112  if (st != this->GetInput(0))
113  {
114  m_HighestCalculatedFloodLevel = 0.0;
115  }
116  this->ProcessObject::SetNthInput(0, st);
117  }
118 
122  void SetInputEquivalencyTable(EquivalencyTableType *eq)
123  {
124  this->ProcessObject::SetNthInput(1, eq);
125  }
126  EquivalencyTableType* GetInputEquivalencyTable()
127  {
128  return
129  static_cast<EquivalencyTableType *>(this->ProcessObject::GetInput(1));
130  }
131 
133  SegmentTreeType * GetOutputSegmentTree()
134  {
135  return static_cast<SegmentTreeType *>
136  (this->ProcessObject::GetOutput(0));
137  }
138 
140  void GenerateData();
141 
146  itkSetMacro(Merge, bool);
147  itkGetConstMacro(Merge, bool);
148 
154  void SetFloodLevel(double);
155  itkGetConstMacro(FloodLevel, double);
156 
160  itkSetMacro(HighestCalculatedFloodLevel, double);
161  itkGetConstMacro(HighestCalculatedFloodLevel, double);
162 
168  itkSetMacro(ConsumeInput, bool);
169  itkGetConstMacro(ConsumeInput, bool);
170 
173  static void MergeSegments(SegmentTableTypePointer,
174  OneWayEquivalencyTableTypePointer,
175  const unsigned long,
176  const unsigned long);
177 
180  static void PruneMergeSegments(SegmentTableTypePointer,
181  OneWayEquivalencyTableTypePointer,
182  const unsigned long,
183  const unsigned long,
184  ScalarType);
185 
187  virtual DataObjectPointer MakeOutput(unsigned int idx);
188 
189 protected:
193  void operator=(const Self&) {}
194  void PrintSelf(std::ostream& os, Indent indent) const;
195 
198  void CompileMergeList(SegmentTableTypePointer, SegmentTreeTypePointer);
199 
202  void ExtractMergeHierarchy(SegmentTableTypePointer, SegmentTreeTypePointer);
203 
204  void MergeEquivalencies();
205 
207  void GenerateOutputRequestedRegion(DataObject *output);
208  void GenerateInputRequestedRegion();
209 
210 private:
211  bool m_Merge;
212  double m_FloodLevel;
214 
216 
222 };
223 
224 }// end namespace watershed
225 }// end namespace itk
226 
227 #ifndef ITK_MANUAL_INSTANTIATION
229 #endif
230 
231 #endif

Generated at Sun Feb 3 2013 00:14:59 for Orfeo Toolbox with doxygen 1.8.1.1