00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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:
00047
00049 typedef NarrowBand Self;
00050 typedef LightObject Superclass;
00051 typedef SmartPointer<Self> Pointer;
00052 typedef SmartPointer<const Self> ConstPointer;
00053
00055 itkNewMacro(Self);
00056
00058 itkTypeMacro(NarrowBand, LightObject);
00059
00060 typedef std::vector<NodeType> NodeContainerType;
00061 typedef typename NodeContainerType::size_type SizeType;
00062 typedef typename NodeContainerType::const_iterator ConstIterator;
00063 typedef typename NodeContainerType::iterator Iterator;
00064
00067 typedef struct RegionStruct
00068 {
00069 Iterator Begin;
00070 Iterator End;
00071 } RegionType;
00072
00073
00074
00075
00076
00077
00078
00081 std::vector<struct RegionStruct> SplitBand( unsigned int );
00082
00083 Iterator Begin()
00084 {
00085 return m_NodeContainer.begin();
00086 }
00087 ConstIterator Begin() const
00088 {
00089 return m_NodeContainer.begin();
00090 }
00091 Iterator End()
00092 {
00093 return m_NodeContainer.end();
00094 }
00095 ConstIterator End() const
00096 {
00097 return m_NodeContainer.end();
00098 }
00099
00100 SizeType Size() const
00101 {
00102 return m_NodeContainer.size();
00103 }
00104 bool Empty() const
00105 {
00106 return m_NodeContainer.empty();
00107 }
00108
00110 void Clear()
00111 {
00112 m_NodeContainer.clear();
00113 }
00114 void Reserve( SizeType n)
00115 {
00116 m_NodeContainer.reserve( n );
00117 }
00118 void PushBack( const NodeType &n)
00119 {
00120 m_NodeContainer.push_back(n);
00121 }
00122 void PopBack()
00123 {
00124 m_NodeContainer.pop_back();
00125 }
00126 void Resize( SizeType n )
00127 {
00128 m_NodeContainer.resize(n);
00129 }
00131
00132 NodeType &operator[]( SizeType n )
00133 {
00134 return m_NodeContainer[n];
00135 }
00136 const NodeType& operator[](SizeType n) const
00137 {
00138 return m_NodeContainer[n];
00139 }
00140
00144 void SetTotalRadius(float val) { m_TotalRadius = val;}
00145
00146 float GetTotalRadius(){return m_TotalRadius;}
00147
00150 void SetInnerRadius(float val) { m_InnerRadius = val;}
00151
00152 float GetInnerRadius() { return m_InnerRadius;}
00153
00154
00155 protected:
00156 NarrowBand() {m_TotalRadius = 0.0; m_InnerRadius = 0.0;};
00157 float m_TotalRadius;
00158 float m_InnerRadius;
00159
00160 private:
00161 NarrowBand(const Self&);
00162 void operator=(const Self&);
00163 NodeContainerType m_NodeContainer;
00164
00165 };
00166
00167 }
00168
00169 #ifndef ITK_MANUAL_INSTANTIATION
00170 #include "itkNarrowBand.txx"
00171 #endif
00172
00173 #endif
00174