Skip to main content

Napari plugin for 2D microscopy segmentation

Project description

MMV-playground

License BSD-3 PyPI Python Version tests codecov napari hub

This plugin is aimed at researchers in biology and medicine who want to segment and analyze 2D microscopy images. It offers intuitive tools for common pre-processing and analysis tasks.


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

Installation

You can install MMV-playground via pip:

pip install MMV-playground

To install latest development version :

pip install git+https://github.com/MMV-Lab/MMV-playground.git

Documentation

This plugin for the graphics software Napari is designed to analyze two-dimensional microscopy images. Images should be provided in grayscale format, as colored images are not supported. The plugin includes seven core functions for image analysis:

  1. Intensity normalization
  2. Smoothing
  3. Background correction
  4. Spot-shape filter
  5. Filament-shape filter
  6. Thresholding
  7. Topology-preserving thinning

How to Start and Use the Plugin

To start the plugin, open Napari, go to the "Plugins" menu, and select "MMV-playground (MMV-playground)." The MMV-playground interface will appear on the right-hand side of the Napari window, displaying seven buttons, each corresponding to one of the available functions. Clicking a button opens a dialog box where you can select an image, adjust the parameters for the chosen function, and execute it by pressing the "Run" button. Clicking the function button again collapses the dialog box.

Screenshot

Here is a preview of the MMV-playground plugin in action:

MMV-playground Plugin Screenshot


Intensity Normalization

This function adjusts the image intensity to enhance contrast and improve uniformity. Two percentage values are required:

  • Lower percentage (0–5%): Defines the darkest portion of the image to ignore as background noise, which is set to a fixed value.
  • Upper percentage (95–100%): Specifies the brightest portion of the image to be capped, preventing overexposure.

The plugin calculates the respective percentiles based on these values. Intensities below the lower percentile are clipped, and those above the upper percentile are also capped. Finally, all pixel intensities are rescaled to the range [0, 1].


Smoothing

This function reduces noise to enhance image clarity. Two methods are available:

  • Gaussian smoothing
  • Edge-preserving smoothing: Retains edges (e.g., cell boundaries) while reducing noise.

Background Correction

This function removes uneven illumination or background artifacts using a filter. The key parameter is:

  • Kernel size (1–100): Determines the spatial scale of the background correction. Smaller kernel sizes remove local noise, while larger sizes correct for broader illumination variations.

The scipy.ndimage.white_tophat function is used to perform the correction, making this method effective for images with dark backgrounds.


Spot-Shape Filter

This filter detects circular structures, such as cell nuclei or fluorescent spots. It is based on the scipy.ndimage.gaussian_laplace function and requires:

  • Sigma (σ): Controls the size of the spots to detect. Smaller sigma values target smaller spots, while larger values focus on larger structures.

Filament-Shape Filter

This filter highlights elongated structures like cytoskeletal fibers or blood vessels. Using the aicssegmentation.core.vessel.vesselness2D function, the key parameter is:

  • Sigma (σ): Specifies the width of the detected filaments. Lower values detect thinner structures, while higher values identify thicker ones.

Thresholding

This function segments the image into binary regions by separating the signal from the background. Users can choose one of four thresholding methods:

  • Otsu: Best for images with clear separation between background and signal intensities.
  • Li: Suitable for uniformly illuminated images.
  • Triangle: Effective for asymmetrical intensity distributions.
  • Sauvola: Ideal for images with uneven illumination.

The result is a binary image where pixels above the threshold are set to 1 (signal), and all others are set to 0 (background).


Topology-Preserving Thinning

This function extracts the skeleton of structures while maintaining their connectivity. Two parameters are required:

  • Minimum thickness (0.5–5): Defines the smallest allowable thickness of structures before thinning.
  • Thin (1–5): Controls the degree of thinning, reducing structure width while preserving topology (e.g., network connections).

This is particularly useful for analyzing vascular or cellular networks.


What Is Missing?

Currently, unit tests are not implemented, and internal documentation of the source code is still in progress.

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 BSD-3 license, "MMV-playground" 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

mmv_playground-0.1.3.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

MMV_playground-0.1.3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file mmv_playground-0.1.3.tar.gz.

File metadata

  • Download URL: mmv_playground-0.1.3.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for mmv_playground-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4634edfdc450634a299e7aa6afee237972f934c6d78cefe59a3577db5a7ca35d
MD5 e5a6c8e147844372b4b26c0d9613fa24
BLAKE2b-256 979a4a5f977af4f5c791a29aad854a7564cf09c57515f2886fc2857471556ac5

See more details on using hashes here.

File details

Details for the file MMV_playground-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: MMV_playground-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for MMV_playground-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 76922a310be7ee130ec8ba29d35c7abfc5126f86514e6da28a92789c1acc30e4
MD5 307c98489cba299630112dd7f9f05fb8
BLAKE2b-256 e111e7ca52430b7d334041778bc4a33557dbd130c114a6f441135d2004bd2155

See more details on using hashes here.

Supported by

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