]> Creatis software - FrontAlgorithms.git/blobdiff - plugins/Plugins/ImagePathToPolyDataFilter.cxx
...
[FrontAlgorithms.git] / plugins / Plugins / ImagePathToPolyDataFilter.cxx
diff --git a/plugins/Plugins/ImagePathToPolyDataFilter.cxx b/plugins/Plugins/ImagePathToPolyDataFilter.cxx
deleted file mode 100644 (file)
index eb0f689..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-#include "ImagePathToPolyDataFilter.h"
-#include <cpPlugins/DataObjects/Image.h>
-#include <cpPlugins/DataObjects/Mesh.h>
-#include <fpa/Base/MinimumSpanningTree.h>
-#include <fpa/VTK/Image/PathToPolyDataFilter.h>
-#include <fpa/VTK/Image/PathToPolyDataFilter.hxx>
-
-// -------------------------------------------------------------------------
-fpaPlugins::ImagePathToPolyDataFilter::
-ImagePathToPolyDataFilter( )
-  : Superclass( )
-{
-  this->_ConfigureInput< cpPlugins::BaseObjects::DataObject >( "MST", true, false );
-  this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Image", true, false );
-  this->_ConfigureInput< cpPlugins::BaseObjects::DataObject >( "Seeds", true, false );
-  this->_ConfigureOutput< cpPlugins::DataObjects::Mesh >( "Output" );
-
-  this->m_Parameters.ConfigureAsUint( "Seed0" );
-  this->m_Parameters.ConfigureAsUint( "Seed1" );
-  this->m_Parameters.SetUint( "Seed0", 0 );
-  this->m_Parameters.SetUint( "Seed1", 1 );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins::ImagePathToPolyDataFilter::
-~ImagePathToPolyDataFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPlugins::ImagePathToPolyDataFilter::
-_GenerateData( )
-{
-  auto i2 = this->GetInputData< itk::ImageBase< 2 > >( "Image" );
-  auto i3 = this->GetInputData< itk::ImageBase< 3 > >( "Image" );
-  if( i2 != NULL )
-    this->_GD0( i2 );
-  else if( i3 != NULL )
-    this->_GD0( i3 );
-  else
-    this->_Error( "No valid input image." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpaPlugins::ImagePathToPolyDataFilter::
-_GD0( _TImage* image )
-{
-  typedef typename _TImage::IndexType            _TIndex;
-  typedef typename _TIndex::LexicographicCompare _TComp;
-  typedef fpa::Base::MinimumSpanningTree< _TIndex, float, _TComp >  _TFloat;
-  typedef fpa::Base::MinimumSpanningTree< _TIndex, double, _TComp > _TDouble;
-
-  auto mf = this->GetInputData< _TFloat >( "MST" );
-  auto md = this->GetInputData< _TDouble >( "MST" );
-  if( mf != NULL )
-    this->_GD1( image, mf );
-  else if( md != NULL )
-    this->_GD1( image, md );
-  else
-    this->_Error( "No valid input minimum spanning tree." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage, class _TMST >
-void fpaPlugins::ImagePathToPolyDataFilter::
-_GD1( _TImage* image, _TMST* mst )
-{
-  typedef fpa::VTK::Image::PathToPolyDataFilter< _TMST > _TFilter;
-  auto seeds = this->GetInputData< vtkPolyData >( "Seeds" )->GetPoints( );
-  if( seeds->GetNumberOfPoints( ) < 2 )
-    this->_Error( "Not enough seeds." );
-
-  auto filter = this->_CreateVTK< _TFilter >( );
-  filter->SetImage( image );
-  filter->SetMinimumSpanningTree( mst );
-
-  typename _TImage::PointType pnt;
-  typename _TImage::IndexType idx;
-  unsigned int dim =
-    ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
-  double buf[ 3 ];
-  seeds->GetPoint( this->m_Parameters.GetUint( "Seed0" ), buf );
-  pnt.Fill( 0 );
-  for( unsigned int d = 0; d < dim; ++d )
-    pnt[ d ] = buf[ d ];
-  if( image->TransformPhysicalPointToIndex( pnt, idx ) )
-    filter->SetSeed0( idx );
-  seeds->GetPoint( this->m_Parameters.GetUint( "Seed1" ), buf );
-  pnt.Fill( 0 );
-  for( unsigned int d = 0; d < dim; ++d )
-    pnt[ d ] = buf[ d ];
-  if( image->TransformPhysicalPointToIndex( pnt, idx ) )
-    filter->SetSeed1( idx );
-  filter->Update( );
-  this->GetOutput( "Output" )->SetVTK( filter->GetOutput( ) );
-}
-
-// eof - $RCSfile$