Commit 4d373203 authored by Julien Osman's avatar Julien Osman Committed by Cédric Traizet

ENH: Release Python's GIL during execution

parent 92e0b671
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
*/ */
%module otbApplication %module("threads"=1) otbApplication
%{ %{
#include "itkBase.includes" #include "itkBase.includes"
...@@ -260,22 +260,22 @@ public: ...@@ -260,22 +260,22 @@ public:
#if SWIGPYTHON #if SWIGPYTHON
Logger* GetLogger(); Logger* GetLogger();
#endif #endif
unsigned long itk::Object::AddObserver(const EventObject & event, unsigned long itk::Object::AddObserver(const EventObject & event,
Command * command); Command * command);
bool IsDeprecated(); bool IsDeprecated();
#if SWIGPYTHON #if SWIGPYTHON
%extend %extend
{ {
/** SetupLogger : Add the PythonLogOutput and setup the progress /** SetupLogger : Add the PythonLogOutput and setup the progress
* reporting for the application */ * reporting for the application */
%pythoncode %pythoncode
{ {
def SetupLogger(self): def SetupLogger(self):
logger = self.GetLogger() logger = self.GetLogger()
logger.AddLogOutput(_libraryLogOutput.GetPointer()) logger.AddLogOutput(_libraryLogOutput.GetPointer())
self.progressReportManager = ProgressReporterManager_New() self.progressReportManager = ProgressReporterManager_New()
self.progressReportManager.SetLogOutputCallback(_libraryLogCallback) self.progressReportManager.SetLogOutputCallback(_libraryLogCallback)
self.AddObserver(AddProcessToWatchEvent(), self.AddObserver(AddProcessToWatchEvent(),
...@@ -727,7 +727,7 @@ class ApplicationProxy(object): ...@@ -727,7 +727,7 @@ class ApplicationProxy(object):
""" """
if (name == "thisown"): if (name == "thisown"):
return self.this.own() return self.this.own()
if hasattr(Application, "__swig_getmethods__"): if hasattr(Application, "__swig_getmethods__"):
method = Application.__swig_getmethods__.get(name, None) method = Application.__swig_getmethods__.get(name, None)
if method: if method:
...@@ -758,7 +758,7 @@ class ApplicationProxy(object): ...@@ -758,7 +758,7 @@ class ApplicationProxy(object):
if (name == "progressReportManager"): if (name == "progressReportManager"):
super().__setattr__(name, value) super().__setattr__(name, value)
return return
if hasattr(Application, "__swig_setmethods__"): if hasattr(Application, "__swig_setmethods__"):
method = Application.__swig_setmethods__.get(name, None) method = Application.__swig_setmethods__.get(name, None)
if method: if method:
...@@ -814,7 +814,7 @@ class ApplicationProxy(object): ...@@ -814,7 +814,7 @@ class ApplicationProxy(object):
ImagePixelType_cfloat : SetVectorImageFromCFloatNumpyArray_, ImagePixelType_cfloat : SetVectorImageFromCFloatNumpyArray_,
ImagePixelType_cdouble : SetVectorImageFromCDoubleNumpyArray_, ImagePixelType_cdouble : SetVectorImageFromCDoubleNumpyArray_,
} }
def SetImageFromNumpyArray(self, paramKey, npArray, index=0): def SetImageFromNumpyArray(self, paramKey, npArray, index=0):
""" """
This method takes a numpy array and set ImageIOBase of This method takes a numpy array and set ImageIOBase of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment