Skip to main content

Remote control for MITK Workbench from Python

Project description

mitk-workbench-remote

Remote control for MITK Workbench from Python

Python 3.11 License SemVer Documentation

mitk-workbench-remote is a Python library for controlling running MITK Workbench instances programmatically via their REST API. It is designed for researchers and developers who want to drive the Workbench from Python scripts, Jupyter notebooks, and ML pipelines — loading images, editing segmentations, and managing data nodes without touching the GUI.

Quick start

import mitk_workbench_remote as mw

# Connect to a running Workbench
wb = mw.connect("http://localhost:8080")

# Show a file, an Image object or any data format directly supported
# (e.g. numpy array, sitk, mlarray)
wb.show("scan.nrrd", opacity=0.8)
wb.show(my_array, name="Prediction", color=(1.0, 0.5, 0.0))

Connections to a loopback host (localhost, 127.0.0.1, ::1) ignore the environment proxy settings by default, since a forward/corporate proxy cannot route to your own machine. Pass trust_env=True (or False) to connect() to override this.

Features

  • wb.show() one-liner for files, numpy arrays, SimpleITK images, and mlarray objects
  • DataStorage CRUD - list, filter, create, and remove data nodes
  • Image transfer with automatic transfer mode negotiation (direct HTTP or file-reference)
  • MultiLabel segmentation editing - groups, labels, pixel data, and full round-trip
  • Rendering control - crosshair position, reinit, and screenshots
  • Discovery and launch - find running instances or start new ones
  • Converter registry for custom image types
  • Structured logging via Python's logging module

Requirements

A running MITK Workbench instance with REST API enabled.

Installation

pip install mitk-workbench-remote

With optional image format support (SimpleITK and MLArray):

pip install mitk-workbench-remote[all]

[all] covers the image-format converters and installs on every supported Python (3.11+). The MITK interop and the typed MxN layout DSL need the mitk / layout extra, which depends on mitk-python; that package currently ships CPython 3.12 wheels only, so those extras require Python 3.12. To install everything on 3.12:

pip install "mitk-workbench-remote[all,layout]"

Development

git clone https://github.com/MITK/mitk-workbench-remote.git
cd mitk-workbench-remote
pip install -e ".[dev]"
pytest

Logging

import logging
logging.basicConfig(level=logging.DEBUG)

Examples

See docs/examples/ for Jupyter notebooks covering common workflows.

Documentation

Full documentation at mitk-workbench-remote.readthedocs.io.

Versioning

This project follows Semantic Versioning 2.0.0 for stable releases. In short: MAJOR bumps mean breaking API changes, MINOR bumps add functionality in a backwards-compatible way, and PATCH bumps are backwards-compatible bug fixes.

Pre-release and development builds use PEP 440 notation (e.g. 1.0.0a1, 0.1.0.dev0) as required by the Python packaging ecosystem. The semantics are equivalent to SemVer pre-release identifiers, only the syntax differs.

License

Please ensure your usage complies with the code license. Apache-2.0 — see LICENSE.

🆘 Support & Contributing

  • 📖 Documentation: Full API documentation available
  • 🐛 Issues: Report bugs and feature requests
  • 💬 Discussion: Join our community for questions and tips
  • 🔧 Contributing: We welcome contributions. More details can be found in the dedicated Contribution Guide.

Copyright & License

Copyright © German Cancer Research Center (DKFZ), Division of Medical Image Computing (MIC).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mitk_workbench_remote-0.1.0rc2.tar.gz (840.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mitk_workbench_remote-0.1.0rc2-py3-none-any.whl (102.3 kB view details)

Uploaded Python 3

File details

Details for the file mitk_workbench_remote-0.1.0rc2.tar.gz.

File metadata

  • Download URL: mitk_workbench_remote-0.1.0rc2.tar.gz
  • Upload date:
  • Size: 840.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mitk_workbench_remote-0.1.0rc2.tar.gz
Algorithm Hash digest
SHA256 8c5b88ae4cd58a63f3165b3a74176016b186318935ee44c7957dceacaa3edaab
MD5 fdbf171a8a6c14566656fc5bf992103e
BLAKE2b-256 a848f75c6fc839887505d994d787421370826fc3c08465f319919ca257d4d665

See more details on using hashes here.

Provenance

The following attestation bundles were made for mitk_workbench_remote-0.1.0rc2.tar.gz:

Publisher: publish.yml on MITK/mitk-workbench-remote

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mitk_workbench_remote-0.1.0rc2-py3-none-any.whl.

File metadata

File hashes

Hashes for mitk_workbench_remote-0.1.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 207e6420283929168758bd75948a55833e36f2b89a4c8c41fbd50db4f24e267c
MD5 cda3752efadb9d2332dce7dad7eb7bdc
BLAKE2b-256 b9888c3f26684b352370ba000fbd0509097787716fc66efc7b26aef2de9cd0b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mitk_workbench_remote-0.1.0rc2-py3-none-any.whl:

Publisher: publish.yml on MITK/mitk-workbench-remote

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page