Skip to main content

A plugin for batch processing of confocal and whole-slide microscopy images of biological tissues

Project description

napari-tmidas

License BSD-3 PyPI Python Version tests napari hub

The napari-tmidas plugin consists of a growing collection of pipelines for fast batch processing of confocal and whole slide microscopy images of biological tissues. This is a WIP and based on the CLI version of T-MIDAS.

Features

Currently, napari-tmidas provides pipelines as widgets for batch image conversion / cropping / processing, ROI colocalization and label inspection (cf. Usage below).

Installation

First, install Napari in a virtual environment:

mamba create -y -n napari-tmidas -c conda-forge python=3.11 tqdm
mamba activate napari-tmidas
python -m pip install "napari[all]"

Now you can install napari-tmidas via pip:

pip install napari-tmidas

It is recommended to install the latest development version:

pip install git+https://github.com/macromeer/napari-tmidas.git

Dependencies

To use the Batch Microscopy Image Conversion pipeline, we need some libraries to read microscopy formats:

pip install nd2 readlif tiffslide pylibCZIrw acquifer-napari

For the Batch Crop Anything pipeline, we need to install MobileSAM and its dependencies:

pip install git+https://github.com/ChaoningZhang/MobileSAM.git

If you want to batch compress images using Zstandard, use the package manager of your operating system to install it:

sudo apt-get install zstd    # for Linux
brew install zstd            # for macOS
choco install zstandard      # for Windows

Usage

To use the plugin, start napari in the activated virtual environment with this terminal command:

mamba run -n napari-tmidas napari

You can then find the installed plugin in the Plugins tab.

Microscopy Image Conversion

You can start this pipeline via Plugins > T-MIDAS > Batch Microscopy Image Conversion. Currently, this pipeline supports the conversion of .nd2, .lif, .ndpi, .czi and acquifer data. After scanning a folder of your choice for microscopy image data, select a file in the first column of the table and preview and export any image data it contains.

Microscopy Image Conversion Widget

Image Processing

  1. After opening Plugins > T-MIDAS > Batch Image Processing, enter the path to the folder containing the images to be processed (currently supports TIF, later also ZARR). You can also filter for filename suffix.

image

  1. As a result, a table appears with the found images. You can click on them to inspect them in the viewer.

image

  1. Next, select a processing function, set parameters if applicable and Start Batch Processing.

image

  1. You can click on the images in the table to show them in the viewer. For example first click on one of the Original Files, and then the corresponding Processed File to see an overlay.
Image Processing Widget

Note that whenever you click on an Original File or Processed File in the table, it will replace the one that is currently shown in the viewer. So naturally, you'd first select the original image, and then the processed image to correctly see the image pair that you want to inspect.

Batch Label Inspection

If you have already segmented a folder full of images and now you want to maybe inspect and edit each label image, you can use the Plugins > T-MIDAS > Batch Label Inspection, which automatically saves your changes to the existing label image once you click the Save Changes and Continue button (bottom right).

Batch Label Inspection Widget

Crop Anything

This pipeline combines the Segment Anything Model (SAM) for automatic object detection with an interactive interface for selecting and cropping multiple objects from images. To launch the widget, open Plugins > T-MIDAS > Batch Crop Anything. Click the image below to see a video demo.

Crop Anything Widget

ROI Colocalization

This pipeline quantifies colocalization between labeled regions of interest (ROIs) across multiple image channels. It determines the extent of overlap between ROIs in a reference channel and those in one or two other channels. The output is a table of colocalization counts. Optionally, the size of reference channel ROIs, as well as the total or median size of colocalizing ROIs in the other channels, can be included. Colocalization is determined using Boolean masking. The number of colocalizing instances is determined by counting unique label IDs within the overlapping regions. Typically, the reference channel contains larger structures, while other channels contain smaller, potentially nested, structures. For example, the reference channel might contain cell bodies, with the second and third channels containing nuclei and sub-nuclear objects, respectively.

ROI Colocalization Widget

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, "napari-tmidas" is free and open source software

Issues

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


This napari plugin was generated with copier using the napari-plugin-template.

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_tmidas-0.1.9.tar.gz (76.4 kB view details)

Uploaded Source

Built Distribution

napari_tmidas-0.1.9-py3-none-any.whl (79.0 kB view details)

Uploaded Python 3

File details

Details for the file napari_tmidas-0.1.9.tar.gz.

File metadata

  • Download URL: napari_tmidas-0.1.9.tar.gz
  • Upload date:
  • Size: 76.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for napari_tmidas-0.1.9.tar.gz
Algorithm Hash digest
SHA256 b79c0b94a683333e6c7f36fcbdfdfa98fd6fcdd8f281fef716e6f2e4a9aba00a
MD5 cfb243ccfec417cdf366a52ea85b4de3
BLAKE2b-256 14329b74e28bdd16a5213c697d7d3ad0e8c3b6093ed594b4f0b56a5732beb72b

See more details on using hashes here.

File details

Details for the file napari_tmidas-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_tmidas-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b6dcc30ccb235c2642620845d9588571cd724217b7d75acbe3b7663ff6437eb1
MD5 2bdd0b7b3dc4fd7de7a66b4db3cf1a0e
BLAKE2b-256 328b13ee0016ec2d320b5e5c7333624225d60be8df6ebcc84c09c23955b9f8da

See more details on using hashes here.

Supported by

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