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 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 id) const
00083 {return &(m_Points[id]);}
00084
00086 virtual SpatialObjectPointType* GetPoint(unsigned long id)
00087 {return &(m_Points[id]);}
00088
00090 virtual void SetPoint(unsigned long id, const TubePointType & pnt)
00091 {m_Points[id] = pnt;}
00092
00094 virtual void RemovePoint(unsigned long id)
00095 { m_Points.erase(m_Points.begin()+id); }
00096
00098 virtual unsigned long GetNumberOfPoints(void) const
00099 {return m_Points.size();}
00100
00102 itkSetMacro(EndType,unsigned int);
00103 itkGetConstMacro(EndType,unsigned int);
00104
00106 void Clear( void );
00107
00109 bool ComputeTangentAndNormals( void );
00110
00112 unsigned int RemoveDuplicatePoints(unsigned int step=1);
00113
00116 bool IsEvaluableAt( const PointType & point,
00117 unsigned int depth=0, char * name=NULL ) const;
00118
00123 bool ValueAt( const PointType & point, double & value,
00124 unsigned int depth=0, char * name=NULL ) const;
00125
00127 bool IsInside( const PointType & point,
00128 unsigned int depth, char * name) const;
00129
00133 virtual bool IsInside( const PointType & point) const;
00134
00136 bool ComputeLocalBoundingBox( ) const;
00137
00140 itkSetMacro(ParentPoint,int);
00141 itkGetConstMacro(ParentPoint,int);
00142
00145 itkSetMacro(Root, bool);
00146 itkGetConstMacro(Root, bool);
00147
00149 itkSetMacro(Artery, bool);
00150 itkGetConstMacro(Artery, bool);
00151
00153 void CopyInformation(const DataObject *data);
00154
00155
00156 protected:
00157
00158 PointListType m_Points;
00159 int m_ParentPoint;
00160 unsigned int m_EndType;
00161
00162 bool m_Root;
00163 bool m_Artery;
00164
00165 TubeSpatialObject();
00166 virtual ~TubeSpatialObject();
00167
00169 virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00170
00172 mutable unsigned long m_OldMTime;
00173 mutable unsigned long m_IndexToWorldTransformMTime;
00174
00175 };
00176
00177 }
00178
00179 #ifndef ITK_MANUAL_INSTANTIATION
00180 #include "itkTubeSpatialObject.txx"
00181 #endif
00182
00183 #endif // __itkTubeSpatialObject_h