skimage 0.17.2

ParametersBackRef

This class is designed to replicate the use of NumPy arrays for mapping values with indexing:

>>> values = np.array([0.25, 0.5, 1.0])
>>> indices = np.array([[0, 0, 1], [2, 2, 1]])
>>> values[indices]
array([[0.25, 0.25, 0.5 ],
       [1.  , 1.  , 0.5 ]])

The issue with this indexing is that you need a very large values array if the values in the indices array are large.

>>> values = np.array([0.25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0])
>>> indices = np.array([[0, 0, 10], [0, 10, 10]])
>>> values[indices]
array([[0.25, 0.25, 1.  ],
       [0.25, 1.  , 1.  ]])

Using this class, the approach is similar, but there is no need to create a large values array:

>>> in_indices = np.array([0, 10])
>>> out_values = np.array([0.25, 1.0])
>>> values = ArrayMap(in_indices, out_values)
>>> values
ArrayMap(array([ 0, 10]), array([0.25, 1.  ]))
>>> print(values)
ArrayMap:
  0 → 0.25
  10 → 1.0
>>> indices = np.array([[0, 0, 10], [0, 10, 10]])
>>> values[indices]
array([[0.25, 0.25, 1.  ],
       [0.25, 1.  , 1.  ]])

Parameters

in_values : array of int, shape (N,)

The source values from which to map.

out_values : array, shape (N,)

The destination values from which to map.

Class designed to mimic mapping by NumPy array indexing.

Examples

See :

Back References

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

skimage.segmentation._join.relabel_sequential

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/util/_map_array.py#61
type: <class 'type'>
Commit: