Skip to content

copick add segmentation

core

Add a segmentation to the project.

Usage

copick add segmentation [OPTIONS] PATH

Description

Imports a single segmentation, or many at once via a glob pattern, into one or more runs. The file format is inferred from the extension unless --file-type is given. Segmentations are imported as multilabel volumes and may be tagged with a name, user ID, and session ID.

Arguments

Argument Description
PATH Path to the segmentation file (MRC, Zarr, TIFF, or EM) or a glob pattern.

Options

Option Type Default Description
-c, --config path Path to the configuration file.
--run-name-prefix text "" Prefix to prepend to run names after regex extraction.
--run-regex text (.*) Regular expression to extract the run name from the filename. If not provided, will use the file name without extension. The regex should capture the run name in the first group.
--run text "" The name of the run. If not specified, will use the name of the file (stripping extension), ignored if PATH is glob pattern.
--voxel-size float Voxel size in Angstrom. Overrides voxel size in the tomogram header.
--name text Name of the segmentation.
--session-id text 1 Session ID for the annotation.
--user-id text copick User ID for the annotation.
--file-type choice (mrc | zarr | tiff | em) File type ('mrc', 'zarr', 'tiff', or 'em'). Will guess type based on extension if omitted.
--max-workers integer 4 Maximum number of worker threads.
--flip text Flip (reverse) volume along specified axes. Comma-separated axis indices, e.g., '0' to flip Z, '0,2' to flip Z and X. Default: no flipping.
--transpose text Transpose volume axes. Specify target axis order, e.g., '2,1,0' to reverse all axes, '0,2,1' to swap Y and X. Default: no transposition.
--overwrite / --no-overwrite boolean flag False Overwrite the object if it exists.
--create / --no-create boolean flag True Create the object if it does not exist.
--debug / --no-debug boolean flag False Enable debug logging.

Examples

# Import a single segmentation into a named run
copick add segmentation seg.mrc -c config.json --run TS_001 --name membrane

# Import every matching file via a glob pattern
copick add segmentation "*.mrc" -c config.json --name membrane

# Extract the run name from the filename with a regex
copick add segmentation "TS*.mrc" -c config.json --name membrane \
    --run-regex "^(TS_\d+)"

See also