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
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.
| Notebook | Description | Colab Link |
|---|---|---|
| timelapse_brightfield | 100 continuous brightfield frames of a time-lapse movie of differentiating mouse hematopoietic stem cells. | |
| 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. | |
| WSI_brain | you can stitch image tiles together to view the effect of shading correction |
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.
See Read the Docs for the detailed usage.
After the first fork release is published:
pip install openhcs-basicpyDevelopment 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.
git clone https://github.com/peng-lab/BaSiCPy.git
cd BaSiCPy
python -m venv venv
source venv/bin/activate
pip install -e '.[dev]'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:
- New features and bug fixes should be pushed to
dev - 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-devsuffix. - Additional fixes/features can be added to the current development release by using
bump2version build. - Once the new bugs/features have been tested and a main release is ready, use
bump2version releaseto remove the-devsuffix.
After creating a new tagged version, push to Github and the version will be built and pushed to PyPi.
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.mdFor the possible contribution types, see the All Contributors documentation.
Nicholas-Schaub 📆 👀 🚇 |
Tim Morello 💻 📖 👀 |
Tingying Peng 🔣 💵 📆 📢 💻 |
Yohsuke T. Fukai 🔬 💻 🤔 👀 |
YuLiu-web 📖 📓 |
For details on the contribution roles, see the documentation.
- Lorenz Lamm (@LorenzLamm)
- Mohammad Mirkazemi (@Mirkazemi)