Appearance
Quickstart
From a clone, use a fresh virtual environment:
sh
python3 -m venv .venv
. .venv/bin/activate
pip install -e './[imaging]'
pip install openslide-bin
microscope --help
microscope inspect /data/case.svsOpenSlide's native library is required separately. Use a system OpenSlide installation or openslide-bin where supported. Do not mix incompatible installations. Plain pip install -e ./python provides dependency-free workspace/file operations; imaging imports are lazy.
After a future PyPI release, the installation becomes pip install 'microscope-io[imaging]' or pip install 'microscope-io[mcp]'. Those commands are the intended public interface, not a claim that this release has been published.
python
import microscope
import numpy as np
with microscope.open('/data/case.svs') as slide:
print(slide.dimensions, slide.mpp, slide.levels)
slide.layers.add_points([(12020, 8050), (12200, 8240)], name='cells')
probability = np.full((128, 128), .6, dtype=np.float32)
slide.layers.add_probability(
probability, bounds=(12000, 8000, 2048, 2048), name='tumor_mask'
)
slide.save()
preview = slide.render(
region=(12000, 8000, 2048, 2048),
layers=['cells', 'tumor_mask'], output='preview.png',
)
display(preview) # Jupyter; omit in an ordinary scriptfrom microscope import Slide; slide = Slide('case.svs') is equivalent. Opening/inspection/rendering do not save sidecars. save() is explicit; rendering writes only the explicitly requested image output. By default, rendering fits the requested region within 2048 pixels per axis.
Open the same slide in Microscope.io. Connect its parent folder using Save beside slide, then choose Load saved annotations when prompted; this loads the overlay stack too. Generated layers are read-only. Editable geometry is a separate annotation collection. Turn viewer autosave off while Python or an agent edits that namespace; reopen to see external changes.