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