copick add segmentation
core
Add a segmentation to the project.
Usage
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 unless
--segmentation-type says otherwise, and may be tagged with a name, user ID, and
session ID. Binary and instance segmentations need NAME to be a pickable object.
Integer labels keep their values: the stored dtype is chosen to hold them. A panoptic
segmentation is read from a two-channel TIFF or Zarr; --transpose and --flip then
apply to its spatial axes.
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. |
--segmentation-type |
choice (multilabel | binary | instance | panoptic) | multilabel |
'multilabel': voxel = an object's label; 'binary': voxel = 1 inside the object NAME; 'instance': voxel = the instance ID within the object NAME, 0 for background; 'panoptic': a two-channel (2, Z, Y, X) TIFF or Zarr, channel 0 object labels and channel 1 instance IDs within each object. |
--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+)"
# Import a volume whose voxels hold microtubule instance IDs
copick add segmentation filaments.tif -c config.json --run TS_001 --voxel-size 10.0 \
--name microtubule --segmentation-type instance
See also
copick add tomogram— import a tomogram volume into a runcopick add object— register a pickable object in the project configuration