Skip to content

copick process skeletonize

utils

Skeletonize segmentations in 3D using pattern matching.

Plugin command — copick-utils

This command is provided by the copick-utils plugin, not copick core. Install it to make this command available:

pip install copick-utils

See the plugin system guide for details.

copick process skeletonize input
Input
copick process skeletonize output
Output

Skeletonize segmentations in 3D using pattern matching.

Usage

copick process skeletonize [OPTIONS]

Description

Reduces each input segmentation to a 1-voxel-wide medial skeleton, exposing the centerlines of the objects it contains. Two backends are available: skimage (scikit-image 3D thinning) and distance_transform (local maxima of the Euclidean distance transform).

The input session ID is treated as a regex, so a single invocation can skeletonize many segmentations at once. This pairs naturally with the output of connected-component separation (e.g. pattern inst-.* to match inst-0, inst-1, etc.). Optional cleanup removes small objects before thinning and prunes short spur branches afterwards.

URI Format

Segmentations: name:user_id/session_id@voxel_spacing

Options

Option Type Default Description
-c, --config path Path to the configuration file.
--debug / --no-debug boolean flag False Enable debug logging.

Input Options

Option Type Default Description
--run-names, -r text · multiple Specific run names to process (default: all runs).
--input, -i COPICK_URI required Input segmentation URI (format: name:user_id/session_id@voxel_spacing). Supports glob patterns.

Tool Options

Option Type Default Description
--method choice (skimage | distance_transform) skimage Skeletonization method.
--remove-noise / --keep-noise boolean flag True Remove small objects before skeletonization.
--min-object-size integer 50 Minimum size of objects to keep during preprocessing.
--remove-short-branches / --keep-short-branches boolean flag True Remove short branches from skeleton.
--min-branch-length integer 5 Minimum length of branches to keep.
--workers, -w integer 8 Number of worker processes.

Output Options

Option Type Default Description
--output, -o COPICK_URI required Output segmentation URI. Supports smart defaults (e.g., "membrane", "membrane/my-session", or "/my-session"). Full format: object_name:user_id/session_id@voxel_spacing.

Examples

# Skeletonize a single segmentation (exact session match)
copick process skeletonize -i "membrane:user1/inst-0@10.0" -o "membrane:skel/skel-0@10.0"

# Skeletonize every instance matched by a session-ID pattern
copick process skeletonize -i "membrane:user1/inst-.*@10.0" \
    -o "membrane:skel/skel-{input_session_id}@10.0"

# Use the distance-transform backend and keep short branches
copick process skeletonize --method distance_transform --keep-short-branches \
    -i "membrane:user1/inst-.*@10.0" -o "membrane:skel/skel-{input_session_id}@10.0"

See also