ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkNarrowBand_h 00019 #define __itkNarrowBand_h 00020 00021 #include "itkLightObject.h" 00022 #include "itkObjectFactory.h" 00023 #include <vector> 00024 00025 namespace itk 00026 { 00033 template< class TIndexType, class TDataType > 00034 class BandNode 00035 { 00036 public: 00037 TDataType m_Data; 00038 TIndexType m_Index; 00039 signed char m_NodeState; 00040 BandNode() : m_NodeState( 0 ) {} 00041 }; 00042 00047 template< class NodeType > 00048 class ITK_EXPORT NarrowBand:public LightObject 00049 { 00050 public: 00052 typedef NarrowBand Self; 00053 typedef LightObject Superclass; 00054 typedef SmartPointer< Self > Pointer; 00055 typedef SmartPointer< const Self > ConstPointer; 00056 00058 itkNewMacro(Self); 00059 00061 itkTypeMacro(NarrowBand, LightObject); 00062 00063 typedef std::vector< NodeType > NodeContainerType; 00064 typedef typename NodeContainerType::size_type SizeType; 00065 typedef typename NodeContainerType::const_iterator ConstIterator; 00066 typedef typename NodeContainerType::iterator Iterator; 00067 00070 typedef struct RegionStruct { 00071 Iterator Begin; 00072 Iterator End; 00073 } RegionType; 00074 00077 #if !defined( CABLE_CONFIGURATION ) 00078 std::vector< RegionType > SplitBand(const SizeType&); 00079 00080 #endif 00081 00082 Iterator Begin() 00083 { 00084 return m_NodeContainer.begin(); 00085 } 00086 00087 ConstIterator Begin() const 00088 { 00089 return m_NodeContainer.begin(); 00090 } 00091 00092 Iterator End() 00093 { 00094 return m_NodeContainer.end(); 00095 } 00096 00097 ConstIterator End() const 00098 { 00099 return m_NodeContainer.end(); 00100 } 00101 00102 SizeType Size() const 00103 { 00104 return m_NodeContainer.size(); 00105 } 00106 00107 bool Empty() const 00108 { 00109 return m_NodeContainer.empty(); 00110 } 00111 00113 void Clear() 00114 { 00115 m_NodeContainer.clear(); 00116 } 00117 00118 void Reserve(SizeType n) 00119 { 00120 m_NodeContainer.reserve(n); 00121 } 00122 00123 void PushBack(const NodeType & n) 00124 { 00125 m_NodeContainer.push_back(n); 00126 } 00127 00128 void PopBack() 00129 { 00130 m_NodeContainer.pop_back(); 00131 } 00132 00133 void Resize(SizeType n) 00134 { 00135 m_NodeContainer.resize(n); 00136 } 00137 00138 NodeType & operator[](SizeType n) 00139 { 00140 return m_NodeContainer[n]; 00141 } 00142 00143 const NodeType & operator[](SizeType n) const 00144 { 00145 return m_NodeContainer[n]; 00146 } 00147 00151 void SetTotalRadius(const float& val) { m_TotalRadius = val; } 00152 00153 float GetTotalRadius() const { return m_TotalRadius; } 00154 00157 void SetInnerRadius(const float& val) { m_InnerRadius = val; } 00158 00159 float GetInnerRadius() const { return m_InnerRadius; } 00160 protected: 00161 NarrowBand() : m_TotalRadius( 0.0 ), m_InnerRadius( 0.0 ) {} 00162 00163 float m_TotalRadius; 00164 float m_InnerRadius; 00165 private: 00166 NarrowBand(const Self &); //purposely not implemented 00167 void operator=(const Self &); //purposely not implemented 00168 00169 NodeContainerType m_NodeContainer; 00170 }; 00171 } // end namespace itk 00172 00173 #ifndef ITK_MANUAL_INSTANTIATION 00174 #include "itkNarrowBand.hxx" 00175 #endif 00176 00177 #endif 00178