Microscopy image preprocessing, segmentation, and profiling pipeline
Project description
microProfiler
Microscopy image preprocessing, segmentation, and profiling pipeline for multi-well plate data.
Converts vendor-specific formats (Operetta, MICA) into a unified file structure, then provides a chainable preprocessing pipeline followed by cell segmentation and feature profiling.
Requirements
- Python: >= 3.10
- Conda (recommended) or
pip
Quick setup (conda)
# Create environment from curated file
conda env create -f micro.yml
conda activate micro
# Install microProfiler
pip install -e .
# With dev extras (testing, linting)
pip install -e ".[dev]"
Manual setup (conda or pip)
# Conda
conda create -n micro python=3.10
conda activate micro
conda install -c conda-forge cellpose numpy pandas scipy scikit-image tifffile torch jax pyyaml tqdm
pip install natsort "pydantic>=2.0"
pip install -e .
Pipeline Order
Input → Convert[+resize] → Resize → BaSiC → Z-projection → Tile → Segment → Profile
- Convert — Vendor-format files →
{well}_f{field}_z{z}_t{t}_ch{ch}.tiff(optional resize during write) - Resize (optional) — Standalone resize step (after conversion if
--resizeis set) - BaSiC correction (optional) — Flatfield/darkfield shading correction
- Z-projection (optional) — Max/mean/min projection of Z-stacks
- Tile splitting (optional) — Non-overlapping tiles
- Segmentation (optional) — Cellpose-SAM object detection
- Profiling — Image-level and object-level feature extraction
Quick Start (CLI)
# Run full pipeline using a YAML config file
microprofiler run /path/to/Measurement\ 1 --config examples/pipeline_config.yml
# Run full pipeline on Operetta format (with resize during conversion and standalone resize)
microprofiler run /path/to/Measurement\ 1 --format operetta \
--convert-resize 0.5 \
--resize 0.5 \
--basic fit-transform \
--z-projection max \
--tile 540 540 \
--segment cell --segment-channels ch1 \
--profile-image \
--profile-object cell
# Run full pipeline on MICA format
microprofiler run /path/to/Sequence\ 002 --format mica \
--segment cell --segment-channels ch1 \
--profile-object cell --db results.db
# Convert only (with optional resize and custom output name)
microprofiler convert /path/to/Measurement\ 1 --format operetta --convert-resize 0.5 --output-name myoutput
# Opt out of in-place processing; opt into vendor file deletion
microprofiler run /path/to/Measurement\ 1 \
--no-basic-inplace --no-zproject-inplace --no-tile-inplace \
--delete-original
A complete YAML config with all parameters is at examples/pipeline_config.yml.
Library Usage
from pathlib import Path
from microProfiler.preprocessing.converter import convert_measurement
from microProfiler.preprocessing.z_projection import z_project_dataset
from microProfiler.preprocessing.tile_splitter import tile_dataset
from microProfiler.segmentation.cellpose import segment_dataset
from microProfiler.profiling.image_profiler import profile_images
from microProfiler.profiling.object_profiler import profile_objects
root = Path(r"/path/to/Measurement 1")
# 1. Convert to unified naming (optional resize during conversion)
# Returns an ImageDataset pointing to "image/" by default
ds = convert_measurement(root, vendor_format="operetta", resize_factor=0.5)
# 3. Preprocess (in-place by default — files updated in the images/ directory)
ds = z_project_dataset(ds, root_dir=root, method="max")
ds = tile_dataset(ds, root_dir=root, tile_w=540, tile_h=540)
# 4. Segment
ds = segment_dataset(ds, object_name="cell", chan1=["ch1"])
# 5. Profile
profile_images(ds, db_path=root / "results.db", table_name="image")
profile_objects(ds, mask_name="cell",
intensity_channels=["ch1", "ch2"],
db_path=root / "results.db")
Supported Vendor Formats
| Format | Input Pattern | Output Pattern |
|---|---|---|
| Operetta | r{row}c{col}f{field}p{stack}-ch{channel}sk{timepoint}fk1fl1.tiff |
{well}_f{field}_z{stack}_t{timepoint}_ch{channel}.tiff |
| MICA | {row}/{col}/Pos{field}.tif |
{well}_f{field}_z1_t1_ch{channel}.tiff |
Key Modules
| Module | Purpose |
|---|---|
io.dataset |
Metadata management, filename parsing, image loading |
io.database |
Thread-safe SQLite (WAL mode, per-thread connections) |
io.loaders |
Unified TIFF I/O + lazy intensity normalization |
preprocessing.converter |
Vendor → unified naming |
preprocessing.z_projection |
Z-stack projection |
preprocessing.tile_splitter |
Image tiling |
preprocessing.basic_correction |
BaSiC shading correction wrapper |
segmentation.cellpose |
Cellpose-SAM segmentation |
profiling.image_profiler |
Whole-image features |
profiling.object_profiler |
Per-object features (shape, intensity, texture) |
profiling.extras |
Radial distribution, granularity, GLCM, correlation |
Desktop GUI
microProfiler includes a PySide6 desktop GUI that wraps the full pipeline with step-by-step image preview, parameter configuration, progress bars, and a log console.
System Requirements
- OS: Windows 10/11 (64-bit) — GUI is Windows-optimized; CLI works cross-platform
- RAM: 16 GB minimum (32 GB recommended for large datasets)
- GPU: NVIDIA GPU with CUDA 12+ (recommended for segmentation speed; CPU fallback works)
Running the GUI
conda activate micro
microprofiler
The microprofiler command launches the GUI when called with no arguments. The CLI pipeline is accessible via subcommands:
| Command | Action |
|---|---|
microprofiler |
Launch desktop GUI |
microprofiler run ... |
Run pipeline from CLI |
microprofiler convert ... |
Convert vendor format via CLI |
microprofiler --version |
Print version |
microprofiler --help |
Show CLI help |
Cellpose Model
microProfiler does not bundle Cellpose model weights. On first use:
- Leave the Model field empty to use the built-in
cpsammodel (downloaded automatically by Cellpose). - Or click Browse to select a custom
.ptmodel file.
API Documentation
See docs/api.md for the full API reference including class and function signatures, parameters, and return types.
Acknowledgements
microProfiler uses the following open-source libraries:
- BaSiCPy — Flatfield and darkfield shading correction.
https://github.com/peng-lab/BaSiCPy - Cellpose — Generalist deep learning model for segmentation.
https://github.com/MouseLand/cellpose
Citation
If you use microProfiler in your research, please cite the repository:
@software{microProfiler,
author = {Hao He},
title = {microProfiler: Microscopy Image Preprocessing, Segmentation, and Profiling Pipeline},
year = {2026},
url = {https://github.com/soulong/microProfiler}
}
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file microprofiler-0.9.0.tar.gz.
File metadata
- Download URL: microprofiler-0.9.0.tar.gz
- Upload date:
- Size: 82.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f7c894b7097d928edfaba2d9f23cc693edadfc4a514e42bb60c5804bd447e89
|
|
| MD5 |
83b12432109fef6d0d77dae56278abfb
|
|
| BLAKE2b-256 |
817d84a93477406689ec0ea51df002777dc870d6be852abaa8f7af7402c29446
|
Provenance
The following attestation bundles were made for microprofiler-0.9.0.tar.gz:
Publisher:
publish.yml on soulong/microProfiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
microprofiler-0.9.0.tar.gz -
Subject digest:
6f7c894b7097d928edfaba2d9f23cc693edadfc4a514e42bb60c5804bd447e89 - Sigstore transparency entry: 1615658207
- Sigstore integration time:
-
Permalink:
soulong/microProfiler@da8da2eabcb555afb3dc01cb77ec40699649c12a -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/soulong
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@da8da2eabcb555afb3dc01cb77ec40699649c12a -
Trigger Event:
release
-
Statement type:
File details
Details for the file microprofiler-0.9.0-py3-none-any.whl.
File metadata
- Download URL: microprofiler-0.9.0-py3-none-any.whl
- Upload date:
- Size: 103.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03b057a04310aed1b6c6bd943d2e0f4934ccae783ac300fd9986f22ada0dd700
|
|
| MD5 |
8041974dacf5ee6a965ffc5de0115801
|
|
| BLAKE2b-256 |
33373ce8f02ffb1b54b674884966d102d4bca8bfbf1006d1368f70c851d26d1a
|
Provenance
The following attestation bundles were made for microprofiler-0.9.0-py3-none-any.whl:
Publisher:
publish.yml on soulong/microProfiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
microprofiler-0.9.0-py3-none-any.whl -
Subject digest:
03b057a04310aed1b6c6bd943d2e0f4934ccae783ac300fd9986f22ada0dd700 - Sigstore transparency entry: 1615658210
- Sigstore integration time:
-
Permalink:
soulong/microProfiler@da8da2eabcb555afb3dc01cb77ec40699649c12a -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/soulong
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@da8da2eabcb555afb3dc01cb77ec40699649c12a -
Trigger Event:
release
-
Statement type: