Jupyter DICOM Viewer
Lightweight MPR + 3D DICOM viewer for Jupyter notebooks. Runs entirely in the notebook (no desktop UI), with crosshair-synced axial/coronal/sagittal views, optional 3D volume render, and mask overlays.
Install
Using pip (from a local checkout or future PyPI release ipydicom):
pip install -e . # from this repo
# or, once published: pip install ipydicom
Quick start
%matplotlib widget is recommended for best interactivity, but the viewer calls panel/VTK extensions internally. If widgets do not render, ensure ipywidgets/ipympl/Panel are installed and the widget manager is enabled in your notebook frontend.
from jupyter_dicom.DICOMViewer import DICOMViewer
# Option A: use the file chooser in the UI
viewer = DICOMViewer()
# Option B: preload a folder or a single DICOM file
# viewer = DICOMViewer(dicom_path="/path/to/folder_or_file.dcm")
viewer.display()
UI basics:
- File chooser: pick a DICOM folder (or pass
dicom_pathabove). - Buttons: Eye/Adjust/Magic = normalization modes; 3D View = VTK volume render with locator; Metadata = current slice metadata.
- Navigation: click any view or drag sliders; crosshair/sliders stay in sync.
Direct loading (no chooser)
You can still load programmatically:
viewer = DICOMViewer()
vol, dims = viewer.controller.dicom_handler.load_series("/path/to/folder_or_file.dcm")
viewer.controller.mpr_viewer.set_volume(vol, viewer.controller.dicom_handler.get_spacing())
viewer.display()
Overlays (masks/labelmaps)
Supports .npy masks and DICOM-SEG via load_mask_dicom_seg(path); labelmaps must match the loaded volume shape.
[Requires overlay mask shape == volume shape (z, y, x); non-zero voxels are shown with the given color/alpha.]
mask = viewer.new_empty_mask() # shape matches volume (z, y, x)
mask[10:20, 30:50, 40:60] = 1 # demo patch
viewer.set_overlay(mask, alpha=0.4, color=(0.0, 0.9, 0.2), jump_to=True)
# Multiple overlays
oid = viewer.add_overlay(mask2, color=(0.9, 0.0, 0.9), alpha=0.3, overlay_id="lesion", jump_to=True)
viewer.remove_overlay("lesion")
viewer.clear_overlay()
Navigation helpers
viewer.jump_to(x=120, y=90, z=42) # move crosshair and 3D locator
viewer.reset_view() # recenter crosshair
Notes
- Panel/VTK is initialized inside the library; you usually don’t need extra
%matplotlib widgetsetup, but having ipywidgets/ipympl installed is required. - Single-file DICOM or folders both work for
dicom_pathand forload_series. For 3D, the directory containing the file is used. - Sample data: see
samples/README.md(small CT + DICOM-SEG from QIICR/dcmqi, Apache-2.0). Larger TCIA samples are ignored in git (samples/tcia_prostate_seg/placeholder). - Publishing: package is named
ipydicom(pyproject.toml). Build withpython -m buildand upload with twine once credentials are available.
Metadata
Release files for ipydicom 0.1.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 |
|---|---|---|---|---|
| ipydicom-0.1.0.tar.gz | 858.4 kB | Without provenance | Details for ipydicom-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ipydicom-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ipydicom-0.1.0-py3-none-any.whl |
Total release size: 880.0 kB
Release files / ipydicom-0.1.0.tar.gz
| Download URL | ipydicom-0.1.0.tar.gz |
|---|---|
| Size | 858.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19baeefa40584b806a0a32c530f23c888b13c7019613e65dadf28b10fa9f0321
|
|
BLAKE2b-256 checksum How to use checksums |
0ca6550776b3a483b1bec5f559f3f3da98ade6a41fddd570b17b589894f4387e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / ipydicom-0.1.0-py3-none-any.whl
| Download URL | ipydicom-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df2bc019553b022e69a5ed40c6a0db94d18f15539cc7810d286b3533a1a7dca7
|
|
BLAKE2b-256 checksum How to use checksums |
39d22a240d2bde96f9fca6f7d2b297cd626c66ea1c213944bb44e55a2ad0ad88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for ipydicom 0.1.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.
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.