trim_floating_solid

trim_floating_solid(im: ndarray[Any, dtype[_ScalarType_co]], conn: Literal['max', 'min'] = 'min', surface: bool = False)[source]

Removes all solid that that is not attached to main solid structure.

Parameters:
  • im (ndarray) – The image of the porous material

  • conn (str) – Can be either ‘min’ or ‘max’ and controls the shape of the structuring element used to determine voxel connectivity. The default if ‘min’ which imposes the strictest criteria, so that voxels must share a face to be considered connected.

  • fill_surface (bool) – If True, any isolated solid regions that are connected to the surfaces of the image but not the main body of the solid are also removed. Voxels are deemed to be surface voxels if they are part of a cluster that does not span the domain. In other words, a cluster of voxels touching the x=0 face but not the x=-1 face will be trimmed if this is enabled.

Returns:

image – A version of im but with all the disconnected solid removed.

Return type:

ndarray

Examples

Click here to view online example.