projects yosegi scope

Yosegi Scope: Automated Slide Imaging on an Open-Source Microscope

A research microscope with a motorised stage costs as much as a car. The OpenFlexure Microscope is an open-source, 3D-printable alternative with a precise flexure stage that costs a couple of hundred euros. I built one, printing the frame, assembling the flexure mechanics and motors, and fitting a 40x objective for high-resolution work, following the official build documentation.

A microscope only sees one field of view at a time, and at 40x that field is a tiny fraction of a slide. Surveying a whole specimen by hand means nudging the stage and taking pictures for hours. Yosegi Scope is the Python project that automates it: it detects the extent of the sample, plans an acquisition grid over it, drives the stage through a snake-pattern raster while autofocusing at every tile, and stitches the overlapping captures back into a single high-resolution mosaic.

Stitching uses stage positions and the camera-stage-mapping affine matrix as a first estimate, then refines the alignment by phase correlation via openflexure-stitching, with a fallback for low-texture samples where correlation is unreliable. Stage coordinates and the affine transform are embedded in each tile's EXIF metadata, so a capture run stays reproducible. The roadmap continues into post-processing and applying deep learning computer vision models to the assembled slides, including brightfield-to-fluorescence translation, served behind a typed REST API for remote control of the pipeline.

Stack
Python 3.11, uv, openflexure-microscope-client, openflexure-stitching, libvips, OpenCV, pytest, ruff
Hardware
OpenFlexure Microscope · 40x objective · motorised flexure stage
The assembled OpenFlexure microscope on a desk, with a live stained-tissue capture shown in the OpenFlexure Connect software on the monitor behind itA stitched mosaic of a stained plant stem section, assembled from nine overlapping 40x tilesPlot of the planned acquisition grid: overlapping tile footprints in stage coordinates, with arrows tracing the snake-pattern scan orderA single 40x tile of H&E-stained nervous tissue, one input to the stitching pipelineAn adjacent 40x tile from the same acquisition run, overlapping the previous one so phase correlation can align them