]> Creatis software - FrontAlgorithms.git/blobdiff - plugins/fpa/ExtractPathFromMinimumSpanningTree.cxx
...
[FrontAlgorithms.git] / plugins / fpa / ExtractPathFromMinimumSpanningTree.cxx
index c263b9c0c09ab8830a78c513fa61f6c7e6a2a75d..7e41b4f6dc337bd7d20295c40ac4c2ea94668556 100644 (file)
@@ -25,7 +25,7 @@ fpaPlugins::ExtractPathFromMinimumSpanningTree::
 }
 
 // -------------------------------------------------------------------------
-std::string fpaPlugins::ExtractPathFromMinimumSpanningTree::
+void fpaPlugins::ExtractPathFromMinimumSpanningTree::
 _GenerateData( )
 {
   typedef fpa::Image::MinimumSpanningTree< 2 > _2DMST;
@@ -34,33 +34,25 @@ _GenerateData( )
   auto mst = this->GetInputData( "MST" )->GetITK< itk::DataObject >( );
   auto mst2 = dynamic_cast< _2DMST* >( mst );
   auto mst3 = dynamic_cast< _3DMST* >( mst );
-  std::string   r = this->_GD0( mst2 );
-  if( r != "" ) r = this->_GD0( mst3 );
-  return( r );
+  if     ( mst2 != NULL ) this->_GD0( mst2 );
+  else if( mst3 != NULL ) this->_GD0( mst3 );
+  else this->_Error( "Invalid input MST." );
 }
 
 // -------------------------------------------------------------------------
 template< class _TMST >
-std::string fpaPlugins::ExtractPathFromMinimumSpanningTree::
+void fpaPlugins::ExtractPathFromMinimumSpanningTree::
 _GD0( _TMST* mst )
 {
   typedef fpa::Base::ExtractPathFromMinimumSpanningTree< _TMST > _TFilter;
   typedef
     cpExtensions::DataStructures::ImageIndexesContainer< _TMST::Dimension >
     _TVertices;
-  if( mst == NULL )
-    return(
-      "fpaPlugins::ExtractPathFromMinimumSpanningTree: No valid input tree."
-      );
   auto vertices = this->GetInputData( "Seeds" )->GetITK< _TVertices >( );
   if( vertices == NULL )
-    return(
-      "fpaPlugins::ExtractPathFromMinimumSpanningTree: No valid vertices."
-      );
+    this->_Error( "No valid vertices." );
   if( vertices->Get( ).size( ) < 2 )
-    return(
-      "fpaPlugins::ExtractPathFromMinimumSpanningTree: Not enough vertices."
-      );
+    this->_Error( "Not enough vertices." );
   auto v0 = vertices->Get( )[ this->m_Parameters.GetUint( "Vertex0" ) ];
   auto v1 = vertices->Get( )[ this->m_Parameters.GetUint( "Vertex1" ) ];
 
@@ -73,7 +65,6 @@ _GD0( _TMST* mst )
 
   // Connect output and finish
   this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
-  return( "" );
 }
 
 // eof - $RCSfile$