MedICS Extension SDK
Python SDK for building extensions for the MedICS (Medical Image Computing and Segmentation) platform. Provides base classes, API utilities, and a CLI scaffolding tool.
Installation
pip install medics-extension-sdk
With Qt support (required for widget-based extensions):
pip install medics-extension-sdk[qt] # PySide6 (recommended)
pip install medics-extension-sdk[pyqt6] # PyQt6
pip install medics-extension-sdk[qt5] # PyQt5 (legacy)
Development tools:
pip install medics-extension-sdk[dev]
Quick Start
1. Create an extension class
from medics_extension_sdk import BaseExtension
class MyExtension(BaseExtension):
def __init__(self, parent=None):
super().__init__(
parent=parent,
extension_name="My Extension",
author_name="Your Name",
)
def get_version(self) -> str:
return "1.0.0"
def get_description(self) -> str:
return "Does something useful with medical images"
def get_category(self) -> str:
return "Analysis"
def create_widget(self, parent=None, **kwargs):
from PySide6.QtWidgets import QLabel
return QLabel("Hello from My Extension!")
The extension id is automatically derived: "your_name.my_extension".
2. Access platform services
# Inside any extension method:
self.log_message("Processing started")
value = self.get_config_value("my_ext", "threshold", 0.5)
self.set_config_value("my_ext", "threshold", 0.8)
self.send_event("processing_done", {"status": "ok"})
workspace = self.get_component("workspace_manager")
3. Expose a programmatic API
Decorate public methods with @api_method so they are auto-discovered at runtime:
from medics_extension_sdk import BaseExtension, api_method
class MyExtension(BaseExtension):
...
@api_method(description="Run analysis and return results", category="Processing")
def run_analysis(self, threshold: float = 0.5) -> dict:
return {"threshold": threshold, "result": "ok"}
Retrieve the API from an instance:
ext = MyExtension()
api = ext.get_instance_api() # returns apiDict of decorated callables
api.run_analysis(threshold=0.7)
Scaffolding
Generate a new extension template with the CLI:
medics-create-extension "My Segmentation Tool" \
--author "Jane Doe" \
--category "Segmentation" \
--output ./extensions
This creates a fully-structured extension directory with a main class, widget, API methods, config file, and README.
API Reference
BaseExtension
| Member | Type | Description |
|---|---|---|
id |
str (read-only) |
Auto-generated from author_name.extension_name |
extension_name |
str (read-only) |
Set in __init__ |
author_name |
str (read-only) |
Set in __init__ |
app_context |
Any |
Injected by the platform on initialize() |
get_version() |
abstract | Return version string |
get_description() |
abstract | Return short description |
get_category() |
str |
Extension category (default: "General") |
create_widget(parent, **kwargs) |
QWidget |
Override to provide Qt UI |
initialize(app_context) |
bool |
Called by platform at load time |
cleanup() |
None |
Called by platform at unload time |
get_instance_api() |
apiDict |
Returns dict of @api_method callables |
ID format: {author_name}.{extension_name} — lowercased, spaces removed, non-alphanumeric characters replaced with _.
@api_method(description, category)
Marks a method for auto-discovery via get_instance_api().
apiDict
dict subclass with dot-notation attribute access.
Extension Categories
Standard categories for organizing extensions in the platform UI:
"Analysis"— measurement and analysis tools"Segmentation"— segmentation algorithms"Visualization"— rendering and display"Processing"— image filters and transforms"Import/Export"— data I/O utilities"Workflow"— automation and pipeline tools"Utilities"— general helpers"Research"— experimental tools
Testing
import pytest
from medics_extension_sdk import BaseExtension
class MyExtension(BaseExtension):
def __init__(self):
super().__init__(extension_name="My Ext", author_name="Author")
def get_version(self): return "1.0.0"
def get_description(self): return "Test"
def test_id_readonly():
ext = MyExtension()
assert ext.id == "author.my_ext"
with pytest.raises(AttributeError):
ext.id = "hacked"
Run:
pytest tests/
Project Layout
Recommended structure for a published extension package:
my_extension/
+-- __init__.py # exports Extension = MyExtensionClass
+-- my_extension.py # main extension class
+-- icons/ # optional icon assets
+-- config.ini # default configuration
+-- README.md
License
MIT - see LICENSE.
Metadata
Release files for medics-extension-sdk 2026.7.7.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| medics_extension_sdk-2026.7.7.4.tar.gz | 111.5 kB | Without provenance | Details for medics_extension_sdk-2026.7.7.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| medics_extension_sdk-2026.7.7.4-py3-none-any.whl | Python 3 | none | any | Details for medics_extension_sdk-2026.7.7.4-py3-none-any.whl |
Total release size: 127.8 kB
Release files / medics_extension_sdk-2026.7.7.4.tar.gz
| Download URL | medics_extension_sdk-2026.7.7.4.tar.gz |
|---|---|
| Size | 111.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
247cd18e5fa0ba65f93347062b8785624924454cd38f3f617e3812e5d6a2e219
|
|
BLAKE2b-256 checksum How to use checksums |
1406bff6a1643d39146ecad63218aad588a178c40f6effe8b8cc20645e3d565e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / medics_extension_sdk-2026.7.7.4-py3-none-any.whl
| Download URL | medics_extension_sdk-2026.7.7.4-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a182d7df64e3d35fe05eea89567e3a971fc813475926ed129462edfa04bcdf69
|
|
BLAKE2b-256 checksum How to use checksums |
c6a7ca0d2356b1d0729efaae9a62c202e4b92e2867a4e16c2602460ec3b126aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for medics-extension-sdk 2026.7.7.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.