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

itkWatershedBoundary.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkWatershedBoundary.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:41 $ 00007 Version: $Revision: 1.13 $ 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 __itkWatershedBoundary_h 00018 #define __itkWatershedBoundary_h 00019 00020 #if defined(_MSC_VER) 00021 #pragma warning ( disable : 4786 ) 00022 #endif 00023 00024 #include <list> 00025 #include <vector> 00026 #include "itkImage.h" 00027 #include "itkObjectFactory.h" 00028 #include "itkDataObject.h" 00029 #include "itkProcessObject.h" 00030 #include "itk_hash_map.h" 00031 00032 namespace itk 00033 { 00034 namespace watershed 00035 { 00055 template <class TScalarType, unsigned int TDimension> 00056 class ITK_EXPORT Boundary : public DataObject 00057 { 00058 public: 00063 itkStaticConstMacro(Dimension, unsigned int, TDimension); 00064 00069 typedef std::pair<unsigned, unsigned> IndexType; 00070 typedef typename Image<unsigned long, TDimension>::IndexType ImageIndexType; 00071 typedef TScalarType ScalarType; 00072 00074 struct face_pixel_t 00075 { 00090 short flow; 00091 00093 unsigned long label; 00094 }; 00095 00097 struct flat_region_t 00098 { 00102 std::list<unsigned long> offset_list; 00103 00106 ScalarType bounds_min; 00107 00110 unsigned long min_label; 00111 00113 ScalarType value; 00114 }; 00115 00118 typedef Image<face_pixel_t, TDimension> face_t; 00119 00121 typedef itk::hash_map<unsigned long, flat_region_t, 00122 itk::hash<unsigned long> > flat_hash_t; 00123 typedef typename flat_hash_t::value_type FlatHashValueType; 00124 00127 typedef Boundary Self; 00128 typedef DataObject Superclass; 00129 typedef SmartPointer<Self> Pointer; 00130 typedef SmartPointer<const Self> ConstPointer; 00131 itkNewMacro(Self); 00132 itkTypeMacro(Boundary, DataObject); 00133 00135 typedef typename face_t::Pointer FacePointer; 00136 00137 00139 FacePointer GetFace(const IndexType &idx) 00140 { return this->GetFace(idx.first, idx.second); } 00141 00145 FacePointer GetFace(unsigned dimension, unsigned highlow) 00146 { 00147 if (highlow == 0) return m_Faces[dimension].first; 00148 else return m_Faces[dimension].second; 00149 } 00150 00151 void SetFace(FacePointer f, const IndexType &idx) 00152 { this->SetFace(f, idx.first, idx.second); } 00153 00154 void SetFace(FacePointer f, unsigned dimension, unsigned highlow) 00155 { 00156 if (highlow ==0 ) m_Faces[dimension].first = f; 00157 else m_Faces[dimension].second = f; 00158 this->Modified(); 00159 } 00160 00162 flat_hash_t *GetFlatHash(const IndexType &idx) 00163 { return this->GetFlatHash(idx.first, idx.second); } 00164 flat_hash_t *GetFlatHash(unsigned dimension, unsigned highlow) 00165 { 00166 if (highlow == 0) return &(m_FlatHashes[dimension].first); 00167 else return &(m_FlatHashes[dimension].second); 00168 } 00169 void SetFlatHash(flat_hash_t & l, const IndexType &idx) 00170 { this->SetFlatHash(l, idx.first, idx.second); } 00171 void SetFlatHash(flat_hash_t & l, unsigned dimension, 00172 unsigned highlow) 00173 { 00174 if (highlow ==0 ) m_FlatHashes[dimension].first = l; 00175 else m_FlatHashes[dimension].second = l; 00176 this->Modified(); 00177 } 00178 00183 void SetValid(bool & l, const IndexType &idx) 00184 { this->SetValid(l, idx.first, idx.second); } 00185 void SetValid(bool b, unsigned dimension, 00186 unsigned highlow) 00187 { 00188 if (highlow ==0 ) m_Valid[dimension].first = b; 00189 else m_Valid[dimension].second = b; 00190 this->Modified(); 00191 } 00192 bool GetValid(const IndexType &idx) const 00193 { return this->GetValid(idx.first, idx.second); } 00194 bool GetValid(unsigned dimension, unsigned highlow) const 00195 { 00196 if (highlow == 0) return m_Valid[dimension].first; 00197 else return m_Valid[dimension].second; 00198 } 00199 00200 protected: 00201 Boundary(); 00202 virtual ~Boundary() {} 00203 Boundary(const Self&) {} 00204 void operator=(const Self&) {} 00205 void PrintSelf(std::ostream& os, Indent indent) const; 00206 00208 std::vector<std::pair<FacePointer, FacePointer> > m_Faces; 00209 00212 std::vector<std::pair<flat_hash_t, flat_hash_t> > m_FlatHashes; 00213 00216 std::vector<std::pair<bool,bool> > m_Valid; 00217 00219 void UpdateOutputInformation(); 00220 bool VerifyRequestedRegion() { return true; } 00221 void SetRequestedRegionToLargestPossibleRegion () {} 00222 bool RequestedRegionIsOutsideOfTheBufferedRegion () { return false; } 00223 void SetRequestedRegion (DataObject *) {} 00224 00225 }; 00226 }// end namespace watershed 00227 }// end namespace itk 00228 00229 #ifndef ITK_MANUAL_INSTANTIATION 00230 #include "itkWatershedBoundary.txx" 00231 #endif 00232 00233 #endif 00234

Generated at Sat Mar 31 02:34:57 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000