Skip to content

copick convert seg2mesh

utils

Convert segmentation volumes to meshes using marching cubes.

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 convert seg2mesh input
Input
copick convert seg2mesh output
Output

Convert segmentation volumes to meshes using marching cubes.

Usage

copick convert seg2mesh [OPTIONS]

Description

Runs the marching cubes algorithm on one or more segmentation volumes to produce triangulated surface meshes. Input segmentations are selected by URI (with optional regex/pattern matching on the user and session ids), and the resulting meshes are written using a templated output URI.

Use --individual-meshes to emit a separate mesh per instance label (this enables the {instance_id} placeholder in the output URI); otherwise a single mesh is produced per matched segmentation. The --level and --step-size options control the marching cubes iso-level and the sampling step (larger steps are faster but coarser).

URI Format

Segmentations: name:user_id/session_id@voxel_spacing
Meshes: object_name:user_id/session_id

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
--level float 0.5 Isosurface level for marching cubes.
--step-size integer 1 Step size for marching cubes (higher = coarser mesh).
--workers, -w integer 8 Number of worker processes.

Output Options

Option Type Default Description
--output, -o COPICK_URI required Output mesh URI. Supports smart defaults (e.g., "membrane", "membrane/my-session", or "/my-session"). Full format: object_name:user_id/session_id.
--individual-meshes, -im / --no-individual-meshes boolean flag False Create individual meshes for each instance (enables {instance_id} placeholder).

Examples

# Convert single segmentation to mesh
copick convert seg2mesh -i "membrane:user1/manual-001@10.0" -o "membrane:seg2mesh/from-seg-001"

# Convert all manual segmentations using pattern matching
copick convert seg2mesh -i "membrane:user1/manual-.*@10.0" -o "membrane:seg2mesh/from-seg-{input_session_id}"

# Emit a separate mesh per instance label
copick convert seg2mesh --individual-meshes \
    -i "membrane:user1/manual-001@10.0" -o "membrane:seg2mesh/inst-{instance_id}"

See also