trimesh.voxel.morphology module

Basic morphology operations that create new encodings.

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

Encoding wrapper around scipy.ndimage.morphology.binary_closing.

https://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.ndimage.morphology.binary_closing.html#scipy.ndimage.morphology.binary_closing

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

Encoding wrapper around scipy.ndimage.morphology.binary_dilation.

https://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.ndimage.morphology.binary_dilation.html#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.

Parameters:
  • 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.

Parameters:
  • encoding (Encoding or dense rank-3 array)

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

Return type:

new surface Encoding.