]> Creatis software - cpPlugins.git/commitdiff
MAC compilation issues solved... Now some tests please
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 15 Feb 2016 02:34:03 +0000 (21:34 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 15 Feb 2016 02:34:03 +0000 (21:34 -0500)
appli/cpPipelineEditor/App_cpPipelineEditor.cxx
lib/cpPlugins/Interface/Config.h.in
lib/cpPlugins/Interface/Interface.cxx
lib/cpPlugins/Plugins/BasicFilters/MultiplyImageFilter.cxx [new file with mode: 0644]
lib/cpPlugins/Plugins/BasicFilters/MultiplyImageFilter.h [new file with mode: 0644]
lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx
lib/cpPlugins/Plugins/Widgets/SeedWidget.h

index 6227c17ddd18998b2d8284b37edba19a19c4a758..df947d5443593d5d0ab772602c7d491a448f4275 100644 (file)
@@ -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;
 
index a076a2b328b7a3e7dd9cc9c0a9be859ae682e63b..8835c0a48c72f74f88215deec326498876e1857e 100644 (file)
 #  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$
index 4db8f772bc1ac4a1aed4281c008ce8c2b4f95b65..f2a58da9a33341936b8479f5e52d97b6f049a6b4 100644 (file)
@@ -6,15 +6,6 @@
 #include <sstream>
 #include <Pluma/Pluma.hpp>
 
-#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 (file)
index 0000000..48d1a9e
--- /dev/null
@@ -0,0 +1,70 @@
+#include "MultiplyImageFilter.h"
+#include <cpPlugins/Interface/Image.h>
+
+#include <itkMultiplyImageFilter.h>
+
+// -------------------------------------------------------------------------
+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 (file)
index 0000000..7d67aa8
--- /dev/null
@@ -0,0 +1,57 @@
+#ifndef __CPPLUGINS__PLUGINS__MULTIPLYIMAGEFILTER__H__
+#define __CPPLUGINS__PLUGINS__MULTIPLYIMAGEFILTER__H__
+
+#include <cpPlugins/BasicFilters/cpPluginsBasicFilters_Export.h>
+#include <cpPlugins/Interface/BaseProcessObjects.h>
+
+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$
index ee8a59dfe3062d763e09ac186fe6164295af5c29..f9bb4fb339e67291c86fb80f7e802d1ff28cf73d 100644 (file)
@@ -7,6 +7,14 @@
 
 #include <vtkRenderWindowInteractor.h>
 
+// -------------------------------------------------------------------------
+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 );
index 9c37af7eb5d5ebbbdea294ea3113e21877c8fa8f..ee6aa1661cab4ef71594405d25d8292bf2daa73f 100644 (file)
@@ -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( );