Skeletonization#

napari_toska.generate_labeled_skeletonization(label_image: napari.types.LabelsData) napari.types.LabelsData[source]#

Skeletonize a label image and relabels the skeleton to match input labels.

The used skeletonization algorithm is the scikit-image implementation of Lee, 94.

Parameters:#

label_image: napari.types.LabelsData

Input napari version of numpy.ndarray containing integer labels of an instance segmentation.

Returns:#

labeled_skeletons: napari.types.LabelsData

A skeleton image multiplied by the respective label of the object of origin in the input label image.

napari_toska.parse_single_skeleton(skel: napari.types.LabelsData, label: int, neighborhood: str = 'n4') napari.types.LabelsData[source]#

Label the skeleton of a 2D or 3D object with 4-, 6-, 8-, 18-, or 26-connectivity.

Parameters:
  • skel (napari.types.LabelsData) – A skeletonized image

  • label (int) – The label of the object whose skeleton is to be labeled.

  • neighborhood (str) – The neighborhood connectivity of the skeleton. Can be “n4”, “n6”, “n8”, “n18”, or “n26”.

Returns:

skeleton_labels – A labeled image with the same shape as skel where each pixel is labeled as either an end point (1), a branch point (2), or a skeleton pixel (3).

Return type:

napari.types.LabelsData

napari_toska.parse_all_skeletons(skeleton_image: napari.types.LabelsData, neighborhood: str = 'n4') napari.types.LabelsData[source]#
napari_toska.label_branches(parsed_skeletons: napari.types.LabelsData, labelled_skeletons: napari.types.LabelsData, neighborhood: str) napari.types.LabelsData[source]#

Label the branches of a skeleton image.

The branch labels start with 1 and increase for each branch.

Parameters:
  • parsed_skeletons (napari.types.LabelsData) – A skeleton image where each pixel is labelled according to the point type which can be either a terminal point (1), a branching point (3), or a chain point (2).

  • labelled_skeletons (napari.types.LabelsData) – A skeleton image with each skeleton carrying a unique label.

Returns:

branch_label_image – A skeleton image where each branch is labelled with a skeleton-wise unique label. The branch labels of each skeleton start with 1 and increase for each branch up to the number of branches in the skeleton.

Return type:

napari.types.LabelsData

napari_toska.generate_labeled_outline(labels: napari.types.LabelsData)[source]#

Generate a labeled outline of a label image.

Parameters:

labels (napari.types.LabelsData) – A label image.

Returns:

outline – A labeled outline of the label image.

Return type:

napari.types.LabelsData

napari_toska.generate_local_thickness_skeleton(outline: napari.types.LabelsData, labeled_skeleton: napari.types.LabelsData) napari.types.ImageData[source]#

Generate a local thickness image of a skeleton.

Parameters:
  • outline (napari.types.LabelsData) – A labeled outline of a label image.

  • labeled_skeleton (napari.types.LabelsData) – A labeled skeleton image.

Returns:

thickness_image – A local thickness image of the skeleton.

Return type:

napari.types.ImageData

napari_toska.reconstruct_from_local_thickness(thickness_image: napari.types.ImageData) napari.types.LabelsData[source]#

Reconstruct a label image from a local thickness image.

Parameters:

thickness_image (napari.types.ImageData) – A local thickness image of a skeleton.

Returns:

reconstruction – A label image reconstructed from the local thickness image.

Return type:

napari.types.LabelsData