porespy.generators.insert_shape#
- porespy.generators.insert_shape(im, element, center=None, corner=None, value=1, mode='overwrite')#
Inserts sub-image into a larger image at the specified location.
If the inserted image extends beyond the boundaries of the image it will be cropped accordingly.
- Parameters:
im (ndarray) – The image into which the sub-image will be inserted
element (ndarray) – The sub-image to insert
center (tuple) – Coordinates indicating the position in the main image where the inserted imaged will be centered. If
centeris given thencornercannot be specified. Note thatcentercan only be used if all dimensions ofelementare odd, otherwise the meaning of center is not defined.corner (tuple) – Coordinates indicating the position in the main image where the lower corner (i.e. [0, 0, 0]) of the inserted image should be anchored. If
centeris given thencornercannot be specified.value (scalar) – A scalar value to apply to the sub-image. The default is 1.
mode (string) – If ‘overwrite’ (default) the inserted image replaces the values in the main image. If ‘overlay’ the inserted image is added to the main image. In both cases the inserted image is multiplied by
valuefirst.
- Returns:
im – A copy of
imwith the supplied element inserted.- Return type:
ndarray
Examples
Click here to view online example.