]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/DataStructures/PolyLineParametricPath.h
yet another refactoring
[cpPlugins.git] / lib / cpExtensions / DataStructures / PolyLineParametricPath.h
diff --git a/lib/cpExtensions/DataStructures/PolyLineParametricPath.h b/lib/cpExtensions/DataStructures/PolyLineParametricPath.h
new file mode 100644 (file)
index 0000000..7f12200
--- /dev/null
@@ -0,0 +1,100 @@
+#ifndef __cpExtensions__DataStructures__PolyLineParametricPath__h__
+#define __cpExtensions__DataStructures__PolyLineParametricPath__h__
+
+#include <itkPolyLineParametricPath.h>
+#include <itkImageBase.h>
+#include <cpExtensions/Algorithms/BezierCurveFunction.h>
+
+namespace cpExtensions
+{
+  namespace DataStructures
+  {
+    /**
+     */
+    template< unsigned int _VDim >
+    class PolyLineParametricPath
+      : public itk::PolyLineParametricPath< _VDim >
+    {
+    public:
+      typedef PolyLineParametricPath               Self;
+      typedef itk::PolyLineParametricPath< _VDim > Superclass;
+      typedef itk::SmartPointer< Self >            Pointer;
+      typedef itk::SmartPointer< const Self >      ConstPointer;
+
+      typedef itk::ImageBase< _VDim >                  TImageBase;
+      typedef typename TImageBase::SpacingType         TSpacing;
+      typedef typename TImageBase::PointType           TPoint;
+      typedef typename TImageBase::DirectionType       TDirection;
+      typedef typename Superclass::ContinuousIndexType TContinuousIndex;
+      typedef typename TContinuousIndex::IndexType     TIndex;
+
+      typedef typename TPoint::VectorType TVector;
+      typedef cpExtensions::Algorithms::BezierCurveFunction< TVector > TBezier;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( PolyLineParametricPath, itk::PolyLineParametricPath );
+
+      itkGetConstReferenceMacro( Spacing, TSpacing );
+      itkGetConstReferenceMacro( Origin, TPoint );
+      itkGetConstReferenceMacro( Direction, TDirection );
+      itkGetConstReferenceMacro( InverseDirection, TDirection );
+
+      itkSetMacro( Origin, TPoint );
+
+    public:
+      void AddVertex( const TContinuousIndex& vertex );
+      unsigned long GetSize( ) const;
+      TContinuousIndex GetContinuousVertex( unsigned long i ) const;
+      TIndex GetVertex( unsigned long i ) const;
+      TPoint GetPoint( unsigned long i ) const;
+      TPoint GetSmoothPoint( double u ) const;
+
+      virtual void SetSpacing( const TSpacing& spac );
+      virtual void SetSpacing( const double spac[ _VDim ] );
+      virtual void SetSpacing( const float spac[ _VDim ] );
+      virtual void SetOrigin( const double ori[ _VDim ] );
+      virtual void SetOrigin( const float ori[ _VDim ] );
+      virtual void SetDirection( const TDirection& dir );
+
+      template< class _TRefImage >
+      inline void SetReferenceImage( const _TRefImage* image )
+        {
+          this->SetSpacing( image->GetSpacing( ) );
+          this->SetOrigin( image->GetOrigin( ) );
+          this->SetDirection( image->GetDirection( ) );
+        }
+
+    protected:
+      PolyLineParametricPath( );
+      virtual ~PolyLineParametricPath( );
+
+      virtual void _ComputeIndexToPhysicalPointMatrices( );
+
+    private:
+      // Purposely not implemented
+      PolyLineParametricPath( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      typename TBezier::Pointer m_Bezier;
+      TSpacing   m_Spacing;
+      TPoint     m_Origin;
+      TDirection m_Direction;
+      TDirection m_InverseDirection;
+      TDirection m_IndexToPhysicalPoint;
+      TDirection m_PhysicalPointToIndex;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <cpExtensions/DataStructures/PolyLineParametricPath.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __cpExtensions__DataStructures__PolyLineParametricPath__h__
+
+// eof - $RCSfile$