diff --git a/Modules/Python/documentation/mitkPython.dox b/Modules/Python/documentation/mitkPython.dox index 67e6f30229..0375cea65c 100644 --- a/Modules/Python/documentation/mitkPython.dox +++ b/Modules/Python/documentation/mitkPython.dox @@ -1,85 +1,80 @@ /** \page mitkPython_Overview The MITK Python Module -\section sec1 Brief description -The MITK Python Module provides a service class for interactively run python code (passed as C++ strings) and +\section python_sec1 Brief description +The MITK Python Module provides a service class to interactively run python code (passed as C++ strings) and evaluate the results. Furthermore the service class offers means to convert an MITK Image to an ITK/OpenCV image in their wrapped python environment. Thus, one can process MITK images with Python Code from the OpenCV and ITK wrapping system. Furthermore one can convert an mitk::Surface to a vtkPolyData in its Python environment.
Under the hood, the MITK build system takes care that the wrapping build process for SimpleITK/VTK/OpenCV is correctly initiated and all paths are correctly set within MITK code. To use the features of the different toolkits make sure they are enabled during the superbuild process. -\section sec2 Build Instructions +\section python_sec2 Build Instructions Currently MITK-Python is only supported with Qt4. Qt5 support is in an experimental stage. -Have a look at \ref{ssec3} on how to build MITK-Python with Qt5. +Have a look at \ref python_ssec3 on how to build MITK-Python with Qt5. The following CMake build options are available: -\subsection ssec1 MITK_USE_Python +\subsection python_ssec1 MITK_USE_Python MITK_USE_Python enables the python wrapping in MITK. When the option is activated the build of the additional dependency SimpleITK is also enabled. The default behaviour is to download and build -Python 2.7.3 with numpy and embed it into MITK.To use an own custom runtime see MITK_USE_SYSTEM_PYTHON. +Python 2.7.3 with numpy and embed it into MITK. To use an own custom runtime see MITK_USE_SYSTEM_PYTHON. -\subsection ssec2 MITK_USE_SYSTEM_PYTHON +\subsection python_ssec2 MITK_USE_SYSTEM_PYTHON This option is deactivated by default. If MITK_USE_SYSTEM_PYTHON is activated the python runtime from the system is used. -The user can also specify it's own runtime by modifing the variables added by the +Only Python 2.7.x is supported. +The user can also specify it's own runtime by modifying the variables added by the FindPythonLib.cmake script. Note: A Python runtime with numpy is needed to use the MITK Python wrapping. When using this options all additional libraries installed in the python runtime will be available within the MITK-Python console. -\subsection ssec3 Qt5 Support +\subsection python_ssec3 Qt5 Support In order to build MITK-Python with Qt5 support an external build of CTK and PythonQt 3.0 is necessary. The actual CTK superbuild only supports PythonQt 2.0 that has no Qt 5 support. This will most likely -only work with the MITK_USE_SYSTEM_PYTHON option due to dependcies of each external project. +only work with the MITK_USE_SYSTEM_PYTHON option due to dependencies of each external project. It can be build with the following steps: -\subsubsection Step1 Step1 - Build PythonQt +\subsubsection python_Step1 Step1 - Build PythonQt PythonQt 3 has no CMake build system and has to be build by hand with qmake. -Download and build PythonQt 3 from sourcforge: -\code -http://pythonqt.sourceforge.net/ -\endcode +Download and build PythonQt 3 from sourceforge. -\subsubsection Step3 Step3 - Build MITK -In the last step MITK has to be build with the CTK from the previous step \ref{Step2}. -This is done by setting the CTK_Dir to the CTK build directory: -\code --DCTK_DIR:PATH=/some_path -\endcode - -\subsubsection Step2 Step2 - Build CTK +\subsubsection python_Step2 Step2 - Build CTK Build the actual CTK with the external PythonQt 3 binaries. The external PythonQt 3 binaries can be added in CTK by adding the following CMake variable that points to the PythonQt build directory: \code -DPYTHONQT_INSTALL_DIR:PATH=/your/PythonQt3Build \endcode -More information about the changes added in CTK for PythonQt are available on: +More information about the changes added in CTK for PythonQt are available on Github. + +\subsubsection python_Step3 Step3 - Build MITK +In the last step MITK has to be build with the CTK from the previous step \ref python_Step2. +This is done by setting the CTK_Dir to the CTK build directory: \code -https://github.com/commontk/CTK/pull/538 +-DCTK_DIR:PATH=/some_path \endcode -\section sec3 Suported Data Types +\section python_sec3 Suported Data Types The following data types in MITK are supported in the MITK Python Wrapping: -\subsection ssec4 Image +\subsection python_ssec4 Image Mitk Images can be transferred to python. The images are copied in-memory and transferred as a numpy array to Python and vice versa. The MITK python wrapping creates a SimpleITK image using the numpy array with the properties of the MITK Image. Two dimensional images can also be transferred as an OpenCV image to python. -\subsection ssec5 Surface +\subsection python_ssec5 Surface Surfaces within mitk can be transferred as a vtkPolyData Object to Python. The surfaces are fully memory mapped. When changing a python wrapped surface the original object is also modified on the C++ side of MITK. */ diff --git a/Plugins/org.mitk.gui.qt.python/documentation/UserManual/MitkPythonPluginView.png b/Plugins/org.mitk.gui.qt.python/documentation/UserManual/MitkPythonPluginView.png index befab56719..cf671e2b38 100644 Binary files a/Plugins/org.mitk.gui.qt.python/documentation/UserManual/MitkPythonPluginView.png and b/Plugins/org.mitk.gui.qt.python/documentation/UserManual/MitkPythonPluginView.png differ diff --git a/Plugins/org.mitk.gui.qt.python/documentation/UserManual/QmitkPython.dox b/Plugins/org.mitk.gui.qt.python/documentation/UserManual/QmitkPython.dox index f63444f960..114be980c4 100644 --- a/Plugins/org.mitk.gui.qt.python/documentation/UserManual/QmitkPython.dox +++ b/Plugins/org.mitk.gui.qt.python/documentation/UserManual/QmitkPython.dox @@ -1,33 +1,33 @@ /** \page org_mitk_gui_qt_python The Python Plugin Available sections: - \ref org_mitk_gui_qt_pythonOverview - \ref org_mitk_gui_qt_pythonUsage - \ref org_mitk_gui_qt_PythonConsole - \ref org_mitk_gui_qt_PythonSnippets \section org_mitk_gui_qt_pythonOverview Overview The Python view provides the graphical front end to run Python code through the mitkPython module. Furthermore the SimpleITK/VTK/OpenCV Python wrapping can be used. Images and surfaces in the DataManager can be transferred via a drag & drop mechanism into the MITK Python Console. \section org_mitk_gui_qt_pythonUsage Transfer data Images and surfaces can be tranferred from the data manger into the python console. To transfer an image or surface simply drag it from the data manager into the Variable Stack view, as shown in Figure. A new entry will appear in the Variable Stack, as soon as the data is transferred. As soon as the entry is available the object can be accessed and modified in the python console. Three dimensional images will be copied in-memory to python via numpy and a SimpleITK image object is created with the same properties. When a two dimensional image is transferred the user can choose to transfer it as an OpenCV image object. Surfaces are fully memory mapped as a vtkPolyData object. To transfer an image or surface from the python runtime to the data manager just double click on the corresponding entry in the Variable Stack View. -\imageMacro{MitkPythonPluginView.png,"Screenshot of the MITK Python Plugin",20} +\imageMacro{MitkPythonPluginView.png,"Screenshot of the MITK Python Plugin",6} \section org_mitk_gui_qt_PythonConsole Console The Python console can be used for interactive programming. All items in the data storage can be accessed in the python console. The console can also be used to load python scripts and run them. \section org_mitk_gui_qt_PythonSnippets Snippets The python plugin contains some code snippets of SimpleITK/VTK/OpenCV that can be run in the python console. Snippets can be modified and saved by the user. */