Various utilities for the Miller Brain Observatory
Project description
Installation · Documentation · User Guide · Supported Formats · Issues
Image processing utilities for the Miller Brain Observatory (MBO).
- Modern Image Reader/Writer: Fast, lazy I/O for ScanImage/generic TIFFs, Suite2p
.bin, Zarr, HDF5, and Numpy (in memeory or saved to.npy) - Run processing pipelines for calcium imaging - motion correction, cell extraction, and signal analysis
- Operates on 3D timeseries natively and is extendable to ND-arrays
- Visualize data interactively with a GPU-accelerated GUI for exploring large datasets with fastplotlib
Select data, visualize, and inspect metadata
Note:
mbo_utilitiesis in late-beta stage of active development. There will be bugs that can be addressed quickly, file an issue or reach out on slack.
Installation
mbo_utilities is available in pypi:
pip install mbo_utilities
We recommend using a virtual environment. For help setting up a virtual environment, see the MBO guide on virtual environments.
# base: reader + GUI
pip install mbo_utilities
# with lbm_suite2p_python, suite2p, cellpose
pip install "mbo_utilities[suite2p]"
# all processing pipelines
pip install "mbo_utilities[all]"
Suite3D + CuPy: Suite3D requires CuPy for GPU acceleration. CuPy must be installed separately to match your CUDA toolkit version:
# check your CUDA version nvcc --version # CUDA 12.x pip install cupy-cuda12x # CUDA 11.x pip install cupy-cuda11xThe install script below detects your systems cuda-version automatically.
Installation Script with UV (Recommended)
The install script will prompt several options:
- Create a virtual environment with
mbo_utilities, - Install the image reader globally, with Destkop Icon + use
mboany terminal - Install in both a virtual environment and globally
- Specify optional dependencies, and environment paths
# Windows (PowerShell)
irm https://raw.githubusercontent.com/MillerBrainObservatory/mbo_utilities/master/scripts/install.ps1 | iex
# Linux/macOS
curl -sSL https://raw.githubusercontent.com/MillerBrainObservatory/mbo_utilities/master/scripts/install.sh | bash
Note: The
mbocommand is available globally thanks to uv tools. Update with the install script or manually withuv tool upgrade mbo_utilities.
Usage
The user-guide covers usage in a jupyter notebook. The CLI Guide provides a more in-depth overview of the CLI commands. The GUI Guide provides a more in-depth overview of the GUI. The ScanPhase Guide describes the bi-directional scan-phase analysis tool with output figures and figure descriptions.
| Command | Description |
|---|---|
mbo /path/to/data.tiff |
View a supported file/folder |
mbo info /path/to/data.tiff |
Show file info and metadata |
mbo convert input.tiff output.zarr |
Convert between formats |
mbo scanphase /path/to/data.tiff |
Run scan-phase analysis |
mbo notebook lsp |
Generate template notebook |
mbo formats |
List supported formats |
mbo download path/to/notebook.ipynb |
Download a notebook to the current directory |
mbo pollen |
Pollen calibration tool (WIP) |
mbo pollen path/to/data |
Pollen calibration - Skip data collection |
GUI
Launch an interactive GPU-accelerated viewer for exploring large imaging datasets. Supports all MBO file formats with real-time visualization.
mbo # launch GUI
mbo /path/to/data # open file directly
mbo --check-install # verify GPU configuration
Scan-Phase Analysis
Measure and correct bidirectional scan-phase offset in resonant scanning microscopy data. Generates diagnostic figures showing temporal stability, spatial variation, and recommended corrections.
mbo scanphase /path/to/data.tiff -o ./output
Supported Formats
| Format | Read | Write | Description |
|---|---|---|---|
| ScanImage TIFF | ✓ | ✓ | Native LBM acquisition format |
| Generic TIFF | ✓ | ✓ | Standard TIFF stacks |
| Zarr | ✓ | ✓ | Chunked cloud-ready arrays |
| HDF5 | ✓ | ✓ | Hierarchical data format |
| Suite2p | ✓ | ✓ | Binary and ops.npy files |
Upgrade
The CLI tool can be upgraded with uv tool upgrade mbo_utilities, or the package can be upgraded with uv pip install -U mbo_utilities.
The CLI tool can be upgraded with uv tool upgrade mbo_utilities, or the package can be upgraded with uv pip install -U mbo_utilities.
| Method | Command |
|---|---|
| Install script | Re-run install script |
| CLI tool | uv tool upgrade mbo_utilities |
| Virtual env | uv pip install -U mbo_utilities |
ScanImage Acquisition Modes
mbo_utilities automatically detects and parses metadata from these ScanImage acquisition modes:
| Configuration | Detection | Result |
|---|---|---|
| LBM single channel | channelSave=[1..N], AI0 only |
lbm=True, colors=1 |
| LBM dual channel | channelSave=[1..N], AI0+AI1 |
lbm=True, colors=2 |
| Piezo (single frame/slice) | hStackManager.enable=False, framesPerSlice=1 |
piezo=True |
| Piezo multi-frame (with avg) | hStackManager.enable=False, logAvgFactor>1 |
piezo=True, averaged frames |
| Piezo multi-frame (no avg) | hStackManager.enable=False, framesPerSlice>1, logAvg=1 |
piezo=True, raw frames |
| Single plane | hStackManager.enable=False |
zplanes=1 |
Note: Frame-averaging (
logAverageFactor > 1) is only available for non-LBM acquisitions.
Uninstall
If installed via quick install script:
# Windows
uv tool uninstall mbo_utilities
Remove-Item -Recurse -Force "$env:USERPROFILE\.mbo"
Remove-Item "$env:USERPROFILE\Desktop\MBO Utilities.lnk" -ErrorAction SilentlyContinue
# Linux/macOS
uv tool uninstall mbo_utilities
rm -rf ~/mbo
If installed in a project venv:
uv pip uninstall mbo_utilities
Troubleshooting
GPU/CUDA Errors
Error: "Failed to auto-detect CUDA root directory"
This occurs when using GPU-accelerated features and CuPy cannot find your CUDA Toolkit.
Check if CUDA is installed:
# Windows
dir "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA" -ErrorAction SilentlyContinue
$env:CUDA_PATH
# Linux/macOS
nvcc --version
echo $CUDA_PATH
Set CUDA_PATH:
# Windows (replace v12.6 with your version)
$env:CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6"
[System.Environment]::SetEnvironmentVariable('CUDA_PATH', $env:CUDA_PATH, 'User')
# Linux/macOS (add to ~/.bashrc or ~/.zshrc)
export CUDA_PATH=/usr/local/cuda-12.6
If CUDA is not installed, download from NVIDIA CUDA Downloads.
Git LFS Download Errors
There is a bug in fastplotlib causing git lfs errors when installed from a git branch.
Set GIT_LFS_SKIP_SMUDGE=1 and restart your terminal:
# Windows
[System.Environment]::SetEnvironmentVariable('GIT_LFS_SKIP_SMUDGE', '1', 'User')
# Linux/macOS
echo 'export GIT_LFS_SKIP_SMUDGE=1' >> ~/.bashrc
source ~/.bashrc
Built With
Issues & Support
- Bug reports: GitHub Issues
- Questions: See documentation or open a discussion
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 mbo_utilities-2.6.3.tar.gz.
File metadata
- Download URL: mbo_utilities-2.6.3.tar.gz
- Upload date:
- Size: 3.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb07e05bc4c06ede7a6cb251d987e4e005a9e7edf23e1d88ae45ddda676b9b77
|
|
| MD5 |
a0defd4f6b78b22ea4c37fdc92977d70
|
|
| BLAKE2b-256 |
e41f8bb070c4c0da335086eb080966750c9bf135bc12ed2729e57ef587909ed2
|
File details
Details for the file mbo_utilities-2.6.3-py3-none-any.whl.
File metadata
- Download URL: mbo_utilities-2.6.3-py3-none-any.whl
- Upload date:
- Size: 3.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
889afcb5cfed7c2c8c0a65d574e0c7c19cb7b9eb15362e5ec26e62c7df38c3fe
|
|
| MD5 |
a3956428055b74c70720a2454f6eb1a6
|
|
| BLAKE2b-256 |
4a33f6051b06d1ec27bf0aa10731762de86288c7bc02f8c0bce94d5be3120bd4
|