|
|
Pulse Provides a Python API that uses a pybind11 interface to communicate with a Pulse Engine
|
|
|
|
|
|
We provide [several example python files](https://gitlab.kitware.com/physiology/engine/-/tree/master/src/python/pulse/howto) to demonstrate how to use our provided API
|
|
|
|
|
|
There are several ways to use our Python API:
|
|
|
|
|
|
#### Web Hosted Jupyter Notebooks
|
|
|
|
|
|
[Binder](mybinder.org) provides a hosting service for browser based notebooks where you can view, run, and create new notebooks with out the need to install any packages or build any code.
|
|
|
[Click here to open our Binder Jupyter Notebooks](https://mybinder.org/v2/git/https%3A%2F%2Fgitlab.kitware.com%2Fphysiology%2Fjupyter.git/master)
|
|
|
|
|
|
The environment provided, along with all notebooks are built from [this repository](https://gitlab.kitware.com/physiology/jupyter)
|
|
|
|
|
|
#### Building and Using Pulse Python Bindings
|
|
|
|
|
|
Ensure you have Python3 installed and available on your path.
|
|
|
|
|
|
Clone and follow the instructions to build the Pulse Physiology Engine.
|
|
|
When configuring CMake, enable the Pulse_PYTHON_API
|
|
|
|
|
|
![image](uploads/59f21b26434b50226296b23273ebc8f0/image.png)
|
|
|
|
|
|
##### Using PyCharm
|
|
|
|
|
|
Once Pulse completes its build process, you can explore the provided Pulse API in PyCharm using [these instructions](https://gitlab.kitware.com/physiology/engine/-/wikis/Using%20Pycharm)
|
|
|
|
|
|
##### Updating your PYTHONPATH
|
|
|
|
|
|
You will need to add the following to our PYTHONPATH
|
|
|
- From your Pulse source code directory, add the `engine/src/python` folder
|
|
|
- From your Pulse build directory, add the 'build/install/bin` folder
|
|
|
- This contains the pybind11 object, for example on windows it is the `PyPulse.cp37-win_amd64.pyd` file
|
|
|
- Alternatively, you may copy this file to any folder already in your PYTHONPATH
|
|
|
|
|
|
Creating new patients in Pulse will require that files on disk are accessible. As [explained here](https://gitlab.kitware.com/physiology/engine/-/wikis/how%20to%20connect%20to%20pulse#application-execution)
|
|
|
You may either:
|
|
|
- Copy these directories to your application working directory
|
|
|
- Set the location of the root directory using the `set_data_root_dir` method on the SEPatientConfiguration object
|
|
|
|
|
|
|
|
|
For any issues or questions using our Python API, contact us on our [discourse forum](https://discourse.kitware.com/c/pulse-physiology-engine)
|
|
|
|
|
|
|
|
|
|
|
|
|