SDK for creating extensions for the MedICS (Medical Image Computing and Segmentation) platform
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file medics_extension_sdk-2026.5.19.tar.gz.
File metadata
- Download URL: medics_extension_sdk-2026.5.19.tar.gz
- Upload date:
- Size: 111.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5996ae1dd1a0446dff16dcd66b313c8a4aafe406b968fd628c7ef0278543320a
|
|
| MD5 |
50e430b1bcf409381dcee697f07171f6
|
|
| BLAKE2b-256 |
e207ec8ac667d2b0df0be66e6a876e8db3892d334dd58fbda8c1a7cfb0bda7ea
|
File details
Details for the file medics_extension_sdk-2026.5.19-py3-none-any.whl.
File metadata
- Download URL: medics_extension_sdk-2026.5.19-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86988f34d3ee95a5f95b51963f80dba95c8c3ef47d4a717a0e4004e72e9038f3
|
|
| MD5 |
80f082f014975a331cc5f56c0af1761c
|
|
| BLAKE2b-256 |
342f3fd4375baf2adfeabef6a8bb6c5a9fe7b84d0872c3e6e9e22b4ce9e6240e
|