Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkIPythonService.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #ifndef mitkIPythonService_h
17 #define mitkIPythonService_h
18 
19 // mitk
20 #include <MitkPythonExports.h>
21 #include "mitkImage.h"
22 //for microservices
23 #include <mitkServiceInterface.h>
24 #include "mitkSurface.h"
25 #include <vector>
26 
27 
28 class ctkAbstractPythonManager;
29 
30 namespace mitk
31 {
37  {
38  std::string m_Name;
39  std::string m_Type;
40  std::string m_Value;
41  };
42 
48  {
49  public:
50  virtual void CommandExecuted(const std::string& pythonCommand) = 0;
51  };
52 
58  class MITKPYTHON_EXPORT IPythonService
59  {
60  public:
64  static const int SINGLE_LINE_COMMAND = 0;
68  static const int MULTI_LINE_COMMAND = 1;
72  static const int EVAL_COMMAND = 2;
73 
77  virtual std::string Execute( const std::string& pythonCommand, int commandType = SINGLE_LINE_COMMAND ) = 0;
80  virtual void ExecuteScript( const std::string& pathToPythonScript ) = 0;
83  virtual bool PythonErrorOccured() const = 0;
86  virtual std::vector<PythonVariable> GetVariableStack() const = 0;
89  virtual bool DoesVariableExist(const std::string& name) const = 0;
92  virtual void AddPythonCommandObserver( PythonCommandObserver* observer ) = 0;
95  virtual void RemovePythonCommandObserver( PythonCommandObserver* observer ) = 0;
101  virtual void NotifyObserver( const std::string& command ) = 0;
102 
105  virtual bool IsSimpleItkPythonWrappingAvailable() = 0;
110  virtual bool CopyToPythonAsSimpleItkImage( mitk::Image* image, const std::string& varName ) = 0;
114  virtual mitk::Image::Pointer CopySimpleItkImageFromPython( const std::string& varName ) = 0;
115 
118  virtual bool IsOpenCvPythonWrappingAvailable() = 0;
121  virtual bool CopyToPythonAsCvImage( mitk::Image* image, const std::string& varName ) = 0;
124  virtual mitk::Image::Pointer CopyCvImageFromPython( const std::string& varName ) = 0;
125 
128  virtual bool IsVtkPythonWrappingAvailable() = 0;
131  virtual bool CopyToPythonAsVtkPolyData( mitk::Surface* surface, const std::string& varName ) = 0;
134  virtual mitk::Surface::Pointer CopyVtkPolyDataFromPython( const std::string& varName ) = 0;
135 
137  virtual ctkAbstractPythonManager* GetPythonManager() = 0;
138 
141  virtual ~IPythonService(); // leer in mitkIPythonService.cpp implementieren
142 
143  // force us module loading by linking
144  static std::string ForceLoadModule();
145  };
146 }
147 
148 MITK_DECLARE_SERVICE_INTERFACE(mitk::IPythonService, "org.mitk.services.IPythonService")
149 
150 #endif
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:32
DataCollection - Class to facilitate loading/accessing structured data.
Image class for storing images.
Definition: mitkImage.h:76
virtual void CommandExecuted(const std::string &pythonCommand)=0
MITK_DECLARE_SERVICE_INTERFACE(mitk::ISimulationService,"org.mitk.ISimulationService")