]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Sat, 13 Feb 2016 22:25:02 +0000 (17:25 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Sat, 13 Feb 2016 22:25:02 +0000 (17:25 -0500)
14 files changed:
lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx
lib/fpaPlugins/BaseImageFilter.cxx
lib/fpaPlugins/BaseImageFilter.h
lib/fpaPlugins/BaseImageFilter.hxx [new file with mode: 0644]
lib/fpaPlugins/GrowFunction.cxx
lib/fpaPlugins/GrowFunction.h
lib/fpaPlugins/GrowFunction.hxx
lib/fpaPlugins/ImageDijkstra.cxx
lib/fpaPlugins/ImageRegionGrow.cxx
lib/fpaPlugins/MinimumSpanningTree.cxx
lib/fpaPlugins/MinimumSpanningTree.h
lib/fpaPlugins/MinimumSpanningTree.hxx
lib/fpaPlugins/MinimumSpanningTreeToMesh.cxx
lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx

index 89a683c99adbe90dc482b4e58551f4a2c2bbc4d2..7e76aefcffecdc538eaeff1d4fab444c415f3e40 100644 (file)
@@ -26,15 +26,11 @@ _GenerateData( )
 {
   auto image =
     this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" );
-  if( image == NULL )
-    return( "fpaPlugins::AllPixelsImageGrowFunctionSource: No input reference image." );
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
   else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
   else r = "fpaPlugins::AllPixelsImageGrowFunctionSource: no valid reference image.";
-
   return( r );
 }
 
@@ -44,17 +40,16 @@ std::string fpaPlugins::AllPixelsImageGrowFunctionSource::
 _GD0( itk::DataObject* data )
 {
   typedef fpa::Image::Functors::RegionGrowAllBelongsFunction< I > _F;
-  typename _F::Pointer functor = _F::New( );
-
-  // Connect output
   auto out = this->GetOutputData< GrowFunction >( "Output" );
-  if( out != NULL )
+  auto f = out->GetITK< _F >( );
+  if( f == NULL )
   {
-    out->SetITK< _F >( functor );
-    return( "" );
-  }
-  else
-    return( "fpaPlugins::AllPixelsImageGrowFunctionSource: output not correctly created." );
+    typename _F::Pointer ptr_f = _F::New( );
+    f = ptr_f.GetPointer( );
+    out->SetITK( f );
+
+  } // fi
+  return( "" );
 }
 
 // eof - $RCSfile$
index 422d83b1a739cc4b86e81194c6ba3faeef0b22c8..19a15330e9826ac3605f5b310ff477618bfd3b03 100644 (file)
@@ -5,6 +5,20 @@ fpaPlugins::BaseImageFilter::
 BaseImageFilter( )
   : Superclass( )
 {
+  this->_AddInput( "Input" );
+  this->_AddInput( "Seeds" );
+  this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
+
+  this->m_Parameters->ConfigureAsBool( "VisualDebug" );
+  this->m_Parameters->ConfigureAsBool( "StopAtOneFront" );
+  this->m_Parameters->SetBool( "VisualDebug", false );
+  this->m_Parameters->SetBool( "StopAtOneFront", false );
+
+  std::vector< std::string > orders;
+  orders.push_back( "1" );
+  orders.push_back( "2" );
+  this->m_Parameters->ConfigureAsChoices( "NeighborhoodOrder", orders );
+  this->m_Parameters->SetSelectedChoice( "NeighborhoodOrder", "1" );
 }
 
 // -------------------------------------------------------------------------
index 991a2c0cbf8e70d20c4a3e35922cb5a254de96e2..2deeb5bdd414e7775e216563f7d17aa6b87016be 100644 (file)
@@ -30,10 +30,16 @@ namespace fpaPlugins
     virtual ~BaseImageFilter( );
 
     template< class F >
-      void _ConfigureDebugger( F* filter );
+      inline F* _ConfigureFilter( );
 
     template< class F >
-      void _DeconfigureDebugger( F* filter );
+      inline void _ExecuteFilter( F* filter );
+
+    template< class F >
+      inline void _ConfigureDebugger( F* filter );
+
+    template< class F >
+      inline void _DeconfigureDebugger( F* filter );
 
   private:
     // Purposely not implemented.
