make_structure¶
- make_structure(ndim: int, ignore: tuple[int, ...] | int = None)[source][source]¶
- Make a binary structure with connectivity over every dimension not in
ignore
- Parameters:
- Returns:
structure – binary structure
- Return type:
array
Examples
>>> make_structure(1).astype(int) array([1, 1, 1]) >>> make_structure(2).astype(int) array([[0, 1, 0], [1, 1, 1], [0, 1, 0]]) >>> make_structure(2, 1).astype(int) array([[0, 1, 0], [0, 1, 0], [0, 1, 0]]) >>> make_structure(3, (0, 2)).astype(int) array([[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, 1, 0], [0, 1, 0], [0, 1, 0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]])