Skip to content
PolusAIPublic

About

A fully scalable robust image feature extraction library.

Resources

Contributing

Stars

30 stars

Watchers

5 watching

Forks

Latest commit

 

History

2,127 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nyxus

Documentation Status PyPI PyPI Downloads Conda Conda Downloads

Nyxus computes intensity, texture, morphology and image quality features for every region of interest (ROI) in 2D images and 3D volumes: 758 features in all, 539 for 2D images, 213 for 3D volumes and 6 image quality features. It runs from Python or the command line, reads TIFF, OME-TIFF, OME-Zarr, NIfTI and DICOM files (OME-TIFF and OME-Zarr with up to five dimensions), and assembles ROIs that span several image tiles. Each feature's validation against reference tools such as PyRadiomics, MIRP, MATLAB and CellProfiler is listed in the documentation.

ROIs larger than the memory budget are processed out of core when they come from files; which features then keep their in-memory values is listed under large images.

The Nyxus pipeline

Documentation: https://nyxus.readthedocs.io

Installation

pip install nyxus

or

conda install nyxus -c conda-forge

The conda-forge package has no build for Apple Silicon Macs or Linux aarch64; use pip there. On Windows, the PyPI wheels do not read OME-Zarr or compressed NIfTI (.nii.gz), and the conda-forge packages of 0.11.0 need Visual Studio installed (they were built in Debug mode). GPU wheels, the Docker image and building from source are described in Installation.

Quick start

2D, from arrays in memory

import numpy as np
from nyxus import Nyxus

intensity = np.array([[1, 4, 4, 1],
                      [1, 4, 6, 1],
                      [4, 1, 6, 4],
                      [4, 4, 6, 4]], dtype=np.uint16)
labels = np.array([[1, 1, 0, 2],
                   [1, 1, 0, 2],
                   [1, 1, 0, 2],
                   [1, 1, 0, 2]], dtype=np.uint32)

nyx = Nyxus(["*ALL_INTENSITY*"])
features = nyx.featurize(intensity, labels)
print(features[["ROI_label", "MEAN", "MAX"]])

A directory of image files and their label images is featurized with nyx.featurize_directory("intensities/", "labels/").

3D, from volume files

This example writes its volume with tifffile (pip install tifffile).

import numpy as np
import tifffile
from nyxus import Nyxus3D

volume = np.random.default_rng(0).integers(1, 100, size=(8, 32, 32), dtype=np.uint16)
labels = np.zeros_like(volume)
labels[2:6, 8:24, 8:24] = 1
tifffile.imwrite("volume.ome.tif", volume, ome=True, metadata={"axes": "ZYX"})
tifffile.imwrite("labels.ome.tif", labels, ome=True, metadata={"axes": "ZYX"})

nyx = Nyxus3D(["*3D_ALL_INTENSITY*"])
features = nyx.featurize_files(["./volume.ome.tif"], ["./labels.ome.tif"], False)
print(features[["ROI_label", "3MEAN", "3MAX"]])

Command line

The Python packages do not include the command-line program; run it from the Docker image or build it from source (see Installation). The output directory must already exist.

nyxus --features="*ALL_INTENSITY*,*ALL_MORPHOLOGY*" --intDir=/data/int --segDir=/data/seg --outDir=/data/out --outputType=singlecsv

Where to go next

Citing Nyxus

If you use Nyxus in your work, please cite it as described in CITATION.cff; GitHub's Cite this repository button gives APA and BibTeX.

License

Nyxus is released under the MIT License.

About

A fully scalable robust image feature extraction library.

Resources

Contributing

Stars

30 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages