]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/DataStructures/Simple3DCurve.h
cbbef541993afd25201ae438748ac87910456e84
[cpPlugins.git] / lib / cpExtensions / DataStructures / Simple3DCurve.h
1 #ifndef __cpExtensions__DataStructures__Simple3DCurve__h__
2 #define __cpExtensions__DataStructures__Simple3DCurve__h__
3
4 #include <cpExtensions/Config.h>
5 #include <itkDataObject.h>
6 #include <itkObjectFactory.h>
7 #include <itkMatrix.h>
8 #include <itkPoint.h>
9
10 namespace cpExtensions
11 {
12   namespace DataStructures
13   {
14     /**
15      */
16     template< class _TScalar >
17     class cpExtensions_EXPORT Simple3DCurve
18       : public itk::DataObject
19     {
20     public:
21       typedef Simple3DCurve                   Self;
22       typedef itk::DataObject                 Superclass;
23       typedef itk::SmartPointer< Self >       Pointer;
24       typedef itk::SmartPointer< const Self > ConstPointer;
25
26       typedef itk::Matrix< _TScalar, 3, 3 > TMatrix;
27       typedef itk::Point< _TScalar, 3 >     TPoint;
28       typedef typename TPoint::VectorType   TVector;
29
30     public:
31       itkNewMacro( Self );
32       itkTypeMacro( Simple3DCurve, itk::DataObject );
33
34     public:
35       template< class _TVector >
36       inline void AddPoint( const _TVector& v )
37         {
38           TPoint p;
39           p[ 0 ] = v[ 0 ];
40           p[ 1 ] = v[ 1 ];
41           p[ 2 ] = v[ 2 ];
42           this->m_Points.push_back( p );
43           this->Modified( );
44         }
45
46       virtual void Modified( ) const cpExtensions_OVERRIDE;
47       void Clear( );
48       unsigned long GetNumberOfPoints( ) const;
49       const TMatrix& GetFrame( unsigned int id ) const;
50       const TPoint& GetPoint( unsigned int id ) const;
51       TVector GetVector( unsigned int id ) const;
52
53     protected:
54       Simple3DCurve( );
55       virtual ~Simple3DCurve( );
56
57     private:
58       // Purposely not implemented
59       Simple3DCurve( const Self& other );
60       Self& operator=( const Self& other );
61
62     protected:
63       std::vector< TPoint > m_Points;
64       mutable std::vector< TMatrix > m_Frames;
65       mutable bool m_FramesUpdated;
66     };
67
68   } // ecapseman
69
70 } // ecapseman
71
72 #endif // __cpExtensions__DataStructures__Simple3DCurve__h__
73
74 // eof - $RCSfile$