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 >
00044 class TubeSpatialObject
00045 :public PointBasedSpatialObject< TDimension >
00046 {
00047
00048 public:
00049
00050 typedef TubeSpatialObject Self;
00051 typedef PointBasedSpatialObject< TDimension > Superclass;
00052 typedef SmartPointer < Self > Pointer;
00053 typedef SmartPointer < const Self > ConstPointer;
00054 typedef double ScalarType;
00055 typedef TTubePointType TubePointType;
00056 typedef std::vector< TubePointType > PointListType;
00057 typedef PointListType * PointListPointer;
00058 typedef typename Superclass::PointType PointType;
00059 typedef typename Superclass::TransformType TransformType;
00060 typedef typename Superclass::SpatialObjectPointType SpatialObjectPointType;
00061 typedef VectorContainer<unsigned long,PointType> PointContainerType;
00062 typedef SmartPointer<PointContainerType> PointContainerPointer;
00063 typedef typename Superclass::VectorType VectorType;
00064 typedef typename Superclass::CovariantVectorType CovariantVectorType;
00065 typedef typename Superclass::BoundingBoxType BoundingBoxType;
00066
00068 itkNewMacro( Self );
00069
00071 itkTypeMacro( TubeSpatialObject, PointBasedSpatialObject );
00072
00074 virtual PointListType & GetPoints( void );
00075
00077 virtual const PointListType & GetPoints( void ) const;
00078
00080 virtual void SetPoints( PointListType & newPoints );
00081
00083 virtual const SpatialObjectPointType* GetPoint(unsigned long id) const {return &(m_Points[id]);}
00084
00086 virtual unsigned long GetNumberOfPoints(void) const {return m_Points.size();}
00087
00089 itkSetMacro(EndType,unsigned int);
00090 itkGetMacro(EndType,unsigned int);
00091
00093 void Clear( void );
00094
00096 bool ComputeTangentAndNormals( void );
00097
00099 unsigned int RemoveDuplicatePoints(unsigned int step=1);
00100
00103 bool IsEvaluableAt( const PointType & point,
00104 unsigned int depth=0, char * name=NULL ) const;
00105
00110 bool ValueAt( const PointType & point, double & value,
00111 unsigned int depth=0, char * name=NULL ) const;
00112
00114 bool IsInside( const PointType & point,
00115 unsigned int depth, char * name) const;
00116
00120 virtual bool IsInside( const PointType & point) const;
00121
00123 bool ComputeLocalBoundingBox( ) const;
00124
00127 itkSetMacro(ParentPoint,int);
00128 itkGetMacro(ParentPoint,int);
00129
00130 protected:
00131
00132 PointListType m_Points;
00133 int m_ParentPoint;
00134 unsigned int m_EndType;
00135
00136 TubeSpatialObject();
00137 virtual ~TubeSpatialObject();
00138
00140 virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00141
00143 mutable unsigned long m_OldMTime;
00144 mutable unsigned long m_IndexToWorldTransformMTime;
00145
00146 };
00147
00148 }
00149
00150 #ifndef ITK_MANUAL_INSTANTIATION
00151 #include "itkTubeSpatialObject.txx"
00152 #endif
00153
00154 #endif // __itkTubeSpatialObject_h