Basic morphology operations that create new encodings.

trimesh.voxel.morphology.binary_closing(encoding, **kwargs)

Encoding wrapper around scipy.ndimage.morphology.binary_closing.

trimesh.voxel.morphology.binary_dilation(encoding, **kwargs)

Encoding wrapper around scipy.ndimage.morphology.binary_dilation.

trimesh.voxel.morphology.fill(encoding, method='base', **kwargs)

Fill the given encoding using the specified implementation.

See fillers for available implementations or to add your own, e.g. via fillers[‘custom_key’] = custom_fn.

custom_fn should have signature (encoding, **kwargs) -> filled_encoding and should not modify encoding.

  • encoding (Encoding object (left unchanged).)

  • method (method present in fillers.)

  • **kwargs (additional kwargs passed to the specified implementation.)

Return type:

A new filled Encoding object.

trimesh.voxel.morphology.surface(encoding, structure=None)

Get elements on the surface of encoding.

A surface element is any one in encoding that is adjacent to an empty voxel.

  • encoding (Encoding or dense rank-3 array)

  • structure (adjacency structure. If None, square connectivity is used.)

Return type:

new surface Encoding.