From b96732896f4c247203f79dbb22e770873b0eedb8 Mon Sep 17 00:00:00 2001 From: Leonardo Florez Date: Thu, 10 Nov 2016 21:08:45 -0500 Subject: [PATCH] ... --- appli/plugins/ExecutePipeline.cxx | 46 ++++++++++++++++++++- lib/Instances/BaseObjects.i | 6 ++- lib/cpPlugins/BaseObjects/Object.cxx | 15 ++++--- lib/cpPlugins/BaseObjects/ProcessObject.cxx | 1 + lib/cpPlugins/BaseObjects/Widget.cxx | 9 ---- lib/cpPlugins/BaseObjects/Widget.h | 2 - plugins/Extensions/Extensions.i | 1 + 7 files changed, 60 insertions(+), 20 deletions(-) diff --git a/appli/plugins/ExecutePipeline.cxx b/appli/plugins/ExecutePipeline.cxx index a842d8d..623b74e 100644 --- a/appli/plugins/ExecutePipeline.cxx +++ b/appli/plugins/ExecutePipeline.cxx @@ -1,4 +1,5 @@ #include +#include #include #include @@ -46,11 +47,54 @@ int main( int argc, char* argv[] ) return( 1 ); } // yrt + + // Read parameters + for( int i = 2; i < argc; ++i ) + { + std::vector< std::string > tokens; + cpPlugins::Tokenize( tokens, argv[ i ], "@=" ); + if( tokens.size( ) == 3 ) + { + auto filter = workspace->GetFilter( tokens[ 1 ] ); + if( filter != NULL ) + { + auto params = filter->GetParameters( ); + params->SetString( tokens[ 0 ], tokens[ 2 ], true ); + + } // fi + + } // fi + + } // rof // Execute filter workspace->PrintExecutionOn( ); - workspace->Execute( ); + try + { + workspace->Execute( ); + } + catch( std::exception& err1 ) + { + std::cerr << std::endl << "********************************" << std::endl; + std::cerr << "Error caught: " << err1.what( ) << std::endl; + std::cerr << "********************************" << std::endl; + return( 1 ); + } + catch( itk::ExceptionObject& err2 ) + { + std::cerr << std::endl << "********************************" << std::endl; + std::cerr << "Error caught: " << err2 << std::endl; + std::cerr << "********************************" << std::endl; + return( 1 ); + } + catch( ... ) + { + std::cerr << std::endl << "********************************" << std::endl; + std::cerr << "Unknown error caught." << std::endl; + std::cerr << "********************************" << std::endl; + return( 1 ); + } // yrt return( 0 ); } diff --git a/lib/Instances/BaseObjects.i b/lib/Instances/BaseObjects.i index 8575d66..89533e7 100644 --- a/lib/Instances/BaseObjects.i +++ b/lib/Instances/BaseObjects.i @@ -1,7 +1,7 @@ header #define ITK_MANUAL_INSTANTIATION define arrays=Array2D;Array;#color_pixels# -define fixed_dims=#process_dims#;8 +define fixed_dims=#visual_dims#;4;6;8 tinclude itk#arrays#:h|hxx tinclude itkFixedArray:h|hxx @@ -27,6 +27,8 @@ define my_vectors=FixedArray;Vector;Point minstances #_export_# std::ostream& itk::operator<< < #real_types#, #process_dims# >( std::ostream& a, itk::#my_vectors#< #real_types#, #process_dims# > const& b ) -*minstances void #_export_# itk::VariableLengthVector< #real_types# >::SetSize< itk::VariableLengthVector< #real_types# >::AlwaysReallocate, itk::VariableLengthVector< #real_types# >::KeepOldValues >( unsigned int, itk::VariableLengthVector< #real_types# >::AlwaysReallocate, itk::VariableLengthVector< #real_types# >::KeepOldValues ) +minstances void #_export_# itk::VariableLengthVector< #real_types# >::SetSize< itk::VariableLengthVector< #real_types# >::AlwaysReallocate, itk::VariableLengthVector< #real_types# >::KeepOldValues >( unsigned int, itk::VariableLengthVector< #real_types# >::AlwaysReallocate, itk::VariableLengthVector< #real_types# >::KeepOldValues ) + +minstances void #_export_# itk::VariableLengthVector< #real_types# >::SetSize::ShrinkToFit, itk::VariableLengthVector< #real_types# >::KeepOldValues>(unsigned int, itk::VariableLengthVector< #real_types# >::ShrinkToFit, itk::VariableLengthVector< #real_types# >::KeepOldValues) ** eof - $RCSfile$ diff --git a/lib/cpPlugins/BaseObjects/Object.cxx b/lib/cpPlugins/BaseObjects/Object.cxx index e372c99..9fffab6 100644 --- a/lib/cpPlugins/BaseObjects/Object.cxx +++ b/lib/cpPlugins/BaseObjects/Object.cxx @@ -42,20 +42,23 @@ Modified( ) const itk::ModifiedTimeType cpPlugins::BaseObjects::Object:: GetMTime( ) const { + itk::ModifiedTimeType lt = this->Superclass::GetMTime( ); const itk::Object* i = this->GetITK< itk::Object >( ); vtkObject* v = const_cast< vtkObject* >( this->GetVTK< vtkObject >( ) ); + + itk::ModifiedTimeType rt; if( i != NULL && v == NULL ) - return( i->GetMTime( ) ); + rt = i->GetMTime( ); else if( i == NULL && v != NULL ) - return( v->GetMTime( ) ); + rt = v->GetMTime( ); else if( i != NULL && v != NULL ) { auto iTime = i->GetMTime( ); auto vTime = v->GetMTime( ); - return( itk::ModifiedTimeType( ( iTime < vTime )? vTime: iTime ) ); - } - else - return( this->Superclass::GetMTime( ) ); + rt = ( iTime < vTime )? vTime: iTime; + + } // fi + return( ( lt < rt )? rt: lt ); } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/BaseObjects/ProcessObject.cxx b/lib/cpPlugins/BaseObjects/ProcessObject.cxx index f9845f7..ffe2cf5 100644 --- a/lib/cpPlugins/BaseObjects/ProcessObject.cxx +++ b/lib/cpPlugins/BaseObjects/ProcessObject.cxx @@ -200,6 +200,7 @@ Update( ) auto t_start = cpPlugins_CHRONO; this->_GenerateData( ); + this->Modified( ); auto t_end = cpPlugins_CHRONO; this->m_LastExecutionSpan = long( t_end - t_start ); this->m_LastExecutionTime = this->GetMTime( ); diff --git a/lib/cpPlugins/BaseObjects/Widget.cxx b/lib/cpPlugins/BaseObjects/Widget.cxx index fe842aa..4d57490 100644 --- a/lib/cpPlugins/BaseObjects/Widget.cxx +++ b/lib/cpPlugins/BaseObjects/Widget.cxx @@ -1,14 +1,5 @@ #include -// ------------------------------------------------------------------------- -itk::ModifiedTimeType cpPlugins::BaseObjects::Widget:: -GetMTime( ) const -{ - // Let time only be managed by itk -> synch issues when data is - // represented by vtk - return( this->itk::Object::GetMTime( ) ); -} - // ------------------------------------------------------------------------- bool cpPlugins::BaseObjects::Widget:: IsInteractive( ) diff --git a/lib/cpPlugins/BaseObjects/Widget.h b/lib/cpPlugins/BaseObjects/Widget.h index 83960e6..17132cc 100644 --- a/lib/cpPlugins/BaseObjects/Widget.h +++ b/lib/cpPlugins/BaseObjects/Widget.h @@ -24,8 +24,6 @@ namespace cpPlugins cpPlugins_Id_Macro( Widget, Object ); public: - virtual itk::ModifiedTimeType GetMTime( ) const cpPlugins_OVERRIDE; - virtual bool IsInteractive( ) cpPlugins_OVERRIDE; virtual void EnabledOn( ); diff --git a/plugins/Extensions/Extensions.i b/plugins/Extensions/Extensions.i index e1b9fc5..d1876b0 100644 --- a/plugins/Extensions/Extensions.i +++ b/plugins/Extensions/Extensions.i @@ -5,6 +5,7 @@ tinclude cpExtensions/DataStructures/Skeleton:h|hxx tinclude cpExtensions/Algorithms/BezierCurveFunction:h|hxx cinclude cpExtensions/DataStructures/Graph.hxx +cinclude itkVectorContainer.hxx instances cpExtensions::Algorithms::BezierCurveFunction< itk::Vector< #real_types#, #process_dims# > > instances cpExtensions::DataStructures::PolyLineParametricPath< #process_dims# > -- 2.45.0