From 6ffc11d77924d6ab7e94db95d41105982ac73e00 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Sun, 14 Feb 2016 21:34:03 -0500 Subject: [PATCH] MAC compilation issues solved... Now some tests please --- .../cpPipelineEditor/App_cpPipelineEditor.cxx | 15 ++-- lib/cpPlugins/Interface/Config.h.in | 35 ++++++++++ lib/cpPlugins/Interface/Interface.cxx | 10 --- .../BasicFilters/MultiplyImageFilter.cxx | 70 +++++++++++++++++++ .../BasicFilters/MultiplyImageFilter.h | 57 +++++++++++++++ lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx | 10 +++ lib/cpPlugins/Plugins/Widgets/SeedWidget.h | 3 + 7 files changed, 183 insertions(+), 17 deletions(-) create mode 100644 lib/cpPlugins/Plugins/BasicFilters/MultiplyImageFilter.cxx create mode 100644 lib/cpPlugins/Plugins/BasicFilters/MultiplyImageFilter.h diff --git a/appli/cpPipelineEditor/App_cpPipelineEditor.cxx b/appli/cpPipelineEditor/App_cpPipelineEditor.cxx index 6227c17..df947d5 100644 --- a/appli/cpPipelineEditor/App_cpPipelineEditor.cxx +++ b/appli/cpPipelineEditor/App_cpPipelineEditor.cxx @@ -156,13 +156,14 @@ _ButtonLoadPluginsFile( ) QFileDialog dlg( this ); dlg.setFileMode( QFileDialog::ExistingFiles ); dlg.setDirectory( "." ); -#ifdef _WIN32 - dlg.setNameFilter( "Plugins file (*.dll);;All files (*)" ); - dlg.setDefaultSuffix( "dll" ); -#else // _WIN32 - dlg.setNameFilter( "Plugins file (*.so);;All files (*)" ); - dlg.setDefaultSuffix( "so" ); -#endif // _WIN32 + + std::stringstream name_filter; + std::string suffix = std::string( PLUGIN_EXT ).substr( 1 ); + + name_filter << "Plugins file (*" << PLUGIN_EXT << ");;All files (*)"; + dlg.setNameFilter( name_filter.str( ).c_str( ) ); + dlg.setDefaultSuffix( suffix.c_str( ) ); + if( !( dlg.exec( ) ) ) return; diff --git a/lib/cpPlugins/Interface/Config.h.in b/lib/cpPlugins/Interface/Config.h.in index a076a2b..8835c0a 100644 --- a/lib/cpPlugins/Interface/Config.h.in +++ b/lib/cpPlugins/Interface/Config.h.in @@ -13,6 +13,41 @@ # undef cpPlugins_Interface_QT4 #endif // cpPlugins_Interface_QT4_USED == 1 +// Base configuration for each OS +#ifdef _WIN32 +# define PLUGIN_PREFIX "" +# define PLUGIN_EXT ".dll" +# ifdef _WIN64 +# endif +#elif __APPLE__ +# include "TargetConditionals.h" +# if TARGET_IPHONE_SIMULATOR +# define PLUGIN_PREFIX "lib" +# define PLUGIN_EXT ".dylib" +# elif TARGET_OS_IPHONE +# define PLUGIN_PREFIX "lib" +# define PLUGIN_EXT ".dylib" +# elif TARGET_OS_MAC +# define PLUGIN_PREFIX "lib" +# define PLUGIN_EXT ".dylib" +# else +# error "Unknown Apple platform" +# endif +#elif __linux__ +# define PLUGIN_PREFIX "lib" +# define PLUGIN_EXT ".so" +#elif __unix__ // all unices not caught above +# define PLUGIN_PREFIX "lib" +# define PLUGIN_EXT ".so" +#elif defined(_POSIX_VERSION) +# define PLUGIN_PREFIX "lib" +# define PLUGIN_EXT ".so" +#else +# error "Unknown compiler: I do not know how to manage dynamic libraries." +#endif + +#define PLUGIN_CONFIG_FILE "plugins.cfg" + #endif // __CPPLUGINS__INTERFACE__CONFIG__H__ // eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/Interface.cxx b/lib/cpPlugins/Interface/Interface.cxx index 4db8f77..f2a58da 100644 --- a/lib/cpPlugins/Interface/Interface.cxx +++ b/lib/cpPlugins/Interface/Interface.cxx @@ -6,15 +6,6 @@ #include #include -#ifdef _WIN32 -# define PLUGIN_PREFIX "" -# define PLUGIN_EXT ".dll" -#else // Linux -# define PLUGIN_PREFIX "lib" -# define PLUGIN_EXT ".so" -#endif // _WIN32 -#define PLUGIN_CONFIG_FILE "plugins.cfg" - namespace cpPlugins { namespace Interface @@ -170,7 +161,6 @@ CreateObject( const std::string& name ) const catIt++; } // elihw - return( po ); } diff --git a/lib/cpPlugins/Plugins/BasicFilters/MultiplyImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/MultiplyImageFilter.cxx new file mode 100644 index 0000000..48d1a9e --- /dev/null +++ b/lib/cpPlugins/Plugins/BasicFilters/MultiplyImageFilter.cxx @@ -0,0 +1,70 @@ +#include "MultiplyImageFilter.h" +#include + +#include + +// ------------------------------------------------------------------------- +cpPlugins::BasicFilters::MultiplyImageFilter:: +MultiplyImageFilter( ) + : Superclass( ) +{ + this->_AddInput( "Input0" ); + this->_AddInput( "Input1", false ); + this->_AddOutput< cpPlugins::Interface::Image >( "Output" ); + + this->m_Parameters->ConfigureAsReal( "Constant" ); + this->m_Parameters->SetReal( "Constant", 1 ); +} + +// ------------------------------------------------------------------------- +cpPlugins::BasicFilters::MultiplyImageFilter:: +~MultiplyImageFilter( ) +{ +} + +// ------------------------------------------------------------------------- +std::string cpPlugins::BasicFilters::MultiplyImageFilter:: +_GenerateData( ) +{ + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input0" ); + itk::DataObject* itk_image = NULL; + std::string r = ""; + cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 ); + else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 ); + else cpPlugins_Image_Demangle_AllScalarTypes( 4, image, itk_image, r, _GD0 ); + else r = "MultiplyImageFilter: Input image type not supported."; + return( r ); +} + +// ------------------------------------------------------------------------- +template< class I > +std::string cpPlugins::BasicFilters::MultiplyImageFilter:: +_GD0( itk::DataObject* image ) +{ + return( this->_RealGD< I, I >( image ) ); +} + +// ------------------------------------------------------------------------- +template< class I, class O > +inline std::string cpPlugins::BasicFilters::MultiplyImageFilter:: +_RealGD( itk::DataObject* image ) +{ + typedef itk::MultiplyImageFilter< I, I, O > _F; + typedef typename I::PixelType _IP; + + // Get parameters + _IP c = _IP( this->m_Parameters->GetReal( "Constant" ) ); + + // Configure filter + _F* filter = this->_CreateITK< _F >( ); + filter->SetInput( dynamic_cast< I* >( image ) ); + filter->SetConstant( c ); + filter->Update( ); + + // Connect output + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); + out->SetITK( filter->GetOutput( ) ); + return( "" ); +} + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Plugins/BasicFilters/MultiplyImageFilter.h b/lib/cpPlugins/Plugins/BasicFilters/MultiplyImageFilter.h new file mode 100644 index 0000000..7d67aa8 --- /dev/null +++ b/lib/cpPlugins/Plugins/BasicFilters/MultiplyImageFilter.h @@ -0,0 +1,57 @@ +#ifndef __CPPLUGINS__PLUGINS__MULTIPLYIMAGEFILTER__H__ +#define __CPPLUGINS__PLUGINS__MULTIPLYIMAGEFILTER__H__ + +#include +#include + +namespace cpPlugins +{ + namespace BasicFilters + { + /** + */ + class cpPluginsBasicFilters_EXPORT MultiplyImageFilter + : public cpPlugins::Interface::ImageToImageFilter + { + public: + typedef MultiplyImageFilter Self; + typedef cpPlugins::Interface::ImageToImageFilter Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + public: + itkNewMacro( Self ); + itkTypeMacro( + MultiplyImageFilter, + cpPluginsInterfaceImageToImageFilter + ); + cpPlugins_Id_Macro( + cpPlugins::BasicFilters::MultiplyImageFilter, + ImageToImageFilter + ); + + protected: + MultiplyImageFilter( ); + virtual ~MultiplyImageFilter( ); + + virtual std::string _GenerateData( ); + + template< class I > + inline std::string _GD0( itk::DataObject* image ); + + template< class I, class O > + inline std::string _RealGD( itk::DataObject* image ); + + private: + // Purposely not implemented + MultiplyImageFilter( const Self& ); + Self& operator=( const Self& ); + }; + + } // ecapseman + +} // ecapseman + +#endif // __CPPLUGINS__PLUGINS__MULTIPLYIMAGEFILTER__H__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx b/lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx index ee8a59d..f9bb4fb 100644 --- a/lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx +++ b/lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx @@ -7,6 +7,14 @@ #include +// ------------------------------------------------------------------------- +itk::ModifiedTimeType cpPlugins::Widgets::SeedWidget:: +GetMTime( ) const +{ + // std::cout << "Seed GetMTime" << std::endl; + return( 0 /*this->Superclass::GetMTime( )*/ ); +} + // ------------------------------------------------------------------------- cpPlugins::Widgets::SeedWidget:: SeedWidget( ) @@ -53,6 +61,8 @@ template< class I > std::string cpPlugins::Widgets::SeedWidget:: _GD0( itk::DataObject* image ) { + std::cout << "update seeds" << std::endl; + typedef cpExtensions::Interaction::ImageInteractorStyle _S; I* base_image = dynamic_cast< I* >( image ); diff --git a/lib/cpPlugins/Plugins/Widgets/SeedWidget.h b/lib/cpPlugins/Plugins/Widgets/SeedWidget.h index 9c37af7..ee6aa16 100644 --- a/lib/cpPlugins/Plugins/Widgets/SeedWidget.h +++ b/lib/cpPlugins/Plugins/Widgets/SeedWidget.h @@ -24,6 +24,9 @@ namespace cpPlugins itkTypeMacro( SeedWidget, cpPlugins::Interface::ProcessObject ); cpPlugins_Id_Macro( cpPlugins::Widgets::SeedWidget, Widgets ); + public: + virtual itk::ModifiedTimeType GetMTime( ) const; + protected: SeedWidget( ); virtual ~SeedWidget( ); -- 2.47.1