diff --git a/README.md b/README.md index d1f0d90d..fbfe5374 100644 --- a/README.md +++ b/README.md @@ -76,27 +76,23 @@ or a pair of 3D arrays containing 2D intensity and mask images. There is also tw ```python from nyxus import Nyxus import numpy as np + nyx = Nyxus(["*ALL*"]) -intens = [ + +intens = np.array([ [[1, 4, 4, 1, 1], [1, 4, 6, 1, 1], [4, 1, 6, 4, 1], [4, 4, 6, 4, 1]], - [[1, 4, 4, 1, 1], - [1, 1, 6, 1, 1], - [1, 1, 3, 1, 1], - [4, 4, 6, 1, 1]] -] -seg = [ - [[1, 1, 1, 1, 1], - [1, 1, 1, 1, 1], - [1, 1, 1, 1, 1], - [1, 1, 1, 1, 1]], +]) + +seg = np.array([ [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], [0, 1, 1, 1, 1], [1, 1, 1, 1, 1]] -] +]) + features = nyx.featurize(intens, seg) ``` diff --git a/src/nyx/python/nyxus/nyxus.py b/src/nyx/python/nyxus/nyxus.py index 913a4487..8f6d1832 100644 --- a/src/nyx/python/nyxus/nyxus.py +++ b/src/nyx/python/nyxus/nyxus.py @@ -203,8 +203,8 @@ def featurize_directory( def featurize( self, - intensity_images: np.array, - label_images: np.array, + intensity_images: np.ndarray, + label_images: np.ndarray, intensity_names: list = [], label_names: list = [] ): @@ -218,9 +218,9 @@ def featurize( Parameters ---------- - intensity_dir : np.array + intensity_images : np.ndarray 2D image or 3D collection of intensity images. - label_images : np.array + label_images : np.ndarray 2D image or 3D collection of label images. intensity_names (optional): list names for the images in for the DataFrame output. @@ -234,6 +234,13 @@ def featurize( per image. """ + # verify argument types + if not isinstance(intensity_images, np.ndarray): + raise ValueError("intensity_images parameter must be numpy.ndarray") + + if not isinstance(label_images, np.ndarray): + raise ValueError("label_images parameter must be numpy.ndarray") + # verify dimensions of images are the same if(intensity_images.ndim == 2): if(label_images.ndim != 2):