]> Creatis software - FrontAlgorithms.git/blobdiff - plugins/fpa/BaseImageFilter.hxx
...
[FrontAlgorithms.git] / plugins / fpa / BaseImageFilter.hxx
index 6bce1d5540c0900fbd2778b23b91e9f5ba05181b..b8e02695f40cf5c73d2da28f167d9e9cb875c2a5 100644 (file)
@@ -11,14 +11,11 @@ _ConfigureFilter( )
 {
   typedef typename _TFilter::TInputImage _TImage;
   static const unsigned int Dim = _TImage::ImageDimension;
-  typedef
-    cpExtensions::DataStructures::ImageIndexesContainer< Dim >
-    _TIndexes;
 
-  auto image = this->GetInputData( "Input" )->GetITK< _TImage >( );
+  auto image = this->GetInputData< _TImage >( "Input" );
   if( image == NULL )
     return( NULL );
-  auto indexes = this->GetInputData( "Seeds" )->GetITK< _TIndexes >( );
+  auto seeds = this->GetInputData< vtkPoints >( "Seeds" );
 
   // Create filter and connect input
   auto filter = this->_CreateITK< _TFilter >( );
@@ -32,11 +29,24 @@ _ConfigureFilter( )
 
   // Assign seeds
   filter->ClearSeeds( );
-  if( indexes != NULL )
+  if( seeds != NULL )
   {
-    auto iIt = indexes->Get( ).begin( );
-    for( ; iIt != indexes->Get( ).end( ); ++iIt )
-      filter->AddSeed( *iIt, 0 );
+    typename _TImage::PointType pnt;
+    typename _TImage::IndexType idx;
+    unsigned int dim =
+      ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
+    for( unsigned int i = 0; i < seeds->GetNumberOfPoints( ); ++i )
+    {
+      double buf[ 3 ];
+      seeds->GetPoint( i, buf );
+      pnt.Fill( 0 );
+      for( unsigned int d = 0; d < dim; ++d )
+        pnt[ d ] = buf[ d ];
+
+      if( image->TransformPhysicalPointToIndex( pnt, idx ) )
+        filter->AddSeed( idx, 0 );
+
+    } // rof
 
   } // fi
 
@@ -50,13 +60,12 @@ void fpaPlugins::BaseImageFilter::
 _ExecuteFilter( _TFilter* filter )
 {
   // Go!!!
-  this->_ConfigureDebugger( filter );
+  // this->_ConfigureDebugger( filter );
   filter->Update( );
-  this->_DeconfigureDebugger( filter );
+  // this->_DeconfigureDebugger( filter );
 
   // Connect output
-  auto out = this->GetOutputData( "Output" );
-  out->SetITK( filter->GetOutput( ) );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
 }
 
 // -------------------------------------------------------------------------