This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / ndimage / _morphology / iterate_structure

function

scipy.ndimage._morphology:iterate_structure

source: build-install/usr/lib/python3.14/site-packages/scipy/ndimage/_morphology.py:55

Signature

def iterate_structure(structure, iterations, origin = None)

Summary

Iterate a structure by dilating it with itself.

Parameters

structure : array_like

Structuring element (an array of bools, for example), to be dilated with itself.

iterations : int

number of dilations performed on the structure with itself

origin : optional

If origin is None, only the iterated structure is returned. If not, a tuple of the iterated structure and the modified origin is returned.

Returns

iterate_structure : ndarray of bools

A new structuring element obtained by dilating structure (iterations - 1) times with itself.

Examples

from scipy import ndimage
struct = ndimage.generate_binary_structure(2, 1)
struct.astype(int)
ndimage.iterate_structure(struct, 2).astype(int)
ndimage.iterate_structure(struct, 3).astype(int)
✓
array([[0, 0, 0, 1, 0, 0, 0],
       [0, 0, 1, 1, 1, 0, 0],
       [0, 1, 1, 1, 1, 1, 0],
       [1, 1, 1, 1, 1, 1, 1],
       [0, 1, 1, 1, 1, 1, 0],
       [0, 0, 1, 1, 1, 0, 0],
       [0, 0, 0, 1, 0, 0, 0]])

See also

generate_binary_structure

Aliases

  • scipy.ndimage.iterate_structure