Skip to main content

Light Beads Microscopy Pipeline using Suite2p

Project description

LBM-Suite2p-Python logo

Tests PyPI version Documentation DOI

Installation · Documentation · User Guide · Issues

A volumetric 2-photon calcium imaging processing pipeline for Light Beads Microscopy (LBM) datasets, built on Suite2p.

  • Process volumetric calcium imaging data - motion correction, cell detection, and signal extraction across z-planes
  • Automated quality diagnostics - ROI quality metrics, ΔF/F traces, and correlation maps
  • Scalable architecture - process single planes or entire volumes with consistent parameters

All Planes MasksΔF/F Traces3D ROI Map
Planar Suite2p outputs combined into a 3D representation of neural activity

Note: lbm_suite2p_python is in late-beta stage of active development. File an issue for bugs or feature requests.

Installation

lbm_suite2p_python is available on PyPI:

We recommend using a virtual environment. For help setting up a virtual environment, see the MBO guide on virtual environments.

# create a new project folder
mkdir my_project && cd my_project

# create environment and install (uv recommended)
uv venv --python 3.12.9
uv pip install lbm_suite2p_python

# or with pip
pip install lbm_suite2p_python

Optional Dependencies

# With rastermap for activity clustering visualization
uv pip install "lbm_suite2p_python[rastermap]"

# With cellpose for anatomical cell detection (includes PyTorch)
uv pip install "lbm_suite2p_python[cellpose]"

# All optional dependencies
uv pip install "lbm_suite2p_python[all]"

Development Installation

git clone https://github.com/MillerBrainObservatory/LBM-Suite2p-Python.git
cd LBM-Suite2p-Python
uv pip install -e ".[dev]"

Quick Start

import lbm_suite2p_python as lsp

results = lsp.pipeline(
    input_data="D:/data/raw",   # path to file, directory, or list of files
    save_path=None,             # default: save next to input
    ops=None,                   # default: use MBO-optimized parameters
    planes=None,                # default: process all planes (1-indexed)
    roi_mode=None,              # default: stitch multi-ROI data
    keep_reg=True,              # default: keep data.bin (registered binary)
    keep_raw=False,             # default: delete data_raw.bin after processing
    force_reg=False,            # default: skip if already registered
    force_detect=False,         # default: skip if stat.npy exists
    dff_window_size=None,       # default: auto-calculate from tau and framerate
    dff_percentile=20,          # default: 20th percentile for baseline
    dff_smooth_window=None,     # default: auto-calculate from tau and framerate
)

User Guide for full API reference and examples

Output Gallery

Planar Results

Each z-plane produces diagnostic images automatically saved during processing.

Correlation Segmentation
correlation image with ROI overlay
Mean Segmentation
mean image with ROI overlay
Quality Diagnostics
ROI quality metrics
ΔF/F Traces
ΔF/F traces sorted by quality

Volumetric Results

Volume-level visualizations combine data across all z-planes.

Orthoslices
XZ/YZ orthogonal projections
Rastermap
activity sorted by similarity (rastermap)

GUI

A graphical interface is available via mbo_utilities:

pip install mbo_utilities
mbo                    # launch GUI
mbo /path/to/data      # open file directly

Note: GUI functionality may lag behind the latest pipeline features.

Troubleshooting

Git LFS Download Errors

If you see smudge filter lfs failed when installing from GitHub:

GIT_LFS_SKIP_SMUDGE=1 uv pip install git+https://github.com/MillerBrainObservatory/LBM-Suite2p-Python.git

Or set it permanently:

# Windows
[System.Environment]::SetEnvironmentVariable('GIT_LFS_SKIP_SMUDGE', '1', 'User')
# Linux/macOS
echo 'export GIT_LFS_SKIP_SMUDGE=1' >> ~/.bashrc
source ~/.bashrc
GUI Dependencies

Linux / macOS:

sudo apt install libxcursor-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev

Windows: Install Microsoft Visual C++ Redistributable

Built With

Issues & Support

Contributing

Contributions are welcome! This project uses:

  • Ruff for linting and formatting (line length: 88, numpy docstring style)
  • pytest for testing
  • Sphinx for documentation

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

lbm_suite2p_python-3.0.0.tar.gz (163.4 kB view details)

Uploaded Source

Built Distribution

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

lbm_suite2p_python-3.0.0-py3-none-any.whl (158.4 kB view details)

Uploaded Python 3

File details

Details for the file lbm_suite2p_python-3.0.0.tar.gz.

File metadata

  • Download URL: lbm_suite2p_python-3.0.0.tar.gz
  • Upload date:
  • Size: 163.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for lbm_suite2p_python-3.0.0.tar.gz
Algorithm Hash digest
SHA256 65526ca9f174e79f60cfd12369439e2c60b5ed42ad113344b47811f0d4d85361
MD5 9d9b6b6dbb09065fa21819bf1b2f93a6
BLAKE2b-256 d72049b898c3074d42b697e1d38a36a4ec1e07fb0e27ad25f78db278f2bdebc4

See more details on using hashes here.

File details

Details for the file lbm_suite2p_python-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lbm_suite2p_python-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9af59f81ece866bbcc42594e700a2782d3ec32e781c0064d73d1789f3d01e83
MD5 8240e3f8bef2d819c7046977ff20a23e
BLAKE2b-256 58d5abee9eb3e7dc230c0517877a3315efaa1c842bb4b29f241bc6c019fb2c06

See more details on using hashes here.

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