]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 18 Mar 2016 19:49:32 +0000 (14:49 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 18 Mar 2016 19:49:32 +0000 (14:49 -0500)
15 files changed:
appli/PipelineEditor/PipelineEditor.cxx
appli/PipelineEditor/PipelineEditor.h
lib/ItkVtkGlue/itkImageToVTKImageFilter.h
lib/ItkVtkGlue/itkVTKImageToImageFilter.h
lib/cpPlugins/BaseWidget.h
lib/cpPlugins/Config.h.in
lib/cpPlugins/Image.h
lib/cpPlugins/Interface.cxx
lib/cpPlugins/Mesh.h
lib/cpPlugins/Object.h
lib/cpPlugins_Config.h [new file with mode: 0644]
lib/cpPlugins_ITKInstances/Base_explicit_description.txt
plugins/cpPluginsIO/DicomSeriesReader.h
plugins/cpPluginsIO/ImageReader.h
plugins/cpPluginsIO/ImageWriter.h

index af79675267fecfe7683251522a1a335593234374..2f7d7eabee3d7f4adf90e6a7fc8241dc7cf40901 100644 (file)
@@ -66,10 +66,15 @@ PipelineEditor( int argc, char* argv[], QApplication* app, QWidget* parent )
       this->m_PluginsPath = info.canonicalPath( ).toStdString( );
       this->_LoadPluginsFromPath( this->m_PluginsPath );
     }
-    else
+    /*
+      else
       this->_UpdateLoadedPlugins( );
+    */
 
   } // fi
+  QDir exec_dir( "." );
+  if( exec_dir.exists( ) )
+    this->_LoadPluginsFromPath( exec_dir.canonicalPath( ).toStdString( ) );
 
   /* TODO
      this->m_Interface = new cpPlugins::Interface( );
@@ -135,14 +140,16 @@ _LoadPluginsFromPath( const std::string& path )
   {
     try
     {
-      this->m_Interface.LoadPluginFile( fIt->toStdString( ) );
+      this->m_Interface.LoadPluginFile(
+        ( dir.absolutePath( ) + QDir::separator( ) + *fIt ).toStdString( )
+        );
     }
-    catch( ... )
+    catch( std::exception& err )
     {
       // Just ignore un-loadable libraries
-    }
+    } // yrt
 
-  } // yrt
+  } // rof
   this->_UpdateLoadedPlugins( );
 }
 
@@ -159,6 +166,7 @@ _UpdateLoadedPlugins( )
       "Error loading default plugins",
       "No plugins loaded: remember to load some!!!"
       );
+    this->_UnBlock( );
     return;
 
   } // fi
index 81a6d3dc1b9109952783088a418fe6b7dd6b4e3f..c5f12612fca2d41a95afbc6cd64f569258dec357 100644 (file)
@@ -13,24 +13,9 @@ class PipelineEditor_Blocker
   : public QObject
 {
 protected:
-  virtual bool eventFilter( QObject* obj, QEvent* event ) override;
+  virtual bool eventFilter( QObject* obj, QEvent* event ) ITK_OVERRIDE;
 };
 
-/*
-  class PipelineEditor;
-  struct PipelineEditor_Application
-  {
-  QApplication           Application;
-  PipelineEditor         Window;
-  PipelineEditor_Blocker Blocker;
-  PipelineEditor_Application( int argc, char* argv[] );
-  void Show( );
-  int Exec( );
-  void Block( );
-  void UnBlock( );
-  };
-*/
-
 // -------------------------------------------------------------------------
 namespace Ui
 {
index 0fc27ac6f5d127e4b6d93f9ca40b354f9ea468d8..9390eb87782d0a710758f4f3bab4596135bbe1e6 100644 (file)
@@ -95,8 +95,8 @@ protected:
   virtual ~ImageToVTKImageFilter();
 
 private:
-  ImageToVTKImageFilter(const Self&) = delete;
-  void operator=(const Self&) = delete;
+  ImageToVTKImageFilter(const Self&) ITK_DELETE_FUNCTION;
+  void operator=(const Self&) ITK_DELETE_FUNCTION;
 
   ExporterFilterPointer       m_Exporter;
   vtkImageImport *            m_Importer;
index 2bb90d4f22e21789ba7e384b4d3bcfe58527da8c..b4427c8355857e69da67b4d0ab285d64f9c80de3 100644 (file)
@@ -83,8 +83,8 @@ protected:
   virtual ~VTKImageToImageFilter();
 
 private:
-  VTKImageToImageFilter(const Self&) = delete;
-  void operator=(const Self&) = delete;
+  VTKImageToImageFilter(const Self&) ITK_DELETE_FUNCTION;
+  void operator=(const Self&) ITK_DELETE_FUNCTION;
 
   typedef vtkSmartPointer<vtkImageExport> ImageExportPointer;
   ImageExportPointer m_Exporter;
index 3dddc59c86e1c39ac16fe7dece2cca9cf8156223..0d679c0cda296868307aae120261fc4794f97821 100644 (file)
@@ -39,10 +39,10 @@ namespace cpPlugins
     void SetMPRViewer( TMPRWidget* v );
     void SetSingleInteractor( vtkRenderWindowInteractor* i );
 
-    virtual bool IsInteractive( ) override;
+    virtual bool IsInteractive( ) ITK_OVERRIDE;
     virtual void SetInteractionObjects(
       const std::vector< void* >& objs
-      ) override;
+      ) ITK_OVERRIDE;
 
   protected:
     BaseWidget( );
