]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Sun, 17 Apr 2016 03:02:02 +0000 (22:02 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Sun, 17 Apr 2016 03:02:02 +0000 (22:02 -0500)
lib/cpPipelineEditor/BaseQtMainWindow.cxx
lib/cpPlugins/Image.hxx
lib/cpPlugins/ProcessObject.cxx
lib/cpPlugins/Workspace.cxx
lib/cpPlugins/Workspace.h
plugins/cpPluginsWidgets/NoInteractiveSeedWidget.cxx
plugins/cpPluginsWidgets/SeedWidget.cxx

index e507f1926bb63128e7d013f61701eef4261344a3..c19dd6f9bfe9ff7ab5aac1dc1f373d2e7cc94544 100644 (file)
@@ -326,30 +326,30 @@ _ExecFilter( const std::string& filter_name )
   }
   catch( itk::ExceptionObject& err1 )
   {
+    this->_UnBlock( );
     QMessageBox::critical(
       this,
       QMessageBox::tr( "Error executing filter" ),
       QMessageBox::tr( err1.GetDescription( ) )
       );
-    this->_UnBlock( );
   }
   catch( std::exception& err2 )
   {
+    this->_UnBlock( );
     QMessageBox::critical(
       this,
       QMessageBox::tr( "Error executing filter" ),
       QMessageBox::tr( err2.what( ) )
       );
-    this->_UnBlock( );
   }
   catch( ... )
   {
+    this->_UnBlock( );
     QMessageBox::critical(
       this,
       QMessageBox::tr( "Error executing filter" ),
       QMessageBox::tr( "Unknown error" )
       );
-    this->_UnBlock( );
 
   } // yrt
 }
