Skip to main content

A plugin to do image preprocessing, segmentation, and measurements on other images.

Project description

napari-IP-workflow

License PyPI Python Version tests codecov napari hub

A plugin to do image preprocessing, segmentation, and measurements on other images. The typical workflow is background subtraction followed by smoothing, thresholding, and size filtering. This is typically done on nuclear stained images. Segmentation can optionally be followed by circular label expansion to find cytoplasmic signals. The labeled signals are then measured on background subtracted images.

##General organization

The code is separated into non-interactive processing functions (ipfunctions module) and an interactive widget (segwidget module). Please look at the code on github for examples: Github. The expected workflow is from jupyter notebooks with an interactive workflow shown in src/napari-ip-workflow/_tests/standard_segementation_widget.ipynb and a non-interactive workflow shown in src/napari-ip-workflow/_tests/standard_segmentation.ipynb. The expectation is to find the best parameters in an interactive way (ideally testing on several images) and then use the non-interactive workflow to batch through more data sets. All image processing algorithms are in the ipfunctions module and the segwidget module has the Napari widget code. Below I describe the strategies that are utilized in the workflow.

Background subtraction strategy

Automated background subtraction (e.g. as in Fiji) is often accomplished with a low pass filter-style approach like rolling ball background subtraction. This approach fails as feature sizes grow larger or measurements approach the background. Manual selection of the background is more robust but introduces human variability and isn't compatible with high throughput analyses. Our approach is to attempt to automate regional selection of background as follows. First the image is smoothed with a Gaussian filter to eliminate background noise. Next, minimum values are subtracted from each channel and the resulting images are summed. Next, a uniform 2D boxcar smoothing is applied to the image--background level regions in the resulting image are at least the boxcar size distance away from foreground objects. The minimum pixel in that resulting image is a good approximation for the background region of the image. A thick border is specified to avoid lower intensity regions at the border of the image. This algorithm is implemented in the ipfunctions module as findBackground. Once the background region is found, it can be measured with measureCirc.

Segmentation and thresholding strategy

There are many automated thresholding algorithms available via python and, by extension, Napari. This program uses a very simplistic but powerful method. Most segmentable images consist of foreground and background components. In imaging, the foreground is more noisy than the background. Ideally a smoothed background subtracted image will have a maximum intensity that represents the foreground well and a background intensity of 0. In that case, the threshold level can be easily defined as a fraction of that smoothed maximum intensity. A threshold fraction of 0.25 tends to work well but lower values may be more robust if background is fairly smooth and the foreground is noisier. In some cases the foreground has anomalous high values that will skew the estimation. In that case it may be better to estimate the foreground as e.g. the 99th percentile of the intensity. In some cases it may be useful to use the average intensity as a reference point instead or use the raw intensity value (statistic is Identity). Those last options tend to be less robust and it may be desired in those cases to use some of the more complex autothresholding methods. After thresholding, objects on the image edge are eliminated and objects are filtered according to size. The minimum area can easy remove small debris that can contaminate a measurement. The maximum area can be used for large contaminants or poorly segmented clusters of cells that might not be desired in the analysis.


This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.

Installation

You can install napari-IP-workflow via pip:

pip install napari-IP-workflow

To install latest development version :

pip install git+https://github.com/jayunruh/napari-IP-workflow.git

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the GNU GPL v3.0 license, "napari-IP-workflow" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napari-IP-workflow-0.0.3.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

napari_IP_workflow-0.0.3-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file napari-IP-workflow-0.0.3.tar.gz.

File metadata

  • Download URL: napari-IP-workflow-0.0.3.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.12

File hashes

Hashes for napari-IP-workflow-0.0.3.tar.gz
Algorithm Hash digest
SHA256 65e5e46dd6c06a85299a515742dc4ceb43d67d81e612f36796968d71355d3fcc
MD5 d738a14d18cd384a1b1812e8545e0a9a
BLAKE2b-256 741e1d25d8b1d112769efedef83e37707de1a24a69b737cd7b9c8c85425822fc

See more details on using hashes here.

File details

Details for the file napari_IP_workflow-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_IP_workflow-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ef92f9f61a0743017602d553115d34888a7fbbacfaa9832fdc044ebd823839cb
MD5 e7f00818af472d1546e2c5d2190da797
BLAKE2b-256 8fec5e4634ce526ad6a662ad6d2278cb18512572fefe567dd977b59e7a072c26

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page