- get_border(shape, thickness=1, mode='edges')#
Create an array with corners, edges or faces labelled as
This can be used as mask to manipulate values laying on the perimeter of an image.
shape (array_like) – The shape of the array to return. Can be either 2D or 3D.
thickness (scalar (default is 1)) – The number of pixels/voxels to place along perimeter.
mode (string) – The type of border to create. Options are ‘faces’, ‘edges’ (default) and ‘corners’. In 2D ‘faces’ and ‘edges’ give the same result.
image – An ndarray of specified shape with
Truevalues at the perimeter and
- Return type:
The indices of the
Truevalues can be found using
>>> import porespy as ps >>> import numpy as np >>> mask = ps.tools.get_border(shape=[3, 3], mode='corners') >>> print(mask) [[ True False True] [False False False] [ True False True]] >>> mask = ps.tools.get_border(shape=[3, 3], mode='faces') >>> print(mask) [[ True True True] [ True False True] [ True True True]]
Click here to view online example.