]> Creatis software - FrontAlgorithms.git/blobdiff - plugins/fpa/MinimumSpanningTreeReader.cxx
...
[FrontAlgorithms.git] / plugins / fpa / MinimumSpanningTreeReader.cxx
index 8326dfb6fefa31792773ca9a1ae01e12a194e68f..16f421e4e3b53c16b80bfdde46942c312c9e0403 100644 (file)
@@ -24,14 +24,14 @@ fpaPlugins::MinimumSpanningTreeReader::
 }
 
 // -------------------------------------------------------------------------
-std::string fpaPlugins::MinimumSpanningTreeReader::
+void fpaPlugins::MinimumSpanningTreeReader::
 _GenerateData( )
 {
   // Infere MST dimensions
   auto fname = this->m_Parameters.GetOpenFileName( "FileName" );
   std::ifstream input( fname.c_str( ) );
   if( !input )
-    return(
+    this->_Error(
       std::string( "MinimumSpanningTreeReader: Error opening file \"" ) +
       fname +
       std::string( "\"" )
@@ -40,15 +40,14 @@ _GenerateData( )
   input >> dim;
 
   // Real execution
-  if     ( dim == 2 ) return( this->_GD0< 2 >( fname ) );
-  else if( dim == 3 ) return( this->_GD0< 3 >( fname ) );
-  else
-    return( "MinimumSpanningTreeReader: invalid dimensions." );
+  if     ( dim == 2 ) this->_GD0< 2 >( fname );
+  else if( dim == 3 ) this->_GD0< 3 >( fname );
+  else this->_Error( "Invalid dimensions." );
 }
 
 // -------------------------------------------------------------------------
 template< unsigned int _NDim >
-std::string fpaPlugins::MinimumSpanningTreeReader::
+void fpaPlugins::MinimumSpanningTreeReader::
 _GD0( const std::string& fname )
 {
   typedef fpa::Image::MinimumSpanningTree< _NDim >     _TTree;
@@ -62,13 +61,10 @@ _GD0( const std::string& fname )
   }
   catch( itk::ExceptionObject& err )
   {
-    return(
-      "MinimumSpanningTreeReader: " + std::string( err.GetDescription( ) )
-      );
+    this->_Error( err.GetDescription( ) );
 
   } // yrt
   this->GetOutputData( "Output" )->SetITK( reader->GetOutput( ) );
-  return( "" );
 }
 
 // eof - $RCSfile$