index 54f0af4737e6739a33cbdf5a29f73253c7717bf2..f33375a5ee8dfd045dbf74e9b70e122112302168 100644 (file)
@@ -77,6 +77,7 @@
  * Some functions
  * =========================================================================
  */
+#include <iostream>
 namespace cpPlugins
 {
   struct PathHelper
@@ -94,14 +95,22 @@ namespace cpPlugins
     // ---------------------------------------------------------------------
     inline static std::string CanonicalPath( const std::string& path )
       {
+        std::string ret = "";
 #ifdef cpPlugins_SYS_WINDOWS
         TCHAR  buffer[ 4096 ] = TEXT( "" );
         TCHAR** lppPart = { NULL };
         GetFullPathName( path.c_str( ), 4096, buffer, lppPart );
-        return( std::string( buffer ) );
+        ret = std::string( buffer );
 #else // cpPlugins_SYS_WINDOWS
-        return( std::string( realpath( path.c_str( ), NULL ) ) );
+        char* canonical_path = realpath( path.c_str( ), NULL );
+        if( canonical_path != NULL )
+        {
+          ret = canonical_path;
+          free( canonical_path );
+
+        } // fi
 #endif // cpPlugins_SYS_WINDOWS
+        return( ret );
       }
   };
 
index 3144d28c443487594a99d0b87e06fc0917807ee8..4831ecfc0562bbe27834908645e59c4f4be8895a 100644 (file)
@@ -24,8 +24,8 @@ namespace cpPlugins
     cpPlugins_Id_Macro( Image, Object );
 
   public:
-    virtual void SetITK( itk::LightObject* o ) override;
-    virtual void SetVTK( vtkObjectBase* o ) override;
+    virtual void SetITK( itk::LightObject* o ) ITK_OVERRIDE;
+    virtual void SetVTK( vtkObjectBase* o ) ITK_OVERRIDE;
 
   protected:
     Image( );
