#include <map>
#include <set>
#include <vector>
-#include <itkLightObject.h>
+#include <itkDataObject.h>
#include <itkObjectFactory.h>
namespace cpExtensions
*/
template< class _TVertex, class _TCost, class _TIndex = unsigned long, class _TIndexCompare = std::less< _TIndex > >
class Graph
- : public itk::LightObject
+ : public itk::DataObject
{
public:
typedef Graph Self;
- typedef itk::LightObject Superclass;
+ typedef itk::DataObject Superclass;
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
public:
itkNewMacro( Self );
- itkTypeMacro( Graph, itk::LightObject );
+ itkTypeMacro( Graph, itk::DataObject );
public:
/*! \brief Iterators over vertices.
if( i > 0 )
{
lines->InsertNextCell( 2 );
+ lines->InsertCellPoint( points->GetNumberOfPoints( ) - 2 );
lines->InsertCellPoint( points->GetNumberOfPoints( ) - 1 );
- lines->InsertCellPoint( points->GetNumberOfPoints( ) );
} // fi
void cpPlugins::DataObjects::PolyLineParametricPath::
SetITK( itk::LightObject* o )
{
+ typedef cpExtensions::DataStructures::PolyLineParametricPath< 1 > _T1;
+ typedef cpExtensions::DataStructures::PolyLineParametricPath< 2 > _T2;
+ typedef cpExtensions::DataStructures::PolyLineParametricPath< 3 > _T3;
+ typedef cpExtensions::DataStructures::PolyLineParametricPath< 4 > _T4;
+
this->Superclass::SetITK( o );
- auto l1 = dynamic_cast< cpExtensions::DataStructures::PolyLineParametricPath< 1 >* >( o );
- auto l2 = dynamic_cast< cpExtensions::DataStructures::PolyLineParametricPath< 2 >* >( o );
- auto l3 = dynamic_cast< cpExtensions::DataStructures::PolyLineParametricPath< 3 >* >( o );
- auto l4 = dynamic_cast< cpExtensions::DataStructures::PolyLineParametricPath< 4 >* >( o );
+ auto l1 = dynamic_cast< _T1* >( o );
+ auto l2 = dynamic_cast< _T2* >( o );
+ auto l3 = dynamic_cast< _T3* >( o );
+ auto l4 = dynamic_cast< _T4* >( o );
if ( l1 != NULL ) this->_ITK_2_VTK( l1 );
else if( l2 != NULL ) this->_ITK_2_VTK( l2 );
else if( l3 != NULL ) this->_ITK_2_VTK( l3 );
--- /dev/null
+#include <cpPlugins/DataObjects/Skeleton.h>
+#include <cpExtensions/Visualization/SkeletonToPolyData.h>
+
+// -------------------------------------------------------------------------
+void cpPlugins::DataObjects::Skeleton::
+SetITK( itk::LightObject* o )
+{
+ typedef cpExtensions::DataStructures::Skeleton< 1 > _T1;
+ typedef cpExtensions::DataStructures::Skeleton< 2 > _T2;
+ typedef cpExtensions::DataStructures::Skeleton< 3 > _T3;
+ typedef cpExtensions::DataStructures::Skeleton< 4 > _T4;
+
+ this->Superclass::SetITK( o );
+ auto l1 = dynamic_cast< _T1* >( o );
+ auto l2 = dynamic_cast< _T2* >( o );
+ auto l3 = dynamic_cast< _T3* >( o );
+ auto l4 = dynamic_cast< _T4* >( o );
+ if ( l1 != NULL ) this->_ITK_2_VTK( l1 );
+ else if( l2 != NULL ) this->_ITK_2_VTK( l2 );
+ else if( l3 != NULL ) this->_ITK_2_VTK( l3 );
+ else if( l4 != NULL ) this->_ITK_2_VTK( l4 );
+ else
+ {
+ this->m_VTK = NULL;
+ this->m_ITKvVTK = NULL;
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::DataObjects::Skeleton::
+SetVTK( vtkObjectBase* o )
+{
+ // Do nothing
+ this->m_ITK = NULL;
+ this->m_VTK = NULL;
+ this->m_ITKvVTK = NULL;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::DataObjects::Skeleton::
+Skeleton( )
+ : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::DataObjects::Skeleton::
+~Skeleton( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TSkeleton >
+void cpPlugins::DataObjects::Skeleton::
+_ITK_2_VTK( _TSkeleton* sk )
+{
+ typedef
+ cpExtensions::Visualization::SkeletonToPolyData< _TSkeleton >
+ _TFilter;
+ _TFilter* f = dynamic_cast< _TFilter* >( this->m_ITKvVTK.GetPointer( ) );
+ if( f == NULL )
+ {
+ _TFilter* nf = _TFilter::New( );
+ this->m_ITKvVTK = nf;
+ f = nf;
+
+ } // fi
+ f->SetInput( sk );
+ f->Update( );
+
+ // Keep object track
+ this->m_ITK = sk;
+ this->m_VTK = f->GetOutput( );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __cpPlugins__DataObjects__Skeleton__h__
+#define __cpPlugins__DataObjects__Skeleton__h__
+
+#include <cpPlugins/BaseObjects/DataObject.h>
+#include <cpPlugins_Paths.h>
+#include <vtkSmartPointer.h>
+
+// -------------------------------------------------------------------------
+class vtkPolyDataAlgorithm;
+
+// -------------------------------------------------------------------------
+namespace cpPlugins
+{
+ namespace DataObjects
+ {
+ /**
+ */
+ class cpPlugins_EXPORT Skeleton
+ : public cpPlugins::BaseObjects::DataObject
+ {
+ public:
+ typedef Skeleton Self;
+ typedef cpPlugins::BaseObjects::DataObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro(
+ Skeleton, cpPlugins::BaseObjects::DataObject
+ );
+ cpPlugins_Id_Macro( Skeleton, Object );
+ cpPlugins_Compatibility_Macro;
+
+ public:
+ virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE;
+ virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE;
+
+ protected:
+ Skeleton( );
+ virtual ~Skeleton( );
+
+ template< class _TSkeleton >
+ inline void _ITK_2_VTK( _TSkeleton* sk );
+
+ private:
+ // Purposely not implemented
+ Skeleton( const Self& );
+ Self& operator=( const Self& );
+
+ protected:
+ vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __cpPlugins__DataObjects__Skeleton__h__
+
+// eof - $RCSfile$