]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/DataStructures/PolyLineParametricPath.h
7f122000948b60793d6f995152980e75939efd55
[cpPlugins.git] / lib / cpExtensions / DataStructures / PolyLineParametricPath.h
1 #ifndef __cpExtensions__DataStructures__PolyLineParametricPath__h__
2 #define __cpExtensions__DataStructures__PolyLineParametricPath__h__
3
4 #include <itkPolyLineParametricPath.h>
5 #include <itkImageBase.h>
6 #include <cpExtensions/Algorithms/BezierCurveFunction.h>
7
8 namespace cpExtensions
9 {
10   namespace DataStructures
11   {
12     /**
13      */
14     template< unsigned int _VDim >
15     class PolyLineParametricPath
16       : public itk::PolyLineParametricPath< _VDim >
17     {
18     public:
19       typedef PolyLineParametricPath               Self;
20       typedef itk::PolyLineParametricPath< _VDim > Superclass;
21       typedef itk::SmartPointer< Self >            Pointer;
22       typedef itk::SmartPointer< const Self >      ConstPointer;
23
24       typedef itk::ImageBase< _VDim >                  TImageBase;
25       typedef typename TImageBase::SpacingType         TSpacing;
26       typedef typename TImageBase::PointType           TPoint;
27       typedef typename TImageBase::DirectionType       TDirection;
28       typedef typename Superclass::ContinuousIndexType TContinuousIndex;
29       typedef typename TContinuousIndex::IndexType     TIndex;
30
31       typedef typename TPoint::VectorType TVector;
32       typedef cpExtensions::Algorithms::BezierCurveFunction< TVector > TBezier;
33
34     public:
35       itkNewMacro( Self );
36       itkTypeMacro( PolyLineParametricPath, itk::PolyLineParametricPath );
37
38       itkGetConstReferenceMacro( Spacing, TSpacing );
39       itkGetConstReferenceMacro( Origin, TPoint );
40       itkGetConstReferenceMacro( Direction, TDirection );
41       itkGetConstReferenceMacro( InverseDirection, TDirection );
42
43       itkSetMacro( Origin, TPoint );
44
45     public:
46       void AddVertex( const TContinuousIndex& vertex );
47       unsigned long GetSize( ) const;
48       TContinuousIndex GetContinuousVertex( unsigned long i ) const;
49       TIndex GetVertex( unsigned long i ) const;
50       TPoint GetPoint( unsigned long i ) const;
51       TPoint GetSmoothPoint( double u ) const;
52
53       virtual void SetSpacing( const TSpacing& spac );
54       virtual void SetSpacing( const double spac[ _VDim ] );
55       virtual void SetSpacing( const float spac[ _VDim ] );
56       virtual void SetOrigin( const double ori[ _VDim ] );
57       virtual void SetOrigin( const float ori[ _VDim ] );
58       virtual void SetDirection( const TDirection& dir );
59
60       template< class _TRefImage >
61       inline void SetReferenceImage( const _TRefImage* image )
62         {
63           this->SetSpacing( image->GetSpacing( ) );
64           this->SetOrigin( image->GetOrigin( ) );
65           this->SetDirection( image->GetDirection( ) );
66         }
67
68     protected:
69       PolyLineParametricPath( );
70       virtual ~PolyLineParametricPath( );
71
72       virtual void _ComputeIndexToPhysicalPointMatrices( );
73
74     private:
75       // Purposely not implemented
76       PolyLineParametricPath( const Self& other );
77       Self& operator=( const Self& other );
78
79     protected:
80       typename TBezier::Pointer m_Bezier;
81  
82       TSpacing   m_Spacing;
83       TPoint     m_Origin;
84       TDirection m_Direction;
85       TDirection m_InverseDirection;
86       TDirection m_IndexToPhysicalPoint;
87       TDirection m_PhysicalPointToIndex;
88     };
89
90   } // ecapseman
91
92 } // ecapseman
93
94 #ifndef ITK_MANUAL_INSTANTIATION
95 #  include <cpExtensions/DataStructures/PolyLineParametricPath.hxx>
96 #endif // ITK_MANUAL_INSTANTIATION
97
98 #endif // __cpExtensions__DataStructures__PolyLineParametricPath__h__
99
100 // eof - $RCSfile$