Skip to main content

Python pipeline script for detecting droplets with beads and other inclusions via cellpose

Project description

DropDrop

Automated Python pipeline for detecting droplets and inclusions (beads) in microscopy z-stacks using Cellpose segmentation and morphological analysis.

Tailored for the EVOS M5000 Imaging System.

Installation

# Using uv (recommended)
uv pip install dropdrop

# Using pip
pip install dropdrop

From source

git clone https://github.com/yourusername/dropdrop.git
cd dropdrop
uv pip install -e .

Quick Start

# Run with interactive prompts
dropdrop ./images

# Run with settings
dropdrop ./images --settings "d=1000,p=on,l=experiment1"

# Process only first 5 frames (for testing)
dropdrop ./images -n 5

Usage

Basic Commands

# Run pipeline with compact settings
dropdrop ./images --settings "d=1000,p=on,c=6.5e5,l=experiment1"

# Custom output directory
dropdrop ./images ./results/my_project --settings "d=500"

# Interactive viewer (view results after processing)
dropdrop ./images --view

# Interactive editor (manually correct inclusions)
dropdrop ./images --interactive

# Archive output as tar.gz
dropdrop ./images -z

Settings Format

Compact settings string: d=dilution,p=poisson,c=count,l=label

Key Full name Description Default
d dilution Dilution factor 500
p poisson Enable Poisson analysis (on/off) on
c count Stock bead count per uL 6.5e5
l label Project label for output naming None

Cache Control

dropdrop ./images --no-cache       # Disable caching
dropdrop ./images --clear-cache    # Clear cache before run

Interactive Editor

The editor allows manual correction of detected inclusions:

Key Action
Left-click Add inclusion
Right-click (hold) Remove inclusions
s Toggle droplet selection (hover over droplet)
u Undo last action
c Clear all inclusions in frame
d Toggle droplet visibility
Arrow keys / Space Navigate frames
q / Esc Exit

Disabled droplets (gray with X) are excluded from the final results.

Output Structure

results/<YYYYMMDD>_<label>/
  data.csv                  # Raw detection data
  summary.txt               # Settings and statistics
  size_distribution.png     # Droplet diameter histogram
  poisson_comparison.png    # Bead distribution vs theoretical

data.csv columns

Column Description
frame Frame index
droplet_id Droplet ID within frame
center_x, center_y Droplet center coordinates (px)
diameter_px, diameter_um Droplet diameter
area_px, area_um2 Droplet area
inclusions Number of inclusions detected

Configuration

Create config.json in your working directory to customize detection parameters:

{
  "cellpose_flow_threshold": 0.4,
  "cellpose_cellprob_threshold": 0.0,
  "erosion_pixels": 5,
  "kernel_size": 7,
  "tophat_threshold": 30,
  "min_inclusion_area": 7,
  "max_inclusion_area": 50,
  "edge_buffer": 5,
  "min_droplet_diameter": 80,
  "max_droplet_diameter": 200,
  "px_to_um": 1.14,
  "cache": {
    "enabled": true,
    "max_frames": 100
  }
}

Parameters

Parameter Description
cellpose_flow_threshold Cellpose flow threshold for segmentation
cellpose_cellprob_threshold Cellpose cell probability threshold
erosion_pixels Pixels to erode droplet mask before inclusion detection
kernel_size Morphological kernel size for black-hat transform
tophat_threshold Threshold for inclusion detection
min/max_inclusion_area Inclusion size constraints (px)
edge_buffer Buffer from image edge to ignore inclusions
min/max_droplet_diameter Droplet size constraints (px)
px_to_um Pixel to micrometer conversion factor

Requirements

  • Python 3.12+
  • CUDA-capable GPU (recommended for Cellpose)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dropdrop-1.4.0.tar.gz (88.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dropdrop-1.4.0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file dropdrop-1.4.0.tar.gz.

File metadata

  • Download URL: dropdrop-1.4.0.tar.gz
  • Upload date:
  • Size: 88.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dropdrop-1.4.0.tar.gz
Algorithm Hash digest
SHA256 92905b400ff4318fd824279fd834681aec94a945178c43c7cc2d7c9aff007145
MD5 c297cadc0760c5b8fa6a59f6f3fd9035
BLAKE2b-256 00a5229c1b4d6ea46fd7d5d3895c6f77e5ee537ca96c8a1aeff6ca6a764faa36

See more details on using hashes here.

Provenance

The following attestation bundles were made for dropdrop-1.4.0.tar.gz:

Publisher: publish.yml on merv1n34k/dropdrop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dropdrop-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: dropdrop-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dropdrop-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c80a961f1bea3631ba2513f72fd9697d9eff2f1b361d55c246a922fb478fd9aa
MD5 83081804462176aa28ceb876dcb3ca98
BLAKE2b-256 b6c20164bbbb6b82da2a31681093ee3bcd1be7f84bbb7711173936aa4e23edc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for dropdrop-1.4.0-py3-none-any.whl:

Publisher: publish.yml on merv1n34k/dropdrop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page