00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkTubeSpatialObject_h
00019 #define __itkTubeSpatialObject_h
00020
00021 #include <list>
00022
00023 #include "itkPointBasedSpatialObject.h"
00024 #include "itkTubeSpatialObjectPoint.h"
00025
00026 namespace itk
00027 {
00028
00041 template < unsigned int TDimension = 3,
00042 typename TTubePointType = TubeSpatialObjectPoint<TDimension> >
00043 class ITK_EXPORT TubeSpatialObject
00044 :public PointBasedSpatialObject< TDimension >
00045 {
00046
00047 public:
00048
00049 typedef TubeSpatialObject Self;
00050 typedef PointBasedSpatialObject< TDimension > Superclass;
00051 typedef SmartPointer < Self > Pointer;
00052 typedef SmartPointer < const Self > ConstPointer;
00053 typedef double ScalarType;
00054 typedef TTubePointType TubePointType;
00055 typedef std::vector< TubePointType > PointListType;
00056 typedef PointListType * PointListPointer;
00057 typedef typename Superclass::PointType PointType;
00058 typedef typename Superclass::TransformType TransformType;
00059 typedef typename Superclass::SpatialObjectPointType SpatialObjectPointType;
00060 typedef VectorContainer<unsigned long,PointType> PointContainerType;
00061 typedef SmartPointer<PointContainerType> PointContainerPointer;
00062 typedef typename Superclass::VectorType VectorType;
00063 typedef typename Superclass::CovariantVectorType CovariantVectorType;
00064 typedef typename Superclass::BoundingBoxType BoundingBoxType;
00065
00067 itkNewMacro( Self );
00068
00070 itkTypeMacro( TubeSpatialObject, PointBasedSpatialObject );
00071
00073 virtual PointListType & GetPoints( void );
00074
00076 virtual const PointListType & GetPoints( void ) const;
00077
00079 virtual void SetPoints( PointListType & newPoints );
00080
00082 virtual const SpatialObjectPointType* GetPoint(unsigned long ind) const
00083 {return &(m_Points[ind]);}
00084
00086 virtual SpatialObjectPointType* GetPoint(unsigned long ind)
00087 {return &(m_Points[ind]);}
00088
00090 virtual void SetPoint(unsigned long ind, const TubePointType & pnt)
00091 {m_Points[ind] = pnt;}
00092
00094 virtual void RemovePoint(unsigned long ind)
00095 {m_Points.erase(m_Points.begin()+ind);}
00096
00098 virtual unsigned long GetNumberOfPoints(void) const
00099 {return m_Points.size();}
00100
00102 itkSetMacro(EndType,unsigned int);
00103 itkGetConstMacro(EndType,unsigned int);
00105
00107 void Clear( void );
00108
00110 bool ComputeTangentAndNormals( void );
00111
00113 unsigned int RemoveDuplicatePoints(unsigned int step=1);
00114
00117 bool IsEvaluableAt( const PointType & point,
00118 unsigned int depth=0, char * name=NULL ) const;
00119
00124 bool ValueAt( const PointType & point, double & value,
00125 unsigned int depth=0, char * name=NULL ) const;
00126
00128 bool IsInside( const PointType & point,
00129 unsigned int depth, char * name) const;
00130
00134 virtual bool IsInside( const PointType & point) const;
00135
00137 bool ComputeLocalBoundingBox( ) const;
00138
00141 itkSetMacro(ParentPoint,int);
00142 itkGetConstMacro(ParentPoint,int);
00144
00147 itkSetMacro(Root, bool);
00148 itkGetConstMacro(Root, bool);
00150
00152 itkSetMacro(Artery, bool);
00153 itkGetConstMacro(Artery, bool);
00155
00157 void CopyInformation(const DataObject *data);
00158
00159
00160 protected:
00161
00162 PointListType m_Points;
00163 int m_ParentPoint;
00164 unsigned int m_EndType;
00165
00166 bool m_Root;
00167 bool m_Artery;
00168
00169 TubeSpatialObject();
00170 virtual ~TubeSpatialObject();
00171
00173 virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00174
00176 mutable unsigned long m_OldMTime;
00177 mutable unsigned long m_IndexToWorldTransformMTime;
00178
00179 };
00180
00181 }
00182
00183 #ifndef ITK_MANUAL_INSTANTIATION
00184 #include "itkTubeSpatialObject.txx"
00185 #endif
00186
00187 #endif // __itkTubeSpatialObject_h
00188