SMO
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.
We provide an easy to use Python package and plugins for some of the major image processing softwares: napari, CellProfiler, and ImageJ / FIJI. See Plugins section below.
Citation
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.
Usage
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 scikit-image.
By default,
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 .
Installation
It can be installed with pip from PyPI:
pip install smo
or with conda from the conda-forge channel:
conda install -c conda-forge smo
Plugins
Napari
A napari plugin is available.
To install:
-
Option 1: in napari, go to
Plugins > Install/Uninstall Plugins...in the top menu, search forsmoand click on the install button. -
Option 2: just
pipinstall this package in the napari environment.
It will appear in the Plugins menu.
CellProfiler
A CellProfiler plugin in available in the smo/plugins/cellprofiler folder.
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
An ImageJ / FIJI plugin is available in the smo/plugins/imagej folder.
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:
select smo in the Quick Search window and click on the Run button.
Note: the ImageJ plugin does not check that saturated pixels are properly excluded.
Development
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
Metadata
Release files for smo 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| smo-2.0.2.tar.gz | 811.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| smo-2.0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 1.5 MB
Release files / smo-2.0.2.tar.gz
| Download URL | smo-2.0.2.tar.gz |
|---|---|
| Size | 811.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6bd078874f7401d76c31d8ced0721b67cddae2658bba1ad22c0bf4baad94aed
|
|
BLAKE2b-256 checksum How to use checksums |
4d9420a9a64bd4d6967058b9b5c881c5be8ae3f86d6469a2266d442d71c09b20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|
Release files / smo-2.0.2-py2.py3-none-any.whl
| Download URL | smo-2.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 702.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
06e47647f3fc2caaa9278ac47c6dbe22fe152c7f32f8563ec5539b2487eae17c
|
|
BLAKE2b-256 checksum How to use checksums |
87436bdd23ddbe118c977c5ebe4ad32deccdfc08729ca5213ee62630ae8821c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|