apply_padded¶
- apply_padded(im: ndarray[Any, dtype[_ScalarType_co]], pad_width, func, pad_val: int = 1, **kwargs)[source]¶
Applies padding to an image before sending to func, then extracts the result corresponding to the original image shape.
- Parameters:
im (ndarray) – The image to which func should be applied
pad_width (int or list of ints) – The amount of padding to apply to each axis. Refer to numpy.pad documentation for more details.
pad_val (scalar) – The value to place into the padded voxels. The default is 1 (or True) which extends the pore space.
func (function handle) – The function to apply to the padded image.
kwargs – Additional keyword arguments are collected and passed to func.
Notes
A use case for this is when using skimage.morphology.skeletonize to ensure that the skeleton extends beyond the edges of the image.
Examples
Click here to view online example.