trame-slicer
trame-slicer is a Python library bringing 3DSlicer components in trame as a composable library.
It uses 3D Slicer's python wrapping and adds a thin wrapping to make it available with the trame framework.
Usage
The API Reference documentation provides API-level documentation.
Installing
The library can be installed in a Python environment as follows:
- Setup a Python 3.10-3.13 (included) virtualenv and activate it
- From PyPI
- Use
pip install "trame-slicer[standalone]"to install the latest release
- Use
- From GitHub
- Git clone the library
- cd into the library
- Use the
pip install -e ".[standalone]"command to install the library along it's dependencies
- For optimal performances, you should install turbo-jpeg
Optional dependencies
vtkstreaming: installtrame-slicer[vtkstreaming]to enable RCA video encoding. Without it, requesting the video encoder (withrca_encoder="video") will fall back to JPEG image encoding.
Encoding
Views are streamed to the browser using the encoder given to
register_rca_factories / RemoteViewFactory through the rca_encoder
parameter:
rca_encoder |
Transport | Requires | Notes |
|---|---|---|---|
None / "turbo-jpeg" |
image | turbo-jpeg (Pillow fallback) | Default, lowest latency |
"jpeg", "png", "webp", "avif" |
image | Pillow (avif also pillow-avif-plugin) |
PNG is lossless, AVIF is smallest but CPU heavier |
"video" (any non-image encoder name) |
video | trame-slicer[vtkstreaming] |
H.264/H.265/VP9/AV1 negotiated with the browser, falls back to TurboJPEG without vtk-streaming |
Getting started
To get started using trame, please have a look at the introductory trame course.
To start using the trame-slicer library, have a look and run the medical viewer app:
python -m trame_slicer.app.medical_viewer_app
Features
The following subset of 3D Slicer features are currently supported :
Views
- 3D view
- Volume rendering
- Color presets / shift
- 2D/slice view
- Scroll/Zoom/Pan
- Window Leveling (W/L)
- Multiplanar Reformation (MPR)
- Slice/slab thickness (MIP, MinIP, AvergageIP)
- Any other view types (e.g. plotly)
Layouts
- Conventional, four-up, side-by-side
- Fullscreen mode
- Custom layouts
I/O
- DICOM
- MRI, CT, US, XR, PET, DWI…
- Scalar volumes
- NRRD, NII, TIFF, HDR, IMG, MHA…
- Segmentation
- SEG.NRRD, NRRD, SEG.NHDR, NHDR, NII, NII.GZ, HDR…
- Models/Meshes
- OBJ, STL, VTK, VTP…
- 3D Slicer scene
- MRML, MRB
Segmentation tools
- Paint: free-hand brush, 2D or 3D, varying radius
- Erase: invert paint
- Scissors: 2D or 3D sculpting
- Draw: fill the area of a drawn contour
- LogicalOperators: binary combination of segments
- Threshold: create segment based on intensity values
- Islands: keep largest, smallest… connected-components
- Smoothing: apply gaussian blur on existing segments
- Volume Intensity Masking: define a ROI with threshold where other segmentation tools work into
- Undo/Redo
Markups
- Fiducials/points
- Ruler/lines
- Angle
- Open curve/spline
- Close curve
- Plane
- ROI/box
Work in progress
To make it easier for users to use trame-slicer, the following work are in progress :
- Slicer wheel generation merge into 3D Slicer's preview release
- CI changes to build the Slicer wheel along 3D Slicer's release
- 3D Slicer extension to install trame-slicer and launch a trame-slicer server directly from 3D Slicer
Troubleshooting
ERROR: No matching distribution found for slicer-core
slicer-core is only supported on specific platforms, please check that your OS and Python version are listed on pypi
Contributing
Contributions are welcomed, please follow the CONTRIBUTING.md file for more information.
License
The library is distributed with a permissive license. Please look at the LICENSE file for more information.
Acknowledgments
This library was funded by the following projects :
- Cure Overgrowth Syndromes (COSY) RHU Project (ANR-18-RHUS-005).
- Handling heterogeneous Imaging and signal data for analysing the Neurodevelopmental Trajectories of premature newborns (HINT) ANR project (ANR-22-CE45-0034)
This library was created from the trame-cookicutter library.
Contact
If you are interested in learning how you can use trame-slicer for your use case in the near future, or want to get an early start using the framework, don't hesitate to contact us. Or reach out in the issue tracker and 3DSlicer discourse community.
Metadata
Release files for trame-slicer 2.0.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 |
|---|---|---|---|---|
| trame_slicer-2.0.0.tar.gz | 2.4 MB | With provenance | Details for trame_slicer-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| trame_slicer-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for trame_slicer-2.0.0-py3-none-any.whl |
Total release size: 3.5 MB
Release files / trame_slicer-2.0.0.tar.gz
| Download URL | trame_slicer-2.0.0.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe8eea705ad45dedd81f69ef75982571a643855cc411c12d829beb0b0625aa25
|
|
BLAKE2b-256 checksum How to use checksums |
c85a22615210d5bc2da8441d13ac3bdea8933c70a2254498a92bd5aede718174
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 24, 2026.
Transparency logRelease files / trame_slicer-2.0.0-py3-none-any.whl
| Download URL | trame_slicer-2.0.0-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a7e14e15cb29db4465936e49ffe79d8d6eede483cdf9cd689fa91b706cebc28
|
|
BLAKE2b-256 checksum How to use checksums |
a2477e592b0a3bcf8f86b3dfd9a50375b8921a8dfbbe4b9a758b1b42dab79706
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 24, 2026.
Transparency logSecurity for trame-slicer 2.0.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 trame_slicer-2.0.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 Oct 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.