@@ -46,88 +52,7 @@ namespace fpaPlugins
 
 } // ecapseman
 
-// -------------------------------------------------------------------------
-#include <fpa/VTK/Image2DObserver.h>
-#include <fpa/VTK/Image3DObserver.h>
-#include <cpPlugins/Interface/SimpleMPRWidget.h>
-#include <vtkRenderWindowInteractor.h>
-
-// -------------------------------------------------------------------------
-template< class F >
-void fpaPlugins::BaseImageFilter::
-_ConfigureDebugger( F* filter )
-{
-  typedef typename F::TInputImage _I;
-  typedef fpa::VTK::Image2DObserver< F, vtkRenderWindow > _2D;
-  typedef fpa::VTK::Image3DObserver< F, vtkRenderWindow > _3D;
-
-  this->m_Observers.clear( );
-  if( this->m_Parameters->GetBool( "VisualDebug" ) )
-  {
-    if( this->m_MPRViewer != NULL )
-    {
-      if( _I::ImageDimension == 2 )
-      {
-        auto iren = this->m_MPRViewer->GetInteractor( 2 );
-        if( iren != NULL )
-        {
-          typename _2D::Pointer debugger = _2D::New( );
-          debugger->SetRenderWindow( iren->GetRenderWindow( ) );
-          debugger->SetRenderPercentage( 0.01 );
-          this->m_Observers.insert(
-            filter->AddObserver( itk::AnyEvent( ), debugger )
-            );
-          filter->ThrowEventsOn( );
-
-        } // fi
-      }
-      else if( _I::ImageDimension == 3 )
-      {
-        auto iren = this->m_MPRViewer->GetInteractor( 2 );
-        if( iren != NULL )
-        {
-          typename _3D::Pointer debugger = _3D::New( );
-          debugger->SetRenderWindow( iren->GetRenderWindow( ) );
-          debugger->SetRenderPercentage( 0.001 );
-          this->m_Observers.insert(
-            filter->AddObserver( itk::AnyEvent( ), debugger )
-            );
-          filter->ThrowEventsOn( );
-
-        } // fi
-
-      } // fi
-
-    } // fi
-
-    if( this->m_SingleInteractor != NULL )
-    {
-      if( _I::ImageDimension == 2 )
-      {
-      }
-      else if( _I::ImageDimension == 3 )
-      {
-      } // fi
-
-    } // fi
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-template< class F >
-void fpaPlugins::BaseImageFilter::
-_DeconfigureDebugger( F* filter )
-{
-  if( filter != NULL )
-  {
-    auto oIt = this->m_Observers.begin( );
-    for( ; oIt != this->m_Observers.end( ); ++oIt )
-      filter->RemoveObserver( *oIt );
-
-  } // fi
-  this->m_Observers.clear( );
-}
+#include <fpaPlugins/BaseImageFilter.hxx>
 
 #endif // __FPAPLUGINS__BASEIMAGEFILTER__H__
 
diff --git a/lib/fpaPlugins/BaseImageFilter.hxx b/lib/fpaPlugins/BaseImageFilter.hxx
new file mode 100644 (file)
index 0000000..22d8837
--- /dev/null
@@ -0,0 +1,148 @@
+#ifndef __FPAPLUGINS__BASEIMAGEFILTER__HXX__
+#define __FPAPLUGINS__BASEIMAGEFILTER__HXX__
+
+#include <cpPlugins/Interface/Image.h>
+#include <cpPlugins/Interface/PointList.h>
+#include <cpPlugins/Interface/SimpleMPRWidget.h>
+
+#include <fpa/VTK/Image2DObserver.h>
+#include <fpa/VTK/Image3DObserver.h>
+
+#include <vtkRenderWindowInteractor.h>
+
+// -------------------------------------------------------------------------
+template< class F >
+F* fpaPlugins::BaseImageFilter::
+_ConfigureFilter( )
+{
+  typedef typename F::TInputImage _I;
+  typedef typename _I::PointType  _P;
+
+  auto image =
+    this->GetInputData< cpPlugins::Interface::Image >( "Input" )->
+    GetITK< _I >( );
+  auto seeds =
+    this->GetInputData< cpPlugins::Interface::PointList >( "Seeds" );
+
+  // Create filter and connect input
+  F* filter = this->_CreateITK< F >( );
+  filter->SetInput( image );
+
+  // Set numeric parameters
+  Superclass::TParameters* params = this->m_Parameters;
+  filter->SetNeighborhoodOrder(
+    params->GetSelectedChoice( "NeighborhoodOrder" )[ 0 ] - '0'
+    );
+  filter->SetStopAtOneFront( params->GetBool( "StopAtOneFront" ) );
+
+  // Assign seeds
+  filter->ClearSeeds( );
+  for( unsigned int s = 0; s < seeds->GetNumberOfPoints( ); ++s )
+  {
+    _P pnt = seeds->GetPoint< _P >( s );
+    typename _I::IndexType idx;
+    if( image->TransformPhysicalPointToIndex( pnt, idx ) )
+      filter->AddSeed( idx, 0 );
+
+  } // rof
+
+  // Ok!
+  return( filter );
+}
+
+// -------------------------------------------------------------------------
+template< class F >
+void fpaPlugins::BaseImageFilter::
+_ExecuteFilter( F* filter )
+{
+  // Go!!!
+  this->_ConfigureDebugger( filter );
+  filter->Update( );
+  this->_DeconfigureDebugger( filter );
+
+  // Connect output
+  auto out =
+    this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+  out->SetITK( filter->GetOutput( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class F >
+void fpaPlugins::BaseImageFilter::
+_ConfigureDebugger( F* filter )
+{
+  typedef typename F::TInputImage _I;
+  typedef fpa::VTK::Image2DObserver< F, vtkRenderWindow > _2D;
+  typedef fpa::VTK::Image3DObserver< F, vtkRenderWindow > _3D;
+
+  this->m_Observers.clear( );
+  if( this->m_Parameters->GetBool( "VisualDebug" ) )
+  {
+    if( this->m_MPRViewer != NULL )
+    {
+      if( _I::ImageDimension == 2 )
+      {
+        auto iren = this->m_MPRViewer->GetInteractor( 2 );
+        if( iren != NULL )
+        {
+          typename _2D::Pointer debugger = _2D::New( );
+          debugger->SetRenderWindow( iren->GetRenderWindow( ) );
+          debugger->SetRenderPercentage( 0.01 );
+          this->m_Observers.insert(
+            filter->AddObserver( itk::AnyEvent( ), debugger )
+            );
+          filter->ThrowEventsOn( );
+
+        } // fi
+      }
+      else if( _I::ImageDimension == 3 )
+      {
+        auto iren = this->m_MPRViewer->GetInteractor( 2 );
+        if( iren != NULL )
+        {
+          typename _3D::Pointer debugger = _3D::New( );
+          debugger->SetRenderWindow( iren->GetRenderWindow( ) );
+          debugger->SetRenderPercentage( 0.001 );
+          this->m_Observers.insert(
+            filter->AddObserver( itk::AnyEvent( ), debugger )
+            );
+          filter->ThrowEventsOn( );
+
+        } // fi
+
+      } // fi
+
+    } // fi
+
+    if( this->m_SingleInteractor != NULL )
+    {
+      if( _I::ImageDimension == 2 )
+      {
+      }
+      else if( _I::ImageDimension == 3 )
+      {
+      } // fi
+
+    } // fi
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class F >
+void fpaPlugins::BaseImageFilter::
+_DeconfigureDebugger( F* filter )
+{
+  if( filter != NULL )
+  {
+    auto oIt = this->m_Observers.begin( );
+    for( ; oIt != this->m_Observers.end( ); ++oIt )
+      filter->RemoveObserver( *oIt );
+
+  } // fi
+  this->m_Observers.clear( );
+}
+
+#endif // __FPAPLUGINS__BASEIMAGEFILTER__HXX__
+
+// eof - $RCSfile$
index 9b6d0d93944e166e12d3eeece1a0f801f7e7ee86..8cc392f48004d2e09f726a716e221dc822da91d7 100644 (file)
@@ -1,5 +1,12 @@
 #include <fpaPlugins/GrowFunction.h>
 
+// -------------------------------------------------------------------------
+void fpaPlugins::GrowFunction::
+SetVTK( vtkObjectBase* o )
+{
+  // Do nothing: this has only sense in ITK
+}
+
 // -------------------------------------------------------------------------
 fpaPlugins::GrowFunction::
 GrowFunction( )
index cca92ab107c55ed69ec65ec438d067d1784c8ccd..9bcd8874eda714d17e5d8122ded4c19cff2b56ab 100644 (file)
@@ -26,8 +26,7 @@ namespace fpaPlugins
     cpPlugins_Id_Macro( GrowFunction, GrowFunction );
 
   public:
-    template< class F >
-      inline void SetITK( itk::Object* object );
+    virtual void SetVTK( vtkObjectBase* o );
 
   protected:
     GrowFunction( );
index 00c2cba23dd997eeaab2d1d6cfd9658468909b5b..a8e84b755528795aa92186170d969d31eecab15b 100644 (file)
@@ -1,26 +1,7 @@
 #ifndef __FPAPLUGINS__GROWFUNCTION__HXX__
 #define __FPAPLUGINS__GROWFUNCTION__HXX__
 
-#include <itkFunctionBase.h>
-
-// -------------------------------------------------------------------------
-template< class F >
-void fpaPlugins::GrowFunction::
-SetITK( itk::Object* object )
-{
-  typedef typename F::TSpace                  _TSpace;
-  typedef typename F::TVertex                 _TVertex;
-  typedef itk::FunctionBase< _TVertex, bool > _TBaseFunction;
-
-  _TBaseFunction* function = dynamic_cast< _TBaseFunction* >( object );
-  if( function != NULL )
-  {
-    this->m_ITKObject = function;
-    this->m_VTKObject = NULL;
-    this->Modified( );
-
-  } // fi
-}
+// TODO: erase this file
 
 #endif // __FPAPLUGINS__GROWFUNCTION__HXX__
 
index 185859eca95c6e33ae8996386837e1b425543c4b..37e16daf053c5f5d9d05fc4ef7fdca045de0ca81 100644 (file)
@@ -1,37 +1,17 @@
 #include "ImageDijkstra.h"
 
 #include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Interface/PointList.h>
 #include <fpaPlugins/MinimumSpanningTree.h>
 
 #include <fpa/Image/Dijkstra.h>
-#include <fpa/VTK/Image2DObserver.h>
-#include <fpa/VTK/Image3DObserver.h>
 #include <fpa/Base/Functors/InvertCostFunction.h>
 
-#include <vtkRenderWindow.h>
-#include <vtkRenderWindowInteractor.h>
-
 // -------------------------------------------------------------------------
 fpaPlugins::ImageDijkstra::
 ImageDijkstra( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
-  this->_AddInput( "Seeds" );
-  this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
   this->_AddOutput< fpaPlugins::MinimumSpanningTree >( "MinimumSpanningTree" );
-
-  this->m_Parameters->ConfigureAsBool( "VisualDebug" );
-  this->m_Parameters->ConfigureAsBool( "StopAtOneFront" );
-  this->m_Parameters->SetBool( "VisualDebug", false );
-  this->m_Parameters->SetBool( "StopAtOneFront", false );
-
-  std::vector< std::string > orders;
-  orders.push_back( "1" );
-  orders.push_back( "2" );
-  this->m_Parameters->ConfigureAsChoices( "NeighborhoodOrder", orders );
-  this->m_Parameters->SetSelectedChoice( "NeighborhoodOrder", "1" );
 }
 
 // -------------------------------------------------------------------------
@@ -46,9 +26,6 @@ _GenerateData( )
 {
   auto input =
     this->GetInputData< cpPlugins::Interface::Image >( "Input" );
-  if( input == NULL )
-    return( "fpaPlugins::ImageDijkstra: No input image." );
-
   itk::DataObject* image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, input, image, r, _GD0 );
@@ -67,62 +44,23 @@ _GD0( itk::DataObject* data )
   typedef fpa::Image::Dijkstra< I, _TOut >                  _TFilter;
   typedef typename _TFilter::TResult                        _TCost;
   typedef fpa::Base::Functors::InvertCostFunction< _TCost > _TCostFunctor;
-  typedef typename I::PointType                             _TPoint;
   typedef typename _TFilter::TMinimumSpanningTree           _TMST;
 
-  auto seeds =
-    this->GetInputData< cpPlugins::Interface::PointList >( "Seeds" );
-  if( seeds == NULL )
-    return( "fpaPlugins::ImageRegionGrow: No given seeds." );
-  I* image = dynamic_cast< I* >( data );
-
-  // Create filter and connect input
-  _TFilter* filter = this->_CreateITK< _TFilter >( );
-  filter->SetInput( image );
+  // Create filter
+  _TFilter* filter = this->_ConfigureFilter< _TFilter >( );
 
   // Connect cost functor
   typename _TCostFunctor::Pointer functor = _TCostFunctor::New( );
   filter->SetConversionFunction( functor );
 
-  // Set numeric parameters
-  Superclass::TParameters* params = this->m_Parameters;
-  std::string order = params->GetSelectedChoice( "NeighborhoodOrder" );
-  filter->SetNeighborhoodOrder( order[ 0 ] - '0' );
-  filter->SetStopAtOneFront( params->GetBool( "StopAtOneFront" ) );
-
-  // Assign seeds
-  filter->ClearSeeds( );
-  for( unsigned int s = 0; s < seeds->GetNumberOfPoints( ); ++s )
-  {
-    _TPoint pnt = seeds->GetPoint< _TPoint >( s );
-    typename I::IndexType idx;
-    if( image->TransformPhysicalPointToIndex( pnt, idx ) )
-      filter->AddSeed( idx, 0 );
-
-  } // rof
-
   // Go!!!
-  this->_ConfigureDebugger( filter );
-  filter->Update( );
-  this->_DeconfigureDebugger( filter );
+  this->_ExecuteFilter( filter );
 
-  // Connect output
-  auto out =
-    this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+  // Connect remaining output
   auto mst =
     this->GetOutputData< fpaPlugins::MinimumSpanningTree >( "MinimumSpanningTree" );
-  if( out != NULL )
-    out->SetITK< _TOut >( filter->GetOutput( ) );
-  else
-    return( "fpaPlugins::ImageDijkstra: output not correctly created." );
-
-  if( mst != NULL )
-  {
-    mst->SetITK< _TMST >( filter->GetMinimumSpanningTree( ) );
-    return( "" );
-  }
-  else
-    return( "fpaPlugins::ImageDijkstra: minimum spanning tree." );
+  mst->SetITK( filter->GetMinimumSpanningTree( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$
index 19eba80f431eb1565f36a3acf1b2f7110ab2f9aa..07697ce48fb15481a06e66a0fa5c6cde4464369c 100644 (file)
@@ -1,41 +1,22 @@
 #include "ImageRegionGrow.h"
 
 #include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Interface/PointList.h>
-
 #include <fpaPlugins/GrowFunction.h>
-
 #include <fpa/Image/RegionGrow.h>
 #include <fpa/Image/Functors/RegionGrowAllBelongsFunction.h>
 
-#include <vtkRenderWindow.h>
-#include <vtkRenderWindowInteractor.h>
-
 // -------------------------------------------------------------------------
 fpaPlugins::ImageRegionGrow::
 ImageRegionGrow( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
-  this->_AddInput( "GrowFunction" );
-  this->_AddInput( "Seeds" );
-  this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
+  this->_AddInput( "GrowFunction", false );
 
-  this->m_Parameters->ConfigureAsBool( "VisualDebug" );
-  this->m_Parameters->ConfigureAsBool( "StopAtOneFront" );
   this->m_Parameters->ConfigureAsReal( "InsideValue" );
   this->m_Parameters->ConfigureAsReal( "OutsideValue" );
 
-  this->m_Parameters->SetBool( "VisualDebug", false );
-  this->m_Parameters->SetBool( "StopAtOneFront", false );
   this->m_Parameters->SetReal( "InsideValue", 1 );
   this->m_Parameters->SetReal( "OutsideValue", 0 );
-
-  std::vector< std::string > orders;
-  orders.push_back( "1" );
-  orders.push_back( "2" );
-  this->m_Parameters->ConfigureAsChoices( "NeighborhoodOrder", orders );
-  this->m_Parameters->SetSelectedChoice( "NeighborhoodOrder", "1" );
 }
 
 // -------------------------------------------------------------------------
@@ -50,9 +31,6 @@ _GenerateData( )
 {
   auto input =
     this->GetInputData< cpPlugins::Interface::Image >( "Input" );
-  if( input == NULL )
-    return( "fpaPlugins::ImageRegionGrow: No input image." );
-
   itk::DataObject* image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, input, image, r, _GD0 );
@@ -70,17 +48,9 @@ _GD0( itk::DataObject* data )
   typedef itk::Image< _TOutPixel, I::ImageDimension > _TOut;
   typedef fpa::Image::RegionGrow< I, _TOut >          _TFilter;
   typedef typename _TFilter::TGrowingFunction         _TFunctor;
-  typedef typename I::PointType                       _TPoint;
 
-  auto seeds =
-    this->GetInputData< cpPlugins::Interface::PointList >( "Seeds" );
-  if( seeds == NULL )
-    return( "fpaPlugins::ImageRegionGrow: No given seeds." );
-  I* image = dynamic_cast< I* >( data );
-
-  // Create filter and connect input
-  _TFilter* filter = this->_CreateITK< _TFilter >( );
-  filter->SetInput( image );
+  // Create filter
+  _TFilter* filter = this->_ConfigureFilter< _TFilter >( );
 
   // Connect grow functor (or create a tautology)
   typename _TFunctor::Pointer functor;
@@ -94,39 +64,16 @@ _GD0( itk::DataObject* data )
   filter->SetGrowingFunction( functor );
 
   // Set numeric parameters
-  Superclass::TParameters* params = this->m_Parameters;
-  std::string order = params->GetSelectedChoice( "NeighborhoodOrder" );
-  filter->SetNeighborhoodOrder( order[ 0 ] - '0' );
-  filter->SetStopAtOneFront( params->GetBool( "StopAtOneFront" ) );
-  filter->SetInsideValue( _TOutPixel( params->GetReal( "InsideValue" ) ) );
-  filter->SetOutsideValue( _TOutPixel( params->GetReal( "OutsideValue" ) ) );
-
-  // Assign seeds
-  filter->ClearSeeds( );
-  for( unsigned int s = 0; s < seeds->GetNumberOfPoints( ); ++s )
-  {
-    _TPoint pnt = seeds->GetPoint< _TPoint >( s );
-    typename I::IndexType idx;
-    if( image->TransformPhysicalPointToIndex( pnt, idx ) )
-      filter->AddSeed( idx, 0 );
-
-  } // rof
+  filter->SetInsideValue(
+    _TOutPixel( this->m_Parameters->GetReal( "InsideValue" ) )
+    );
+  filter->SetOutsideValue(
+    _TOutPixel( this->m_Parameters->GetReal( "OutsideValue" ) )
+    );
 
   // Go!!!
-  this->_ConfigureDebugger( filter );
-  filter->Update( );
-  this->_DeconfigureDebugger( filter );
-
-  // Connect output
-  auto out =
-    this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< _TOut >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "fpaPlugins::ImageRegionGrow: output not correctly created." );
+  this->_ExecuteFilter( filter );
+  return( "" );
 }
 
 // eof - $RCSfile$
index 7803f8dd7c707b6587b38d54b03eadbfc581a7df..ad561e8946d6e70e062888b3b54cbccc639a5dd0 100644 (file)
@@ -1,5 +1,12 @@
 #include <fpaPlugins/MinimumSpanningTree.h>
 
+// -------------------------------------------------------------------------
+void fpaPlugins::MinimumSpanningTree::
+SetVTK( vtkObjectBase* o )
+{
+  // Do nothing: this only has sense in ITK
+}
+
 // -------------------------------------------------------------------------
 fpaPlugins::MinimumSpanningTree::
 MinimumSpanningTree( )
index b09a0f83e348dff86c802e9d7801adf09935b4e5..557583c3e6f0575d831fa56f5d8f235d5bfbfab4 100644 (file)
@@ -26,8 +26,7 @@ namespace fpaPlugins
     cpPlugins_Id_Macro( MinimumSpanningTree, MinimumSpanningTree );
 
   public:
-    template< class M >
-      inline void SetITK( itk::Object* object );
+    void SetVTK( vtkObjectBase* o );
 
   protected:
     MinimumSpanningTree( );
index 34cf61fc7ca674077528b8af35254d468e27d8aa..ccbda263da87b27572574337cec035b68aae33aa 100644 (file)
@@ -1,20 +1,7 @@
 #ifndef __FPAPLUGINS__MINIMUMSPANNINGTREE__HXX__
 #define __FPAPLUGINS__MINIMUMSPANNINGTREE__HXX__
 
-// -------------------------------------------------------------------------
-template< class M >
-void fpaPlugins::MinimumSpanningTree::
-SetITK( itk::Object* object )
-{
-  M* tree = dynamic_cast< M* >( object );
-  if( tree != NULL )
-  {
-    this->m_ITKObject = tree;
-    this->m_VTKObject = NULL;
-    this->Modified( );
-
-  } // fi
-}
+// TODO: delete this file
 
 #endif // __FPAPLUGINS__MINIMUMSPANNINGTREE__HXX__
 
index 36d61c248c8f736132dbbccb66f2c28af4b341a5..c474429f3ba3e3f8a405819b82191d85ea1aa60d 100644 (file)
@@ -39,10 +39,6 @@ _GenerateData( )
 
   auto input =
     this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" );
-
-  if( input == NULL )
-    return( "fpaPlugins::MinimumSpanningTreeToMesh: No reference image." );
-
   _2D* im2d = input->GetITK< _2D >( );
   _3D* im3d = input->GetITK< _3D >( );
   if( im2d != NULL )
@@ -66,15 +62,11 @@ _GD0( I* image )
   // Get inputs
   auto mst_wrapper =
     this->GetInputData< fpaPlugins::MinimumSpanningTree >( "Input" );
-  if( mst_wrapper == NULL )
-    return( "fpaPlugins::MinimumSpanningTreeToMesh: No input MST" );
   _MST* mst = mst_wrapper->GetITK< _MST >( );
   if( mst == NULL )
     return( "fpaPlugins::MinimumSpanningTreeToMesh: Input MST type not supported." );
   auto seeds =
     this->GetInputData< cpPlugins::Interface::PointList >( "Seeds" );
-  if( seeds == NULL )
-    return( "fpaPlugins::MinimumSpanningTreeToMesh: No given seeds." );
   if( seeds->GetNumberOfPoints( ) < 2 )
     return( "fpaPlugins::MinimumSpanningTreeToMesh: Not enough seeds (<2)." );
 
index eabd396be9dcb5dc20679952fbb1f576f37f4d45..4863f4d91e9ac18cc4d43235204d3c34c0ca4ccc 100644 (file)
@@ -32,9 +32,6 @@ _GenerateData( )
 {
   auto image =
     this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" );
-  if( image == NULL )
-    return( "fpaPlugins::ThresholdImageGrowFunctionSource: No input reference image." );
-
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
@@ -50,19 +47,19 @@ std::string fpaPlugins::ThresholdImageGrowFunctionSource::
 _GD0( itk::DataObject* data )
 {
   typedef fpa::Image::Functors::RegionGrowThresholdFunction< I > _F;
-  typename _F::Pointer f = _F::New( );
-  f->SetLowerThreshold( this->m_Parameters->GetReal( "LowerThreshold" ) );
-  f->SetUpperThreshold( this->m_Parameters->GetReal( "UpperThreshold" ) );
 
-  // Connect output
   auto out = this->GetOutputData< GrowFunction >( "Output" );
-  if( out != NULL )
+  auto f = out->GetITK< _F >( );
+  if( f == NULL )
   {
-    out->SetITK< _F >( f );
-    return( "" );
-  }
-  else
-    return( "fpaPlugins::ThresholdImageGrowFunctionSource: output not correctly created." );
+    typename _F::Pointer ptr_f = _F::New( );
+    f = ptr_f.GetPointer( );
+    out->SetITK( f );
+
+  } // fi
+  f->SetLowerThreshold( this->m_Parameters->GetReal( "LowerThreshold" ) );
+  f->SetUpperThreshold( this->m_Parameters->GetReal( "UpperThreshold" ) );
+  return( "" );
 }
 
 // eof - $RCSfile$