index 611143e09d66ca6e170a44adb4edd73bcbc05e4b..b8bffc65b6dc4e2f1f09f0c91ae3065876853b84 100644 (file)
@@ -73,11 +73,17 @@ LoadPluginFile( const std::string& filename )
 {
   // Open library with its canonical path name
   auto canonical_fn = cpPlugins::PathHelper::CanonicalPath( filename );
+  if( canonical_fn == "" )
+    throw std::runtime_error(
+      std::string( "cpPlugins::Interface: Library \"" ) +
+      filename +
+      std::string( "\" does not exist." )
+      );
   void* hnd = Self::_DLOpen( canonical_fn );
   if( hnd == NULL )
     throw std::runtime_error(
       std::string( "cpPlugins::Interface: Could not load library \"" ) +
-      canonical_fn +
+      filename +
       std::string( "\"" )
       );
 
index 24d3d6a020d4604e3d1f53c57407ab8eec6ecc9a..6155f46c35da8dcc80818799d1e00776d29ef4ac 100644 (file)
@@ -25,8 +25,8 @@ namespace cpPlugins
     cpPlugins_Id_Macro( Mesh, Object );
 
   public:
-    virtual void SetITK( itk::LightObject* o ) override;
-    virtual void SetVTK( vtkObjectBase* o ) override;
+    virtual void SetITK( itk::LightObject* o ) ITK_OVERRIDE;
+    virtual void SetVTK( vtkObjectBase* o ) ITK_OVERRIDE;
 
   protected:
     Mesh( );
index 881eddebf55a03b1459be35b117d28e47d3b140b..d861d1523bb3492d340084324b9401fbe661d378 100644 (file)
@@ -42,8 +42,8 @@ namespace cpPlugins
     QPointF GetViewCoords( ) const;
 #endif // cpPlugins_QT4
 
-    virtual void Modified( ) const override;
-    virtual itk::ModifiedTimeType GetMTime( ) const override;
+    virtual void Modified( ) const ITK_OVERRIDE;
+    virtual itk::ModifiedTimeType GetMTime( ) const ITK_OVERRIDE;
 
     virtual void SetITK( itk::LightObject* o );
     virtual void SetVTK( vtkObjectBase* o );
diff --git a/lib/cpPlugins_Config.h b/lib/cpPlugins_Config.h
new file mode 100644 (file)
index 0000000..6b245b1
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef __CPPLUGINS_CONFIG__H__
+#define __CPPLUGINS_CONFIG__H__
+
+#include <itkMacro.h>
+
+#ifndef ITK_DELETE_FUNCTION
+#  define ITK_DELETE_FUNCTION
+#endif // ITK_DELETE_FUNCTION
+
+#ifndef ITK_OVERRIDE
+#  define ITK_OVERRIDE
+#endif // ITK_OVERRIDE
+
+#endif // __CPPLUGINS_CONFIG__H__
+
+// eof - $RCSfile$
index 00dd96064bcd72ca7116edc95bc72a6839477537..f4874e7351f14c38940cc1de743e3fe4f241f88d 100644 (file)
@@ -1,3 +1,4 @@
+f cpPlugins_Config.h
 i complex
 i map
 i string
index 1533cd736f1b159459d1e89d32f0ecb0b874bda5..2ad8a9b91edf0d2a9401619a0d7de53ee3c2d0a5 100644 (file)
@@ -23,7 +23,7 @@ namespace cpPluginsIO
 
   public:
     // Qt dialog creation
-    virtual cpPlugins::ParametersQtDialog* CreateQtDialog( ) override;
+    virtual cpPlugins::ParametersQtDialog* CreateQtDialog( ) ITK_OVERRIDE;
 
   protected:
     DicomSeriesReader( );
index a12edcc2d06f8211ea89efa91f0dafbe13d53d10..7b1efe6ea959773f4cc2852af41b5074d5a4a876 100644 (file)
@@ -31,7 +31,7 @@ namespace cpPluginsIO
     ImageReader( );
     virtual ~ImageReader( );
 
-    virtual std::string _GenerateData( ) override;
+    virtual std::string _GenerateData( ) ITK_OVERRIDE;
 
     template< unsigned int _Dim >
       inline std::string _GD0( itk::ImageIOBase* io );
index ba0fb0393421fc5f4b60f4ae5557b1b6af59b6e4..0873207e4b0f10808bad8dfcf916e43384127f4b 100644 (file)
@@ -26,7 +26,7 @@ namespace cpPluginsIO
     ImageWriter( );
     virtual ~ImageWriter( );
 
-    virtual std::string _GenerateData( ) override;
+    virtual std::string _GenerateData( ) ITK_OVERRIDE;
 
     template< class _TInput >
       inline std::string _GD0( _TInput* image );