topostats.tracing.skeletonize#

Skeletonize molecules.

Module Contents#

Functions#

get_skeleton(→ numpy.typing.NDArray)

Skeletonizing masked molecules.

_get_skeletonize(→ collections.abc.Callable)

Creator component which determines which skeletonize method to use.

_skeletonize_zhang(→ numpy.typing.NDArray)

Skeletonize using Zhang method.

_skeletonize_lee(→ numpy.typing.NDArray)

Skeletonize using Lee method.

_skeletonize_thin(→ numpy.typing.NDArray)

Skeletonize using thinning method.

Attributes#

LOGGER

topostats.tracing.skeletonize.LOGGER#
topostats.tracing.skeletonize.get_skeleton(image: numpy.typing.NDArray, method: str) numpy.typing.NDArray#

Skeletonizing masked molecules.

Parameters:
  • image (npt.NDArray) – Image of molecule to be skeletonized.

  • method (str) – Method to use, default is ‘zhang’ other options are ‘lee’, and ‘thin’.

Returns:

Skeletonised version of the image.all($0).

Return type:

npt.NDArray

Notes

This is a thin wrapper to the methods provided by the skimage.morphology module. See also the `examples <https://scikit-image.org/docs/stable/auto_examples/edges/plot_skeleton.html>_

topostats.tracing.skeletonize._get_skeletonize(method: str = 'zhang') collections.abc.Callable#

Creator component which determines which skeletonize method to use.

Parameters:

method (str) – Method to use for skeletonizing, methods are ‘zhang’ (default), ‘lee’, and ‘thin’.

Returns:

Returns the function appropriate for the required skeletonizing method.

Return type:

Callable

topostats.tracing.skeletonize._skeletonize_zhang(image: numpy.typing.NDArray) numpy.typing.NDArray#

Skeletonize using Zhang method.

Parameters:

image (npt.NDArray) – Numpy array to be skeletonized.

Returns:

Skeletonized Numpy array.

Return type:

npt.NDArray

topostats.tracing.skeletonize._skeletonize_lee(image: numpy.typing.NDArray) numpy.typing.NDArray#

Skeletonize using Lee method.

Parameters:

image (npt.NDArray) – Numpy array to be skeletonized.

Returns:

Skeletonized Numpy array.

Return type:

npt.NDArray

topostats.tracing.skeletonize._skeletonize_thin(image: numpy.typing.NDArray) numpy.typing.NDArray#

Skeletonize using thinning method.

Parameters:

image (npt.NDArray) – Numpy array to be skeletonized.

Returns:

Skeletonized Numpy array.

Return type:

npt.NDArray