A napari plugin for calculating features from intensity-label image data
Project description
Nyxus Napari
Nyxus Napari is a Napari plugin for running feature calculations on image-segmentation image pairs, using the Nyxus application to compute features. Nyxus is a feature-rich, highly optimized, Python/C++ application capable of analyzing images of arbitrary size and assembling complex regions of interest (ROIs) split across multiple image tiles and files.
For more information on Nyxus, see https://github.com/PolusAI/nyxus.
Installation
To install Napari, it is recommended to first create a separate Conda environment.
conda create -y -n napari-env -c conda-forge python=3.9
conda activate napari-env
After creating the Conda environment, install Napari using pip
python -m pip install "napari[all]"
python -m pip install "napari[all]" --upgrade
or using conda
conda install -c conda-forge napari
conda update napari
Next, Nyxus must be installed. Note that the version of Nyxus must be greater than or equal to 0.50
to run the Napari plugin.
pip install nyxus
or build from source using the instructions at https://github.com/PolusAI/nyxus#building-from-source using the conda build for the python API.
After installing Napari and Nyxus, the Nyxus Napari plugin can be installed by cloning this repo and then building the plugin from the source. An example of this process is provided below.
git clone https://github.com/PolusAI/napari-nyxus.git
cd napari_nyxus
pip install -e .
Napari can then be ran by running
napari
Use
After installing the plugin, start Napari by running the command napari
from the command line. Once the Napari
GUI is loaded, the Nyxus plugin can be loaded from the Plugins
menu in the toolbar by going to Plugins -> nyxus-napari.
A widget will appear in the Napari viewer to run Nyxus.
As shown by the example above, Nyxus will take in Intensity and Segmentation images. These parameters can either be a stack of images or a single image pair. To load an image pair, use File -> Open File(s)... and select the images to load.
Note that this method can also be used to open a stack of image, by using File -> Open Folder... instead of images.
If the segmentation is loaded as an Image type in the napari viewer, it must first be converted to the Labels type. The image can converted as shown below.
The loaded files can then be selected with the Intensity and Segmentation drop down menus. Other parameters can also be changed, such as which features to calculate. For more information on the available features, see https://nyxus.readthedocs.io/en/latest/featurelist.html.
After running Nyxus, the feature calculations will also appear in the Napari viewer.
The Nyxus Napari plugin provides functionality to interact with the table containing the feature calculations. First, click on the segmentation image and then select show selected
in the layer controls.
Then, if a value is clicked in the label
column of the table, the respective ROI will be highlighted in the segmentation image in the viewer.
To select the ROI and have it added to a separate Labels image, the label in the table can be double clicked. Each double clicked label will be added to the same Labels image as show below. To unselect, the ROI, double click its respective label again.
This feature can also be used in the opposite way, i.e. if an ROI is clicked in the segmentation image, the respective row in the feature table will be highlighted.
If one of the column headers are double clicked, a colormap will be generated in the Napari viewer showing the values of the features in the clicked
column. For example, if Intensity
features are calculated, the INTEGRATED_INTENSITY
column can be clicked and the colormap will appear.
Once the colormap is loaded, a slider will appear in the window with the minimum value being the minimum value of the feature colormap and the maximum value of the slider is the maximum value of the colormap. By adjusting the ranges in the slider, a new label image will appear in the viewer that contains the ROIs who's features values fall within the slider values.
The new labels resulting from the range slider selector can then be used to run Nyxus on by using the labels image as the Segmentation
parameter.
Limitations
While Nyxus Napari provides batched processing for large sets of images where each individual image will fit into RAM, it does not provide functionality to handle large single images that do not fit into RAM or that are larger than the limitations of Napari. For large images, it is recommended to install the Python or CLI version of Nyxus. For more information, see https://github.com/PolusAI/nyxus.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file napari_nyxus-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: napari_nyxus-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1df221e6b42a3231a6987ce82449dd38d14cd9be0e53cc66143401203d35b445 |
|
MD5 | 614a3c645d5a138bbcccf5258e71777c |
|
BLAKE2b-256 | 4b13912b5623400714c60e42c5b57aa28fa835d2eef49ea9a91304d0e57c2a6b |