]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/DataStructures/PolyLineParametricPath.h
3358d0fc4c13d130b6bb34b6ce23068c9eb8c2d3
[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
30       typedef typename TPoint::VectorType TVector;
31       typedef cpExtensions::Algorithms::BezierCurveFunction< TVector > TBezier;
32
33     public:
34       itkNewMacro( Self );
35       itkTypeMacro( PolyLineParametricPath, itk::PolyLineParametricPath );
36
37       itkGetConstReferenceMacro( Spacing, TSpacing );
38       itkGetConstReferenceMacro( Origin, TPoint );
39       itkGetConstReferenceMacro( Direction, TDirection );
40       itkGetConstReferenceMacro( InverseDirection, TDirection );
41
42       itkSetMacro( Origin, TPoint );
43
44     public:
45       void AddVertex( const TContinuousIndex& vertex );
46       unsigned long GetSize( ) const;
47       TContinuousIndex GetVertex( unsigned long i ) const;
48       TPoint GetPoint( unsigned long i ) const;
49       TPoint GetSmoothPoint( double u ) const;
50
51       virtual void SetSpacing( const TSpacing& spac );
52       virtual void SetSpacing( const double spac[ _VDim ] );
53       virtual void SetSpacing( const float spac[ _VDim ] );
54       virtual void SetOrigin( const double ori[ _VDim ] );
55       virtual void SetOrigin( const float ori[ _VDim ] );
56       virtual void SetDirection( const TDirection& dir );
57
58       template< class _TRefImage >
59       inline void SetReferenceImage( const _TRefImage* image )
60         {
61           this->SetSpacing( image->GetSpacing( ) );
62           this->SetOrigin( image->GetOrigin( ) );
63           this->SetDirection( image->GetDirection( ) );
64         }
65
66     protected:
67       PolyLineParametricPath( );
68       virtual ~PolyLineParametricPath( );
69
70       virtual void _ComputeIndexToPhysicalPointMatrices( );
71
72     private:
73       // Purposely not implemented
74       PolyLineParametricPath( const Self& other );
75       Self& operator=( const Self& other );
76
77     protected:
78       typename TBezier::Pointer m_Bezier;
79  
80       TSpacing   m_Spacing;
81       TPoint     m_Origin;
82       TDirection m_Direction;
83       TDirection m_InverseDirection;
84       TDirection m_IndexToPhysicalPoint;
85       TDirection m_PhysicalPointToIndex;
86     };
87
88   } // ecapseman
89
90 } // ecapseman
91
92 #ifndef ITK_MANUAL_INSTANTIATION
93 #  include <cpExtensions/DataStructures/PolyLineParametricPath.hxx>
94 #endif // ITK_MANUAL_INSTANTIATION
95
96 #endif // __cpExtensions__DataStructures__PolyLineParametricPath__h__
97
98 // eof - $RCSfile$