Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::IPythonService Class Referenceabstract

#include <mitkIPythonService.h>

Inheritance diagram for mitk::IPythonService:

Public Member Functions

virtual std::string Execute (const std::string &pythonCommand, int commandType=SINGLE_LINE_COMMAND)=0
 
virtual void ExecuteScript (const std::string &pathToPythonScript)=0
 Executes a python script. More...
 
virtual bool PythonErrorOccured () const =0
 
virtual std::vector< PythonVariableGetVariableStack () const =0
 
virtual bool DoesVariableExist (const std::string &name) const =0
 
virtual void AddPythonCommandObserver (PythonCommandObserver *observer)=0
 adds a command observer which is informed after a command was issued with "Execute" More...
 
virtual void RemovePythonCommandObserver (PythonCommandObserver *observer)=0
 removes a specific command observer More...
 
virtual void NotifyObserver (const std::string &command)=0
 
virtual bool IsSimpleItkPythonWrappingAvailable ()=0
 
virtual bool CopyToPythonAsSimpleItkImage (mitk::Image *image, const std::string &varName)=0
 
virtual mitk::Image::Pointer CopySimpleItkImageFromPython (const std::string &varName)=0
 
virtual bool IsOpenCvPythonWrappingAvailable ()=0
 
virtual bool CopyToPythonAsCvImage (mitk::Image *image, const std::string &varName)=0
 
virtual mitk::Image::Pointer CopyCvImageFromPython (const std::string &varName)=0
 
virtual bool IsVtkPythonWrappingAvailable ()=0
 
virtual bool CopyToPythonAsVtkPolyData (mitk::Surface *surface, const std::string &varName)=0
 
virtual mitk::Surface::Pointer CopyVtkPolyDataFromPython (const std::string &varName)=0
 
virtual ctkAbstractPythonManager * GetPythonManager ()=0
 
virtual ~IPythonService ()
 nothing to do here More...
 

Static Public Member Functions

static std::string ForceLoadModule ()
 

Static Public Attributes

static const int SINGLE_LINE_COMMAND
 
static const int MULTI_LINE_COMMAND
 
static const int EVAL_COMMAND
 

Detailed Description

The central service for issuing Python Code The class also enables to transfer mitk images to python as itk::Image and vice versa

See also
IPythonService::GetVariableStack()

Definition at line 58 of file mitkIPythonService.h.

Constructor & Destructor Documentation

mitk::IPythonService::~IPythonService ( )
virtual

nothing to do here

Definition at line 19 of file mitkIPythonService.cpp.

Member Function Documentation

virtual void mitk::IPythonService::AddPythonCommandObserver ( PythonCommandObserver observer)
pure virtual

adds a command observer which is informed after a command was issued with "Execute"

Implemented in mitk::PythonService.

Referenced by QmitkPythonVariableStackTableModel::QmitkPythonVariableStackTableModel().

virtual mitk::Image::Pointer mitk::IPythonService::CopyCvImageFromPython ( const std::string &  varName)
pure virtual
virtual mitk::Image::Pointer mitk::IPythonService::CopySimpleItkImageFromPython ( const std::string &  varName)
pure virtual

copies an itk image from the python process that is named "varName"

Returns
the image or 0 if copying was not possible

Implemented in mitk::PythonService.

Referenced by QmitkPythonVariableStackTableView::OnVariableStackDoubleClicked().

virtual bool mitk::IPythonService::CopyToPythonAsCvImage ( mitk::Image image,
const std::string &  varName 
)
pure virtual
See also
CopyToPythonAsItkImage()

Implemented in mitk::PythonService.

Referenced by QmitkPythonVariableStackTableModel::dropMimeData().

virtual bool mitk::IPythonService::CopyToPythonAsSimpleItkImage ( mitk::Image image,
const std::string &  varName 
)
pure virtual

copies an mitk image as itk image into the python interpreter process the image will be available as "varName" in python if everythin worked

