]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/DataStructures/Simple3DCurve.h
0641d43e8e0aaddc7aa742b51f77381ef8bd33e7
[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 _TScalar TScalar;
27       typedef itk::Matrix< TScalar, 3, 3 > TMatrix;
28       typedef itk::Point< TScalar, 3 >     TPoint;
29       typedef typename TPoint::VectorType  TVector;
30
31     public:
32       itkNewMacro( Self );
33       itkTypeMacro( Simple3DCurve, itk::DataObject );
34
35     public:
36       template< class _TVector >
37       inline void AddPoint( const _TVector& v )
38         {
39           TPoint p;
40           p[ 0 ] = v[ 0 ];
41           p[ 1 ] = v[ 1 ];
42           p[ 2 ] = v[ 2 ];
43           this->m_Points.push_back( p );
44           this->Modified( );
45         }
46
47       virtual void Modified( ) const cpExtensions_OVERRIDE;
48       void Clear( );
49       unsigned long GetNumberOfPoints( ) const;
50       const TMatrix& GetFrame( unsigned int id ) const;
51       const TPoint& GetPoint( unsigned int id ) const;
52       TVector GetVector( unsigned int id ) const;
53
54     protected:
55       Simple3DCurve( );
56       virtual ~Simple3DCurve( );
57
58     private:
59       // Purposely not implemented
60       Simple3DCurve( const Self& other );
61       Self& operator=( const Self& other );
62
63     protected:
64       std::vector< TPoint > m_Points;
65       mutable std::vector< TMatrix > m_Frames;
66       mutable bool m_FramesUpdated;
67     };
68
69   } // ecapseman
70
71 } // ecapseman
72
73 #endif // __cpExtensions__DataStructures__Simple3DCurve__h__
74
75 // eof - $RCSfile$