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.3.1.tar.gz (85.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.3.1-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dropdrop-1.3.1.tar.gz
  • Upload date:
  • Size: 85.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.3.1.tar.gz
Algorithm Hash digest
SHA256 e22e8292866c25fe59df53ea7010e153470b71ed59dcc61571b96d37358eb022
MD5 048762331eaadba29333896219d719bc
BLAKE2b-256 2b8631ba46a813b41d2468a5bcc2b562a578e4ca65662eb7a66d9a2e57fe7111

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: dropdrop-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 23.7 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df8c8999e146b856c6d200df62e06198a8a039b95d0f463ff5a35b48c8454b74
MD5 4fa1302ebe69df021806e596c3ee2fd0
BLAKE2b-256 4eb3149e63042a5393506b4ac3e20c833557f9f9f3759483cceafbfd6dbbc279

See more details on using hashes here.

Provenance

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