X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=plugins%2FExtensions%2FSkeleton.cxx;fp=plugins%2FExtensions%2FSkeleton.cxx;h=9e17f629a9255a184a61252b0c7175644d7ed701;hb=514419c89876aa75880cabee60c14f7582b1d33c;hp=0000000000000000000000000000000000000000;hpb=d74a07c7e0854fcfe2b0189805b992785f3631e8;p=cpPlugins.git diff --git a/plugins/Extensions/Skeleton.cxx b/plugins/Extensions/Skeleton.cxx new file mode 100644 index 0000000..9e17f62 --- /dev/null +++ b/plugins/Extensions/Skeleton.cxx @@ -0,0 +1,63 @@ +#include +#include +#include + +// ------------------------------------------------------------------------- +void cpPluginsExtensions::Skeleton:: +SetITK( itk::LightObject* o ) +{ + cpPlugins_Demangle_Skeleton_All_1( o, _ITK_2_VTK ) + { + this->m_VTK = NULL; + this->m_ITKvVTK = NULL; + } +} + +// ------------------------------------------------------------------------- +void cpPluginsExtensions::Skeleton:: +SetVTK( vtkObjectBase* o ) +{ + // Do nothing + this->m_ITK = NULL; + this->m_VTK = NULL; + this->m_ITKvVTK = NULL; +} + +// ------------------------------------------------------------------------- +cpPluginsExtensions::Skeleton:: +Skeleton( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPluginsExtensions::Skeleton:: +~Skeleton( ) +{ +} + +// ------------------------------------------------------------------------- +template< class _TSkeleton > +void cpPluginsExtensions::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$