index d0f3de410fcf83c04a5db04172730b7b9530bb1a..19dbcdabe290901dcebb5069c075b2e53e127c06 100644 (file)
@@ -117,8 +117,8 @@ _ITK_2_VTK_2( itk::LightObject* o )
     this->F( dynamic_cast< itk::Image< itk::C##Pixel< P >, D >* >( I ) )
 
 #define cpPlugins_Image_Demangle_VectorPixel_Dim( F, I, V, P, D )       \
-  if( dynamic_cast< itk::Image< V< P, D >, D >* >( I ) != NULL )        \
-    this->F( dynamic_cast< itk::Image< V< P, D >, D >* >( I ) )
+  if( dynamic_cast< itk::Image< itk::V< P, D >, D >* >( I ) != NULL )   \
+    this->F( dynamic_cast< itk::Image< itk::V< P, D >, D >* >( I ) )
 
 #define cpPlugins_Image_Demangle_Pixel_AllInts( F, I, D )               \
   cpPlugins_Image_Demangle_Pixel_Dim     ( F, I, char, D );             \
@@ -136,10 +136,10 @@ _ITK_2_VTK_2( itk::LightObject* o )
   cpPlugins_Image_Demangle_Pixel_Dim     ( F, I, float, D );            \
   else cpPlugins_Image_Demangle_Pixel_Dim( F, I, double, D )
 
-#define cpPlugins_Image_Demangle_Pixel_AllScalars( F, I, D )  \
-  cpPlugins_Image_Demangle_Pixel_AllInts      ( F, I, D );    \
-  else cpPlugins_Image_Demangle_Pixel_AllUInts( F, I, D );    \
-  else cpPlugins_Image_Demangle_Pixel_AllInts ( F, I, D )
+#define cpPlugins_Image_Demangle_Pixel_AllScalars( F, I, D )   \
+  cpPlugins_Image_Demangle_Pixel_AllInts       ( F, I, D );    \
+  else cpPlugins_Image_Demangle_Pixel_AllUInts ( F, I, D );    \
+  else cpPlugins_Image_Demangle_Pixel_AllFloats( F, I, D )
 
 #define cpPlugins_Image_Demangle_ColorPixel_AllInts( F, I, C, D )       \
   cpPlugins_Image_Demangle_ColorPixel_Dim     ( F, I, C, char, D );     \
@@ -158,12 +158,16 @@ _ITK_2_VTK_2( itk::LightObject* o )
   else cpPlugins_Image_Demangle_ColorPixel_Dim( F, I, C, double, D )
 
 #define cpPlugins_Image_Demangle_ColorPixel_AllScalars( F, I, C, D )    \
-  cpPlugins_Image_Demangle_ColorPixel_AllInts      ( F, I, C, D );      \
-  else cpPlugins_Image_Demangle_ColorPixel_AllUInts( F, I, C, D );      \
-  else cpPlugins_Image_Demangle_ColorPixel_AllInts ( F, I, C, D )
+  cpPlugins_Image_Demangle_ColorPixel_AllInts       ( F, I, C, D );     \
+  else cpPlugins_Image_Demangle_ColorPixel_AllUInts ( F, I, C, D );     \
+  else cpPlugins_Image_Demangle_ColorPixel_AllFloats( F, I, C, D )
+
+#define cpPlugins_Image_Demangle_VectorPixel_AllFloats( F, I, V, D )    \
+  cpPlugins_Image_Demangle_VectorPixel_Dim     ( F, I, V, float, D );   \
+  else cpPlugins_Image_Demangle_VectorPixel_Dim( F, I, V, double, D )
 
 /* TODO
-   #define cpPlugins_Image_Demangle_Pixel_AllColor( r, FUNC, INPUT, D ) \
+   #define cpPlugins_Image_Demangle_Pixel_AllVector( r, FUNC, INPUT, D ) \
    r = cpPlugins_Image_Demangle_Pixel_Dim( FUNC, INPUT, itk::RGBPixel< char >, D ); \
    if( r != "" ) r = cpPlugins_Image_Demangle_Pixel_Dim( FUNC, INPUT, itk::RGBPixel< short >, D ); \
    if( r != "" ) r = cpPlugins_Image_Demangle_Pixel_Dim( FUNC, INPUT, itk::RGBPixel< int >, D ); \
index 02beb8849b774a75e8370dad59a2fe22f4c3da57..eecfd8b74e9548c89380ee9a61d03a81ac6d8b17 100644 (file)
@@ -250,16 +250,17 @@ Update( )
 
     } // fi
 
-    this->m_LastExecutionSpan = cpPlugins_CHRONO;
+    auto t_start = cpPlugins_CHRONO;
     this->_GenerateData( );
-    this->m_LastExecutionSpan = cpPlugins_CHRONO - this->m_LastExecutionSpan;
+    auto t_end = cpPlugins_CHRONO;
+    this->m_LastExecutionSpan = long( t_end - t_start );
     this->m_LastExecutionTime = this->GetMTime( );
 
     if( this->m_PrintExecution && this->m_PrintExecutionStream != NULL )
     {
       *( this->m_PrintExecutionStream )
         << "done in "
-        << this->m_LastExecutionSpan
+        << double( this->m_LastExecutionSpan ) / double( 1000 )
         << " ms." << std::endl;
 
     } // fi
index a63b749670717e43961d7709fe8f5a7da7e32d40..b29309a77b2377aedb220345d270957f9c7a6e1d 100644 (file)
@@ -167,6 +167,34 @@ SetParameter( const std::string& name, const std::string& value )
   } // fi
 }
 
+// -------------------------------------------------------------------------
+void cpPlugins::Workspace::
+SetPrintExecution( bool b )
+{
+  auto vIt = this->m_Graph->BeginVertices( );
+  for( ; vIt != this->m_Graph->EndVertices( ); ++vIt )
+  {
+    auto f = dynamic_cast< ProcessObject* >( vIt->second.GetPointer( ) );
+    if( f != NULL )
+      f->SetPrintExecution( b );
+
+  } // rof
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Workspace::
+PrintExecutionOn( )
+{
+  this->SetPrintExecution( true );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Workspace::
+PrintExecutionOff( )
+{
+  this->SetPrintExecution( false );
+}
+
 // -------------------------------------------------------------------------
 vtkRenderWindowInteractor* cpPlugins::Workspace::
 GetSingleInteractor( )
index e779b075a12b3980058292a0082be65404522c86..e5609629a58f8298133e9982d9f52730548ca6fa 100644 (file)
@@ -80,6 +80,10 @@ namespace cpPlugins
     void RemoveFilter( const std::string& name );
     void SetParameter( const std::string& name, const std::string& value );
 
+    void SetPrintExecution( bool b );
+    void PrintExecutionOn( );
+    void PrintExecutionOff( );
+
     // Widgets management
     vtkRenderWindowInteractor* GetSingleInteractor( );
     const vtkRenderWindowInteractor* GetSingleInteractor( ) const;
index a968a5bc1f87ac083d68a36ef38dd34dbf965f64..85ff0597f0a49da302e1b13f674b629d88b95ef2 100644 (file)
@@ -26,7 +26,7 @@ cpPluginsWidgets::NoInteractiveSeedWidget::
 void cpPluginsWidgets::NoInteractiveSeedWidget::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "ReferenceImage" );
+  auto image = this->GetInputData( "ReferenceImage" )->GetITK< itk::DataObject >( );
   cpPlugins_Image_Demangle_Dim     ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Dim( _GD0, image, 3 );
   else this->_Error( "No valid input image." );
index 20db639952d635e3b11f2f108d94c5047a22e12c..da3109de3b2fe44f2af5cc143dce1897e29710f6 100644 (file)
@@ -36,7 +36,7 @@ cpPluginsWidgets::SeedWidget::
 void cpPluginsWidgets::SeedWidget::
 _GenerateData( )
 {
-  auto image = this->GetInputData( "ReferenceImage" );
+  auto image = this->GetInputData( "ReferenceImage" )->GetITK< itk::DataObject >( );
   cpPlugins_Image_Demangle_Dim     ( _GD0, image, 2 );
   else cpPlugins_Image_Demangle_Dim( _GD0, image, 3 );
   else this->_Error( "No valid input image." );