Returns
true if image was copied, else false

Implemented in mitk::PythonService.

Referenced by QmitkPythonVariableStackTableModel::dropMimeData().

virtual bool mitk::IPythonService::CopyToPythonAsVtkPolyData ( mitk::Surface surface,
const std::string &  varName 
)
pure virtual
See also
CopyToPythonAsItkImage()

Implemented in mitk::PythonService.

Referenced by QmitkPythonVariableStackTableModel::dropMimeData().

virtual mitk::Surface::Pointer mitk::IPythonService::CopyVtkPolyDataFromPython ( const std::string &  varName)
pure virtual
virtual bool mitk::IPythonService::DoesVariableExist ( const std::string &  name) const
pure virtual
Returns
true if a variable with this name is defined in the main namespace, false otherwise

Implemented in mitk::PythonService.

virtual std::string mitk::IPythonService::Execute ( const std::string &  pythonCommand,
int  commandType = SINGLE_LINE_COMMAND 
)
pure virtual

Executes a python command.

Returns
A variant containing the return value as string of the python code (if any)

Implemented in mitk::PythonService.

virtual void mitk::IPythonService::ExecuteScript ( const std::string &  pathToPythonScript)
pure virtual

Executes a python script.

Implemented in mitk::PythonService.

std::string mitk::IPythonService::ForceLoadModule ( )
static

Definition at line 23 of file mitkIPythonService.cpp.

References MITK_INFO.

Referenced by QmitkCtkPythonShell::QmitkCtkPythonShell().

virtual ctkAbstractPythonManager* mitk::IPythonService::GetPythonManager ( )
pure virtual
Returns
the ctk abstract python manager instance

Implemented in mitk::PythonService.

virtual std::vector<PythonVariable> mitk::IPythonService::GetVariableStack ( ) const
pure virtual
Returns
The list of variables in the main namespace

Implemented in mitk::PythonService.

Referenced by QmitkPythonVariableStackTableModel::CommandExecuted().

virtual bool mitk::IPythonService::IsOpenCvPythonWrappingAvailable ( )
pure virtual
Returns
true, if OpenCv wrapping is available, false otherwise

Implemented in mitk::PythonService.

Referenced by QmitkPythonVariableStackTableModel::dropMimeData().

virtual bool mitk::IPythonService::IsSimpleItkPythonWrappingAvailable ( )
pure virtual
Returns
true, if itk wrapping is available, false otherwise

Implemented in mitk::PythonService.

Referenced by QmitkPythonVariableStackTableModel::dropMimeData().

virtual bool mitk::IPythonService::IsVtkPythonWrappingAvailable ( )
pure virtual
Returns
true, if vtk wrapping is available, false otherwise

Implemented in mitk::PythonService.

Referenced by QmitkPythonVariableStackTableModel::dropMimeData().

virtual void mitk::IPythonService::NotifyObserver ( const std::string &  command)
pure virtual

notify all observer. this should only be used if it can be garantueed that the current python interpreter instance got another command from anywhere else the the Execute() method of this service, e.g. the shell widget uses this function since it does not use Execute()

Implemented in mitk::PythonService.

virtual bool mitk::IPythonService::PythonErrorOccured ( ) const
pure virtual
Returns
true if the last call to Execute...() resulted in an error, false otherwise

Implemented in mitk::PythonService.

virtual void mitk::IPythonService::RemovePythonCommandObserver ( PythonCommandObserver observer)
pure virtual

removes a specific command observer

Implemented in mitk::PythonService.

Referenced by QmitkPythonVariableStackTableModel::~QmitkPythonVariableStackTableModel().

Member Data Documentation

const int mitk::IPythonService::EVAL_COMMAND
static

Constant representing a single line command x which is run as "eval(x)"

See also
IPythonService::Execute()

Definition at line 72 of file mitkIPythonService.h.

Referenced by mitk::PythonService::Execute().


The documentation for this class was generated from the following files: