Microscopy Image Analysis

DAPI Microscopy Biomass Pipeline

From DAPI fluorescence microscopy to biomass: a fine-tuned Cellpose model, a faithful port of the Zeder biovolume algorithm, and an offline desktop app colleagues use to measure biovolume straight from the microscope.

A microscopy workflow that turns DAPI fluorescence images into cell counts and per-image biovolume (µm³). Segmentation comes from a Cellpose model fine-tuned on the ITU HPC cluster; biovolume comes from a faithful reimplementation of the Zeder algorithm, reverse-engineered from the decompiled binary of YABBA — the reference phytoplankton tool. Both ship inside an offline desktop app that colleagues run at the lab bench.

Overview

The project started as a proposal-first research pipeline: high-recall segmentation proposes candidate objects, crops are exported for human review, contours are refined, and biomass is measured only from clean contours — in the spirit of the Zeder and YABBA phytoplankton biovolume tools.

That research phase answered the key question: rather than adding a separate crop classifier, fine-tuning the segmentation model itself proved the stronger route. Cellpose was fine-tuned on annotated DAPI data using GPU jobs on the ITU HPC cluster, with a threshold sweep to lock in the operating point.

The scientific target is contour-based biovolume, where biomass matters more than raw counts. To measure it the way the field's reference software does, the Zeder biovolume algorithm was ported faithfully from YABBA's decompiled C# source — including replacing a straight-chord approximation with the true medial-axis computation.

The result ships as an offline desktop app: drag DAPI images in (or capture them straight off the Olympus microscope software), get counts, biovolume totals, and overlay previews, and export everything to a running CSV.

Problem

Forcing high-precision full-image segmentation on DAPI microscopy is brittle — objects are small and sparse, and noisy fields produce unreliable masks.

Scientific biomass and biovolume depend on contour fidelity, which an aggressive early segmentation pass tends to sacrifice.

Raw object counts are less meaningful than biomass for this domain — and the field's reference biovolume implementation lives inside a closed legacy Windows tool (YABBA), not a reusable library.

Microscopy inputs arrive in inconsistent formats and naming conventions that must be unified before processing.

What I Built

Designed the proposal-to-biomass architecture — high-recall segmentation, crop export, annotation, local refinement, contour-based measurement — with typed TOML profiles and a CLI covering every stage.

Fine-tuned Cellpose on annotated DAPI data using SLURM GPU jobs with Apptainer containers on the ITU HPC cluster, and swept the cell-probability threshold to fix the production operating point.

Reverse-engineered the Zeder biovolume algorithm from YABBA's decompiled C# source and reimplemented it in Python — including the true medial-axis measurement in place of a straight-chord approximation.

Built the desktop app: a local web UI with drag-and-drop analysis, µm/pixel calibration, per-image counts and biovolume, overlay previews, CSV export, and an installer that sets up CPU or CUDA environments automatically.

Added an Olympus screen-capture workflow that grabs the live microscope view, runs segmentation and biovolume on it, and saves screenshot, overlay, and a row in a running biomass CSV.

Wrote unit tests across segmentation, proposal export, split grouping, and refinement, plus Docker and HPC job scripts for reproducible training.

Approach

Run a high-recall segmentation pass to propose candidate objects rather than committing to final masks, exporting crops and annotation manifests for human review.

Use the reviewed annotations to fine-tune the segmentation model itself — moving quality into the model instead of bolting on a separate crop classifier.

Train on the ITU HPC cluster: Apptainer-containerized Cellpose jobs under SLURM, with GPU sweeps to select the cell-probability threshold in seconds instead of minutes.

Measure biovolume from contours the way the reference tool does: a YABBA-faithful Zeder port, validated against the original's decompiled source.

Ship the model and the measurement in one offline app, calibrated in µm/pixel for the lab's Olympus BX51, so results come out in real units at the bench.

Results

Finished and in use: colleagues run the desktop app to count cells and measure biovolume in their own DAPI images — dragging files in or capturing directly from the microscope, then exporting counts and µm³ totals to CSV.

Segmentation runs on a Cellpose model fine-tuned on the lab's own annotated data, trained on the ITU HPC cluster with a locked, sweep-selected operating threshold.

Biovolume matches the field's reference method: the Zeder algorithm was ported faithfully from YABBA's decompiled source, upgrading its straight-chord approximation to the true medial-axis measurement.

Every stage of the research pipeline emits inspectable debug artifacts — evidence maps, masks, candidate overlays, crop previews, refined overlays — so the workflow can be audited end to end.

Status

In use

Offline desktop app in colleagues' lab workflow.

Segmentation

Cellpose

Fine-tuned on lab data; trained on the ITU HPC cluster.

Biovolume

Zeder

Faithful port from YABBA's decompiled C#, medial-axis measurement.

Outputs

Counts + µm³

Per-image cell counts and biovolume, exported to CSV.

Visuals

Outputs and diagrams from the project.

High-recall proposal overlay with candidate objects highlighted.

High-recall proposal stage — candidate objects flagged across the field for review.

Filtered prediction overlay after review and refinement.

Filtered prediction on the same field after review and fine-tuning.