skimage 0.17.2

NotesParametersReturnsBackRef
regionprops_table(label_image, intensity_image=None, properties=('label', 'bbox'), *, cache=True, separator='-')

The table is a dictionary mapping column names to value arrays. See Notes section below for details.

Notes

Each column contains either a scalar property, an object property, or an element in a multidimensional array.

Properties with scalar values for each region, such as "eccentricity", will appear as a float or int array with that property name as key.

Multidimensional properties of fixed size for a given image dimension, such as "centroid" (every centroid will have three elements in a 3D image, no matter the region size), will be split into that many columns, with the name {property_name}{separator}{element_num} (for 1D properties), {property_name}{separator}{elem_num0}{separator}{elem_num1} (for 2D properties), and so on.

For multidimensional properties that don't have a fixed size, such as "image" (the image of a region varies in size depending on the region size), an object array will be used, with the corresponding property name as the key.

Parameters

label_image : (N, M) ndarray

Labeled input image. Labels with value 0 are ignored.

intensity_image : (N, M) ndarray, optional

Intensity (i.e., input) image with same size as labeled image. Default is None.

properties : tuple or list of str, optional

Properties that will be included in the resulting dictionary For a list of available properties, please see regionprops . Users should remember to add "label" to keep track of region identities.

cache : bool, optional

Determine whether to cache calculated properties. The computation is much faster for cached properties, whereas the memory consumption increases.

separator : str, optional

For non-scalar properties not listed in OBJECT_COLUMNS, each element will appear in its own column, with the index of that element separated from the property name by this separator. For example, the inertia tensor of a 2D region will appear in four columns: inertia_tensor-0-0 , inertia_tensor-0-1 , inertia_tensor-1-0 , and inertia_tensor-1-1 (where the separator is - ).

Object columns are those that cannot be split in this way because the number of columns would change depending on the object. For example, image and coords .

Returns

out_dict : dict

Dictionary mapping property names to an array of values of that property, one value per region. This dictionary can be used as input to pandas DataFrame to map property names to columns in the frame and regions to rows. If the image has no regions, the arrays will have length 0, but the correct type.

Compute image properties and return them as a pandas-compatible table.

Examples

This example is valid syntax, but we were not able to check execution
>>> from skimage import data, util, measure
... image = data.coins()
... label_image = measure.label(image > 110, connectivity=image.ndim)
... props = regionprops_table(label_image, image,
...  properties=['label', 'inertia_tensor',
...  'inertia_tensor_eigvals'])
... props # doctest: +ELLIPSIS +SKIP {'label': array([ 1, 2, ...]), ... 'inertia_tensor-0-0': array([ 4.012...e+03, 8.51..., ...]), ... ..., 'inertia_tensor_eigvals-1': array([ 2.67...e+02, 2.83..., ...])}

The resulting dictionary can be directly passed to pandas, if installed, to obtain a clean DataFrame:

This example is valid syntax, but we were not able to check execution
>>> import pandas as pd  # doctest: +SKIP
... data = pd.DataFrame(props) # doctest: +SKIP
... data.head() # doctest: +SKIP label inertia_tensor-0-0 ... inertia_tensor_eigvals-1 0 1 4012.909888 ... 267.065503 1 2 8.514739 ... 2.834806 2 3 0.666667 ... 0.000000 3 4 0.000000 ... 0.000000 4 5 0.222222 ... 0.111111

[5 rows x 7 columns]

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.measure._regionprops.regionprops_table

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /skimage/measure/_regionprops.py#528
type: <class 'function'>
Commit: