![PyPi](https://img.shields.io/pypi/pyversions/smo.svg)
[![License](https://img.shields.io/github/license/maurosilber/smo)](https://opensource.org/licenses/MIT)
[![PyPi](https://img.shields.io/pypi/v/smo.svg)](https://pypi.python.org/pypi/smo)
[![Conda](https://img.shields.io/conda/pn/conda-forge/smo)](https://anaconda.org/conda-forge/smo)
# 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](https://napari.org), [CellProfiler](https://cellprofiler.org), and [ImageJ](https://imagej.net) / [FIJI](https://fiji.sc). See Plugins section below.
## Citation
To learn more about the theory behind SMO, you can read the [pre-print in BioRxiv](https://doi.org/10.1101/2021.11.09.467975).
If you use this software, please cite that pre-print.
## Usage
To obtain a background-corrected image, it is as straightforward as:
```python
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](https://github.com/maurosilber/SMO/blob/main/smo/examples/usage.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maurosilber/SMO/blob/main/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](https://napari.org) plugin is available.
To install:
- Option 1: in napari, go to `Plugins > Install/Uninstall Plugins...` in the top menu, search for `smo` and click on the install button.
- Option 2: just `pip` install this package in the napari environment.
It will appear in the `Plugins` menu.
### CellProfiler
A [CellProfiler](https://cellprofiler.org) plugin in available in the [smo/plugins/cellprofiler](smo/plugins/cellprofiler) folder.
![](images/CellProfiler_SMO.png)
To install, save [this file](https://raw.githubusercontent.com/maurosilber/SMO/main/smo/plugins/cellprofiler/smo.py) 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](https://imagej.net) / [FIJI](https://fiji.sc) plugin is available in the [smo/plugins/imagej](smo/plugins/imagej) folder.
![](images/ImageJ_SMO.png)
To install, download [this file](https://raw.githubusercontent.com/maurosilber/SMO/main/smo/plugins/imagej/smo.py) 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:
![](images/ImageJ_MainWindow.png)
select `smo` in the `Quick Search` window and click on the `Run` button.
![](images/ImageJ_QuickSearch.png)
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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/maurosilber/smo",
"name": "smo",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "background,fluorescence,microscopy,imaging",
"author": "Mauro Silberberg",
"author_email": "maurosilber@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4d/94/20a9a64bd4d6967058b9b5c881c5be8ae3f86d6469a2266d442d71c09b20/smo-2.0.2.tar.gz",
"platform": null,
"description": "![PyPi](https://img.shields.io/pypi/pyversions/smo.svg)\n[![License](https://img.shields.io/github/license/maurosilber/smo)](https://opensource.org/licenses/MIT)\n[![PyPi](https://img.shields.io/pypi/v/smo.svg)](https://pypi.python.org/pypi/smo)\n[![Conda](https://img.shields.io/conda/pn/conda-forge/smo)](https://anaconda.org/conda-forge/smo)\n\n# SMO\n\nSMO 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.\n\nWe provide an easy to use Python package and plugins for some of the major image processing softwares: [napari](https://napari.org), [CellProfiler](https://cellprofiler.org), and [ImageJ](https://imagej.net) / [FIJI](https://fiji.sc). See Plugins section below.\n\n## Citation\n\nTo learn more about the theory behind SMO, you can read the [pre-print in BioRxiv](https://doi.org/10.1101/2021.11.09.467975).\n\nIf you use this software, please cite that pre-print.\n\n## Usage\n\nTo obtain a background-corrected image, it is as straightforward as:\n\n```python\nimport skimage.data\nfrom smo import SMO\n\nimage = skimage.data.human_mitosis()\nsmo = SMO(sigma=0, size=7, shape=(1024, 1024))\nbackground_corrected_image = smo.bg_corrected(image)\n```\n\nwhere we used a sample image from `scikit-image`.\nBy default,\nthe background correction subtracts the median value of the background distribution.\nNote that the background regions will end up with negative values,\nbut with a median value of 0.\n\nA notebook explaining in more detail the meaning of the parameters and other possible uses for SMO is available here: [smo/examples/usage.ipynb](https://github.com/maurosilber/SMO/blob/main/smo/examples/usage.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/maurosilber/SMO/blob/main/smo/examples/usage.ipynb).\n\n## Installation\n\nIt can be installed with `pip` from PyPI:\n\n```\npip install smo\n```\n\nor with `conda` from the conda-forge channel:\n\n```\nconda install -c conda-forge smo\n```\n\n## Plugins\n### Napari\n\nA [napari](https://napari.org) plugin is available.\n\nTo install:\n\n- Option 1: in napari, go to `Plugins > Install/Uninstall Plugins...` in the top menu, search for `smo` and click on the install button.\n\n- Option 2: just `pip` install this package in the napari environment.\n\nIt will appear in the `Plugins` menu.\n\n### CellProfiler\n\nA [CellProfiler](https://cellprofiler.org) plugin in available in the [smo/plugins/cellprofiler](smo/plugins/cellprofiler) folder.\n\n![](images/CellProfiler_SMO.png)\n\nTo install, save [this file](https://raw.githubusercontent.com/maurosilber/SMO/main/smo/plugins/cellprofiler/smo.py) into your CellProfiler plugins folder. You can find (or change) the location of your plugins directory in `File > Preferences > CellProfiler plugins directory`.\n\n### ImageJ / FIJI\n\nAn [ImageJ](https://imagej.net) / [FIJI](https://fiji.sc) plugin is available in the [smo/plugins/imagej](smo/plugins/imagej) folder.\n\n![](images/ImageJ_SMO.png)\n\nTo install, download [this file](https://raw.githubusercontent.com/maurosilber/SMO/main/smo/plugins/imagej/smo.py) and:\n\n- 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.\n\n- Option 2: copy into your ImageJ plugins folder (`File > Show Folder > Plugins`).\n\nTo use the plugin, type `smo` on the bottom right search box:\n\n![](images/ImageJ_MainWindow.png)\n\nselect `smo` in the `Quick Search` window and click on the `Run` button.\n\n![](images/ImageJ_QuickSearch.png)\n\nNote: the ImageJ plugin does not check that saturated pixels are properly excluded.\n\n## Development\n\nCode 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:\n\n```\ngit clone https://github.com/maurosilber/SMO\ncd SMO\nconda create -n smo python pip numpy scipy\npip install -e .[dev]\npre-commit install\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Implementation of the Silver Mountain Operator (SMO) for the estimation of background distributions.",
"version": "2.0.2",
"split_keywords": [
"background",
"fluorescence",
"microscopy",
"imaging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "87436bdd23ddbe118c977c5ebe4ad32deccdfc08729ca5213ee62630ae8821c8",
"md5": "7546090e27d07f1051ef4c2e374b3271",
"sha256": "06e47647f3fc2caaa9278ac47c6dbe22fe152c7f32f8563ec5539b2487eae17c"
},
"downloads": -1,
"filename": "smo-2.0.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "7546090e27d07f1051ef4c2e374b3271",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 702321,
"upload_time": "2023-02-06T15:07:40",
"upload_time_iso_8601": "2023-02-06T15:07:40.158799Z",
"url": "https://files.pythonhosted.org/packages/87/43/6bdd23ddbe118c977c5ebe4ad32deccdfc08729ca5213ee62630ae8821c8/smo-2.0.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4d9420a9a64bd4d6967058b9b5c881c5be8ae3f86d6469a2266d442d71c09b20",
"md5": "cd11931c9b84962ebbb49c73bbb50d26",
"sha256": "e6bd078874f7401d76c31d8ced0721b67cddae2658bba1ad22c0bf4baad94aed"
},
"downloads": -1,
"filename": "smo-2.0.2.tar.gz",
"has_sig": false,
"md5_digest": "cd11931c9b84962ebbb49c73bbb50d26",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 811890,
"upload_time": "2023-02-06T15:07:41",
"upload_time_iso_8601": "2023-02-06T15:07:41.892480Z",
"url": "https://files.pythonhosted.org/packages/4d/94/20a9a64bd4d6967058b9b5c881c5be8ae3f86d6469a2266d442d71c09b20/smo-2.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-06 15:07:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "maurosilber",
"github_project": "smo",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "smo"
}