Skip to main content

OpenHCS BaSiCPy

This is OpenHCSDev's JAX-based fork, packaged as openhcs-basicpy. It retains the basicpy Python API; it is not the upstream PyPI basicpy 2.x PyTorch implementation. Use pip install openhcs-basicpy for this fork. Do not install both distributions into the same environment: they provide the same Python package. Numerical and saved-model controls cover Python 3.12 and 3.14; this does not establish biological validity for a new acquisition. Use the BaSiC Python API shown below; the inherited, unimplemented CLI has been removed rather than advertised as a working command. A python package for background and shading correction of optical microscopy images

PyPI Status Python Version License Tests pre-commit Black Read the Docs

All Contributors

BaSiCPy is a python package for background and shading correction of optical microscopy images. It is developed based on the Matlab version of BaSiC tool with major improvements in the algorithm.

Reference:

  • BaSiCPy: A robust and scalable shadow correction tool for optical microscopy images (in prep.)
  • A BaSiC Tool for Background and Shading Correction of Optical Microscopy Images by Tingying Peng, Kurt Thorn, Timm Schroeder, Lichao Wang, Fabian J Theis, Carsten Marr*, Nassir Navab*, Nature Communication 8:14836 (2017). doi: 10.1038/ncomms14836.

Simple examples

Notebook Description Colab Link
timelapse_brightfield 100 continuous brightfield frames of a time-lapse movie of differentiating mouse hematopoietic stem cells. Open In Colab
timelapse_nanog 189 continuous fluorescence frames of a time-lapse movie of differentiating mouse embryonic stem cells, which move much more slower compared to the fast moving hematopoietic stem cells, resulting in a much larger correlation between frames. Note that in this challenging case, the automatic parameters are no longer optimal, so we use the manual parameter setting (larger smooth regularization on both flat-field and dark-field) to improve BaSiC’s performance. Open In Colab
WSI_brain you can stitch image tiles together to view the effect of shading correction Open In Colab

You can also find examples of running the package at notebooks folder. Data used in the examples and a description can be downloaded from Zenodo.


Usage

See Read the Docs for the detailed usage.

Installation

After the first fork release is published:

pip install openhcs-basicpy

Development installation uses this fork:

git clone https://github.com/OpenHCSDev/BaSiCPy.git
cd BaSiCPy
pip install .

The fork requires Python 3.11+ and JAX 0.9.2. CPU wheel availability follows the JAX installation guide: Linux x86-64/ARM64, Apple Silicon macOS, and Windows x86-64. Modern JAX does not publish Intel macOS wheels. CPU numerical acceptance here covers Linux Python 3.12 and 3.14, not a tested cross-platform installation matrix.

Install with dev dependencies

git clone https://github.com/peng-lab/BaSiCPy.git
cd BaSiCPy
python -m venv venv
source venv/bin/activate
pip install -e '.[dev]'

Development

bump2version

This repository uses bump2version to manage dependencies. New releases are pushed to PyPi in the CI pipeline when a new version is committed with a version tag and pushed to the repo.

The development flow should use the following process:

  1. New features and bug fixes should be pushed to dev
  2. When tests have passed a new development version is ready to be release, use bump2version major|minor|patch. This will commit and create a new version tag with the -dev suffix.
  3. Additional fixes/features can be added to the current development release by using bump2version build.
  4. Once the new bugs/features have been tested and a main release is ready, use bump2version release to remove the -dev suffix.

After creating a new tagged version, push to Github and the version will be built and pushed to PyPi.

All-contributors

This repository uses All Contributors to manage the contributor list. Please execute the following to add/update contributors.

yarn
yarn all-contributors add username contribution
yarn all-contributors generate # to reflect the changes to README.md

For the possible contribution types, see the All Contributors documentation.

Contributors

Current version


Nicholas-Schaub

📆 👀 🚇 ⚠️ 💻 🤔

Tim Morello

💻 📖 👀 ⚠️ 🤔 🚇

Tingying Peng

🔣 💵 📆 📢 💻

Yohsuke T. Fukai

🔬 💻 🤔 👀 ⚠️ 💬 🚇

YuLiu-web

📖 📓

For details on the contribution roles, see the documentation.

Old version (f3fcf19), used as the reference implementation to check the approximate algorithm

  • Lorenz Lamm (@LorenzLamm)
  • Mohammad Mirkazemi (@Mirkazemi)

Metadata

Release files for openhcs-basicpy 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openhcs-basicpy 1.3.1
File Size Uploaded
openhcs_basicpy-1.3.1.tar.gz 30.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openhcs-basicpy 1.3.1
File Interpreter ABI Platform
openhcs_basicpy-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 52.9 kB

Release files / openhcs_basicpy-1.3.1.tar.gz

Download URL openhcs_basicpy-1.3.1.tar.gz
Size 30.7 kB
Tags Source
SHA-256 checksum
How to use checksums
638d31348fe67ee1e587f74639aa78138511fc5535da77f9948e27b85d0cc266
BLAKE2b-256 checksum
How to use checksums
feb02c3e9f2c95f1f9fa86b2ce9074dd2554e7b90374b480defbbaf26752af16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / openhcs_basicpy-1.3.1-py3-none-any.whl

Download URL openhcs_basicpy-1.3.1-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aef4f3ee03892df7928de4216f09b0eac43e7b3179d868c97699e1f3cbcd7f37
BLAKE2b-256 checksum
How to use checksums
069c0490763c9c804b91509c8e4c63bb0fd655b4c9dba69e469bd827b4c201b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page