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.1.0.tar.gz (82.9 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.1.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dropdrop-1.1.0.tar.gz
Algorithm Hash digest
SHA256 b7cdc48a715a18b8770a3afd291e0c8462434ed0d98c50bcef8ccb1e5dfe719a
MD5 658501656f635eee4d7b313dbd9416ec
BLAKE2b-256 ce7444a111f7985c727aaf4c02d584e090170f39f44228e0b7235de0156da7de

See more details on using hashes here.

Provenance

The following attestation bundles were made for dropdrop-1.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: dropdrop-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.4 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f0b2af5b98325bd2868c185931fbc4cf555f8913df3755adf0f3977cfc068aa
MD5 89e0ed09026e7a955ba2bb84b5af1f85
BLAKE2b-256 253a33394dbc15e02b4a2fa76bde43f6a1aaaa7c4a019c792100c44c24970ed9

See more details on using hashes here.

Provenance

The following attestation bundles were made for dropdrop-1.1.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