]> Creatis software - FrontAlgorithms.git/blob - plugins/ImageAlgorithms/SkeletonFilter.cxx
274dc651717e25bae44bb62a4fd88cdefcdeb74e
[FrontAlgorithms.git] / plugins / ImageAlgorithms / SkeletonFilter.cxx
1 #include "SkeletonFilter.h"
2 #include <cpInstances/DataObjects/Image.h>
3 #include <cpInstances/DataObjects/Skeleton.h>
4
5 // -------------------------------------------------------------------------
6 fpaPlugins_ImageAlgorithms::SkeletonFilter::
7 SkeletonFilter( )
8   : Superclass( )
9 {
10   typedef cpPlugins::Pipeline::DataObject    _TData;
11   typedef cpInstances::DataObjects::Image    _TImage;
12   typedef cpInstances::DataObjects::Skeleton _TSkeleton;
13
14   this->_ConfigureInput< _TImage >( "Input", true, false );
15   this->_ConfigureInput< _TData >( "Seeds", true, false );
16   this->_ConfigureOutput< _TSkeleton >( "Output" );
17 }
18
19 // -------------------------------------------------------------------------
20 fpaPlugins_ImageAlgorithms::SkeletonFilter::
21 ~SkeletonFilter( )
22 {
23 }
24
25 // -------------------------------------------------------------------------
26 void fpaPlugins_ImageAlgorithms::SkeletonFilter::
27 _GenerateData( )
28 {
29   /* TODO
30      typedef fpa::Image::MinimumSpanningTree< 2 > _TMST2;
31      typedef fpa::Image::MinimumSpanningTree< 3 > _TMST3;
32
33      auto mst2 = this->GetInputData< _TMST2 >( "MST" );
34      auto mst3 = this->GetInputData< _TMST3 >( "MST" );
35      if     ( mst2 != NULL ) this->_GD0( mst2 );
36      else if( mst3 != NULL ) this->_GD0( mst3 );
37      else this->_Error( "Invalid input spanning tree." );
38   */
39 }
40
41 // -------------------------------------------------------------------------
42 template< class _TImage >
43 void fpaPlugins_ImageAlgorithms::SkeletonFilter::
44 _GD0( _TImage* image )
45 {
46   /* TODO
47      typedef typename _TMST::IndexType _TIndex;
48      typedef typename _TMST::TPath     _TPath;
49
50      // Get seeds
51      std::vector< _TIndex > seeds;
52      auto points = this->GetInputData< vtkPolyData >( "Seeds" );
53      if( points != NULL )
54      {
55      if( points->GetNumberOfPoints( ) < 2 )
56      this->_Error( "Not enough seeds (<2)." );
57
58      typename _TMST::PointType pnt;
59      typename _TMST::IndexType idx;
60      unsigned int dim =
61      ( _TMST::ImageDimension < 3 )? _TMST::ImageDimension: 3;
62      for( unsigned int i = 0; i < 2; ++i )
63      {
64      double buf[ 3 ];
65      points->GetPoint( i, buf );
66      pnt.Fill( 0 );
67      for( unsigned int d = 0; d < dim; ++d )
68      pnt[ d ] = buf[ d ];
69      if( mst->TransformPhysicalPointToIndex( pnt, idx ) )
70      seeds.push_back( idx );
71
72      } // rof
73
74      } // fi
75
76      typename _TPath::Pointer path;
77      mst->GetPath( path, seeds[ 0 ], seeds[ 1 ] );
78      this->GetOutput( "Output" )->SetITK( path );
79   */
80 }
81
82 // eof - $RCSfile$