gtagora-workbook-py
Agora workbook utilities for Python
Pure, dependency-free (no numpy, no HTTP client) helpers for working with the JSON shape of an Agora Workbook - mask RLE encoding, default CMR contour/landmark button templates, and merging new masks/contour groups into an existing workbook session. No network code lives here; it's meant to be shared by anything that needs to build or read Workbook data, whether that's a REST client (see gtagora-connector-py, which depends on this package) or code with direct database access.
Installation
pip install gtagora-workbook-py
Usage
Mask encoding/decoding (workbook.mask)
Encode a (size_x * size_y) label array into the base64 RLE format used by a
Workbook mask's mSliceMask[i].mBase64Values, and decode it back:
from workbook.mask import encode_mask, decode_mask
encoded = encode_mask(labels) # labels: flat list of ints, one per pixel
decoded = decode_mask(encoded, len(labels))
assert decoded == labels
Decode a full Workbook mask dict (mSizeX/Y/Z/T plus one mSliceMask entry
per (z, t)) into a flat list and its (X, Y, Z, T) shape:
from workbook.mask import decode_full_mask
decoded = decode_full_mask(mask) # mask: one entry of workbook['mask']['mMasks']
print(decoded.shape) # (size_x, size_y, size_z, size_t)
Convert to a numpy array with a single call:
import numpy as np
array = np.array(decoded.data, dtype=np.uint8).reshape(decoded.shape)
Default CMR templates (workbook.templates)
from workbook.templates import default_cmr_contour_buttons, default_cmr_landmark_buttons, new_cmr_workbook_body
object_buttons = default_cmr_contour_buttons() + default_cmr_landmark_buttons()
body = new_cmr_workbook_body(dataset_id=158, name='CMR Workbook') # ready to POST to a Workbook endpoint
Merging into an existing workbook session (workbook.session)
from workbook.session import merge_contour_session, merge_mask_session, resolve_contour_buttons
# insert/replace `mask` (by its 'name') into an existing mask session
mask_session = merge_mask_session(workbook['mask'], workbook_id=workbook['id'], mask=mask)
# insert/replace contour groups (by 'name') and set the object buttons
contour_session = merge_contour_session(
workbook['contour'], workbook_id=workbook['id'],
contour_groups=contour_groups, object_buttons=object_buttons)
# a workbook's own contour buttons, or the default CMR set if it has none yet
object_buttons = resolve_contour_buttons(workbook.get('contour'))
Metadata
Release files for gtagora-workbook-py 0.2.0
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 |
|---|---|---|---|---|
| gtagora_workbook_py-0.2.0.tar.gz | 10.9 kB | With provenance | Details for gtagora_workbook_py-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gtagora_workbook_py-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for gtagora_workbook_py-0.2.0-py3-none-any.whl |
Total release size: 20.8 kB
Release files / gtagora_workbook_py-0.2.0.tar.gz
| Download URL | gtagora_workbook_py-0.2.0.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12e283a752df8d116d05ef8fcfc06d8a22f1333830d984b2c78fcc5d08cb0076
|
|
BLAKE2b-256 checksum How to use checksums |
b2ae67cc656346825473111bf3585fd9411d1a1798f9cf5b6e97380f866a6678
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logRelease files / gtagora_workbook_py-0.2.0-py3-none-any.whl
| Download URL | gtagora_workbook_py-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26c9312e32194c5101c0376ec70a609b1beba87fc22d7eecb7beeff147ecd15b
|
|
BLAKE2b-256 checksum How to use checksums |
3a7e345dd9291956e73a724d45dd8453366e52dc904ac113f02fef6991030840
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logSecurity for gtagora-workbook-py 0.2.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for gtagora_workbook_py-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logA 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.