Implementation of the Silver Mountain Operator (SMO) for the estimation of background distributions.
SMO is a Python package that implements the Silver Mountain Operator (SMO), which allows to recover an unbiased estimation of the background intensity distribution in a robust way.
To learn more about the theory behind SMO, you can read the pre-print in BioRxiv.
If you use this software, please cite that pre-print.
To obtain a background-corrected image, it is as straightforward as:
import skimage.data from smo import SMO image = skimage.data.human_mitosis() smo = SMO(sigma=0, size=7, shape=(1024, 1024)) background_corrected_image = smo.bg_corrected(image)
where we used a sample image from
the background correction subtracts the median value of the background distribution.
Note that the background regions will end up with negative values,
but with a median value of 0.
A notebook explaining in more detail the meaning of the parameters and other possible uses for SMO is available here: smo/examples/usage.ipynb .
It can be installed with
pip from PyPI:
pip install smo
conda from the conda-forge channel:
conda install -c conda-forge smo
A napari plugin is available.
Option 1: in napari, go to
Plugins > Install/Uninstall Plugins...in the top menu, search for
smoand click on the install button.
Option 2: just
pipinstall this package in the napari environment.
It will appear in the
To install, save this file into your CellProfiler plugins folder. You can find (or change) the location of your plugins directory in
File > Preferences > CellProfiler plugins directory.
ImageJ / FIJI¶
To install, download this file and:
Option 1: in the ImageJ main window, click on
Plugins > Install... (Ctrl+Shift+M), which opens a file chooser dialog. Browse and select the downloaded file. It will prompt to restart ImageJ for changes to take effect.
Option 2: copy into your ImageJ plugins folder (
File > Show Folder > Plugins).
To use the plugin, type
smo on the bottom right search box:
smo in the
Quick Search window and click on the
Note: the ImageJ plugin does not check that saturated pixels are properly excluded.
Code style is enforced via pre-commit hooks. To set up a development environment, clone the repository, optionally create a virtual environment, install the [dev] extras and the pre-commit hooks:
git clone https://github.com/maurosilber/SMO cd SMO conda create -n smo python pip numpy scipy pip install -e .[dev] pre-commit install
- 06 February 2023
- 21 September 2021
- Information not submitted
- Stars: 11
- Forks: 4
- Issues + PRs: 1