copick convert nnunet
torch
Convert a copick project to nnUNet raw dataset format.
Plugin command — copick-torch
This command is provided by the copick-torch plugin, not copick core. Install it to make this command available:
See the plugin system guide for details.
Usage
Description
Reads tomograms and segmentation masks from a copick project and writes them
as .nii.gz files in the nnUNet raw dataset layout (a Dataset{id}_{name}
folder containing imagesTr, labelsTr, and optionally imagesTs). A
dataset.json describing the channel and label map is generated from the
targets config stored in the copick overlay.
Training runs default to every run not listed in the test set. The tomogram voxel spacing is read from the tomogram URI and converted from Angstroms to nanometres so that nnUNet's patch-size planner sees reasonable numbers.
Options
| Option | Type | Default | Description |
|---|---|---|---|
-c, --config |
path | required | Path to copick config.json |
-uri, --tomo-uri |
text | wbp@10.0 |
Tomogram URI to use for training |
-sinfo, --seg-info |
text | targets |
Segmentation info as 'name' or 'name,user_id,session_id' |
-train, --train-run-ids |
text | — | Training run IDs, e.g. run1,run2,run3. Default: all runs not in test set. |
-test, --test-run-ids |
text | — | Test run IDs, e.g. run4,run5 |
-id, --dataset-id |
integer | 1 |
nnUNet dataset ID (integer; becomes Dataset{id}_{name}) |
-n, --dataset-name |
text | required | nnUNet dataset name |
-o, --output |
path | required | Path to nnunet_raw output directory |
-j, --num-workers |
integer | 4 |
Number of parallel worker threads for converting tomograms. |
Examples
# Convert all runs in a project to an nnUNet dataset
copick convert nnunet -c config.json --dataset-name Membrane \
--output /data/nnunet_raw
# Convert with an explicit tomogram URI, segmentation info, and dataset id
copick convert nnunet -c config.json --tomo-uri wbp@10.0 \
--seg-info targets,nnunet,1 --dataset-id 5 --dataset-name Membrane \
--output /data/nnunet_raw
# Convert with an explicit train/test split and more worker threads
copick convert nnunet -c config.json --dataset-name Membrane \
--train-run-ids run1,run2,run3 --test-run-ids run4,run5 \
--output /data/nnunet_raw -j 8
See also
copick training nnunet— train an nnUNet model on the converted datasetcopick inference nnunet— run inference with a trained nnUNet model