00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNarrowBand.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-06-19 19:47:57 $ 00007 Version: $Revision: 1.8 $ 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 __itkNarrowBand_h 00018 #define __itkNarrowBand_h 00019 00020 #include "itkLightObject.h" 00021 #include "itkObjectFactory.h" 00022 #include <vector> 00023 00024 namespace itk { 00031 template <class TIndexType, class TDataType> 00032 class BandNode 00033 { 00034 public: 00035 TDataType m_Data; 00036 TIndexType m_Index; 00037 signed char m_NodeState; 00038 BandNode() { m_NodeState = 0; } 00039 }; 00040 00041 00043 template <class NodeType> 00044 class ITK_EXPORT NarrowBand : public LightObject 00045 { 00046 public: 00048 typedef NarrowBand Self; 00049 typedef LightObject Superclass; 00050 typedef SmartPointer<Self> Pointer; 00051 typedef SmartPointer<const Self> ConstPointer; 00052 00054 itkNewMacro(Self); 00055 00057 itkTypeMacro(NarrowBand, LightObject); 00058 00059 typedef std::vector<NodeType> NodeContainerType; 00060 typedef typename NodeContainerType::size_type SizeType; 00061 typedef typename NodeContainerType::const_iterator ConstIterator; 00062 typedef typename NodeContainerType::iterator Iterator; 00063 00066 typedef struct RegionStruct 00067 { 00068 Iterator Begin; 00069 Iterator End; 00070 } RegionType; 00071 00074 #if !defined(CABLE_CONFIGURATION) 00075 std::vector<RegionType> SplitBand( unsigned int ); 00076 #endif 00077 00078 Iterator Begin() 00079 { 00080 return m_NodeContainer.begin(); 00081 } 00082 ConstIterator Begin() const 00083 { 00084 return m_NodeContainer.begin(); 00085 } 00086 Iterator End() 00087 { 00088 return m_NodeContainer.end(); 00089 } 00090 ConstIterator End() const 00091 { 00092 return m_NodeContainer.end(); 00093 } 00094 00095 SizeType Size() const 00096 { 00097 return m_NodeContainer.size(); 00098 } 00099 bool Empty() const 00100 { 00101 return m_NodeContainer.empty(); 00102 } 00103 00105 void Clear() 00106 { 00107 m_NodeContainer.clear(); 00108 } 00109 void Reserve( SizeType n) 00110 { 00111 m_NodeContainer.reserve( n ); 00112 } 00113 void PushBack( const NodeType &n) 00114 { 00115 m_NodeContainer.push_back(n); 00116 } 00117 void PopBack() 00118 { 00119 m_NodeContainer.pop_back(); 00120 } 00121 void Resize( SizeType n ) 00122 { 00123 m_NodeContainer.resize(n); 00124 } 00126 00127 NodeType &operator[]( SizeType n ) 00128 { 00129 return m_NodeContainer[n]; 00130 } 00131 const NodeType& operator[](SizeType n) const 00132 { 00133 return m_NodeContainer[n]; 00134 } 00135 00139 void SetTotalRadius(float val) { m_TotalRadius = val;} 00140 00141 float GetTotalRadius(){return m_TotalRadius;} 00142 00145 void SetInnerRadius(float val) { m_InnerRadius = val;} 00146 00147 float GetInnerRadius() { return m_InnerRadius;} 00148 00149 00150 protected: 00151 NarrowBand() {m_TotalRadius = 0.0; m_InnerRadius = 0.0;} 00152 float m_TotalRadius; 00153 float m_InnerRadius; 00154 00155 private: 00156 NarrowBand(const Self&); //purposely not implemented 00157 void operator=(const Self&); //purposely not implemented 00158 NodeContainerType m_NodeContainer; 00159 00160 }; 00161 00162 } // end namespace itk 00163 00164 #ifndef ITK_MANUAL_INSTANTIATION 00165 #include "itkNarrowBand.txx" 00166 #endif 00167 00168 #endif 00169