Scientific analysis pipeline for quantifying Haemophilus influenzae engulfment by Saccharomyces cerevisiae from 3D fluorescence microscopy exports.
- Loads paired
*_hflu.csvand*_scer.csvfiles exported from ImageJ, or processes raw Nikon.nd2files directly with a Python-native backend. - Segments hflu and scer objects in 3D, measures voxel-scaled morphology, and applies rule-based QC filters.
- Classifies engulfment using exact 3D mask containment, with the original sphere-based heuristic retained for legacy CSV sessions.
- Aggregates per-sample results across biological and technical replicates.
- Computes replicate statistics plus ANOVA or Kruskal-Wallis selection.
- Generates figures and size-filter diagnostics.
- Writes QC overlays, performance reports, and resumable per-sample caches for ND2 sessions.
- Optionally runs an ImageJ macro on raw ND2 sessions as a legacy fallback.
config.example.yaml: Template configuration for local runs.src/: Python pipeline modules.macros/image_processing.ijm: ImageJ macro for ND2 preprocessing.tests/: Automated tests and fixtures.
python -m pip install -r requirements.txtThe ND2 backend depends on:
nd2for Nikon raw-file accessscikit-imageandscipy.ndimagefor segmentation, labeling, morphology, and measurements
Copy the example config before running locally:
cp config.example.yaml config.yamlOn Windows PowerShell:
Copy-Item config.example.yaml config.yamlconfig.yaml controls:
- hflu and scer size-filter thresholds
- one or more microscopy sessions
- each session's
csv_dir - optional per-session
nd2_dir - output base directory
- optional
imagej_executable - pipeline backend, worker count, cache directory, QC overlay output, label-stack output, and local staging mode
- per-channel segmentation parameters for
scerandhflu - engulfment method and assignment settings
- figure DPI, format, and violin-plot toggle
config.yaml is intentionally ignored by git because it usually contains local data paths. Commit changes to config.example.yaml when shared defaults need to change.
Run the pipeline:
python src/main.pyRun with a different config:
python src/main.py --config tests/fixtures/test_config.yamlRun the tests:
python -m pytest -qEach run creates a timestamped directory under output/ containing:
process_log_<timestamp>.txtsummary.csvqc_summary.csvperformance.csvstatistical_report.csvper_sample/results_<sample>.csvper_sample/assignment_<sample>.csvwhen assignment export is enabledfigures/*.pngcell_sizes/*.pngqc/*_overlay.pngqc/*_scer_max.pngqc/*_hflu_max.png
- Sample prefixes must match
^[A-Z][1-9][0-9]*$. - Raw microscopy files, derived exports, caches, and run outputs are intentionally excluded from git.
- Shapiro-Wilk runs only for biological replicates with at least 3 technical replicates.
- If any replicate has fewer than 3 observations, or any normality test fails, the pipeline uses Kruskal-Wallis for the group comparison.