]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/BaseObjects/ProcessObject.cxx
Cast image filter added. ROI filter modified.
[cpPlugins.git] / lib / cpPlugins / BaseObjects / ProcessObject.cxx
index 35b95ff643525bf900a30ed4fe8313eea3fa646a..457835e42a9a725012fdbd8e39c40535b619059e 100644 (file)
@@ -220,36 +220,44 @@ Update( )
 {
   // Force upstream updates
   bool update = ( this->m_LastExecutionTime < this->GetMTime( ) );
-  for( auto input : this->m_Inputs )
+  try
   {
-    for( unsigned int i = 0; i < input.second->Size( ); ++i )
+    for( auto input : this->m_Inputs )
     {
-      auto obj = input.second->Get( i );
-      if( obj != NULL )
+      for( unsigned int i = 0; i < input.second->Size( ); ++i )
       {
-        auto src = obj->GetSource( );
-        if( src != NULL )
+        auto obj = input.second->Get( i );
+        if( obj != NULL )
         {
-          src->Update( );
-          update |= ( this->m_LastExecutionTime < src->GetMTime( ) );
+          auto src = obj->GetSource( );
+          if( src != NULL )
+          {
+            src->Update( );
+            update |= ( this->m_LastExecutionTime < src->GetMTime( ) );
+
+          } // fi
+        }
+        else
+        {
+          if( input.second->IsRequired( ) )
+            this->_Error(
+              std::string( "Required input \"" ) + input.first +
+              std::string( "\" in filter \"" ) +
+              this->m_Name +
+              std::string( "\" is not valid." )
+              );
 
         } // fi
-      }
-      else
-      {
-        if( input.second->IsRequired( ) )
-          this->_Error(
-            std::string( "Required input \"" ) + input.first +
-            std::string( "\" in filter \"" ) +
-            this->m_Name +
-            std::string( "\" is not valid." )
-            );
 
-      } // fi
+      } // rof
 
     } // rof
+  }
+  catch( std::exception& err )
+  {
+    this->_Error( err.what( ) );
 
-  } // rof
+  } // yrt
 
   if( update || this->m_ExplicitExecution )
   {
@@ -266,22 +274,30 @@ Update( )
     } // fi
 
     // Execute filter's algorithm and keep information about time
-    auto t_start = cpPlugins_CHRONO;
-    this->_GenerateData( );
-    auto t_end = cpPlugins_CHRONO;
-    this->Modified( );
-    this->m_LastExecutionSpan = long( t_end - t_start );
-    this->m_LastExecutionTime = this->GetMTime( );
-
-    // End the message, if needed...
-    if( this->m_PrintExecution && this->m_PrintExecutionStream != NULL )
+    try
     {
-      *( this->m_PrintExecutionStream )
-        << "done in "
-        << double( this->m_LastExecutionSpan ) / double( 1000 )
-        << " s." << std::endl;
+      auto t_start = cpPlugins_CHRONO;
+      this->_GenerateData( );
+      auto t_end = cpPlugins_CHRONO;
+      this->Modified( );
+      this->m_LastExecutionSpan = long( t_end - t_start );
+      this->m_LastExecutionTime = this->GetMTime( );
+
+      // End the message, if needed...
+      if( this->m_PrintExecution && this->m_PrintExecutionStream != NULL )
+      {
+        *( this->m_PrintExecutionStream )
+          << "done in "
+          << double( this->m_LastExecutionSpan ) / double( 1000 )
+          << " s." << std::endl;
 
-    } // fi
+      } // fi
+    }
+    catch( std::exception& err )
+    {
+      this->_Error( err.what( ) );
+
+    } // yrt
 
   } // fi
 }
@@ -350,13 +366,9 @@ void cpPlugins::BaseObjects::ProcessObject::
 _Error( const std::string& error )
 {
   if( error != "" )
-  {
     itkExceptionMacro(
-      "Error: \"" << this->GetClassCategory( ) << "::" <<
-      this->GetClassName( ) << "\": " << error
+      "Error: \"" << this->m_Name << "\": " << error
       );
-
-  } // fi
 }
 
 // eof - $RCSfile$