This document describes the three main CLI tools used in the registration workflow:
- assembled_reg.py — full sample-to-reference registration
- downsample_ref.py — preprocessing of reference images
- separate_ref.py — splitting reference label masks
Before running any command:
-
Navigate to the regtry folder.
-
Make sure the virtual environment is activated (you should see
(venv)in your terminal prompt). if not, activate it with:../nnUNet/venv/Scripts/Activate.ps1
Runs the complete registration workflow, including preprocessing, ANTs/CMTK registration, and label assignment.
python assembled_reg.py <sample_LIF> <reference_folder> <output_folder> <label_csv> [--cmtk] [--output-metric]
-
sample_LIF Path to the .lif file containing the sample stack.
-
reference_folder Folder containing the processed reference dataset (e.g.,
reference2010orreference2018). -
output_folder Output location where all registration results will be written.
-
label_csv CSV file storing label definitions; generated automatically if it does not exist.
-
--cmtk (optional) Use CMTK instead of ANTs for optic lobe registration.
-
--output-metric (optional) Export similarity/metric scores to a CSV.
python assembled_reg.py E:/Gabriela/lifFiles/sample.lif ./reference2010 ./reference ../outputs ./reference/labels.csv --cmtk --output-metric
Prepares the reference images by downsampling them to the required voxel size and spacing.
python downsample_ref.py <ref_folder> [--format <ext>] [--spacing <x,y,z>]
-
ref_folder Directory containing the reference image files.
-
--format, -f (optional) File format of the images (default:
tif). Must be eithernrrdortif. -
--spacing, -s (optional but required for
tif) Comma-separated spacing values (e.g.,0.62,0.62,0.62). Required when--formatistif, since TIFF images do not contain spacing metadata. Ignored when format isnrrd.
NRRD input (spacing taken from file):
python downsample_ref.py "./reference" --format nrrd
TIFF input (spacing must be provided):
python downsample_ref.py "./reference" --format tif --spacing "0.62,0.62,0.62"
Splits a whole-brain reference label mask into left optic lobe (OLL) and right optic lobe (OLR) labels using user-provided ID lists. Optionally applies the same split to an intensity image.
python separate_ref.py <label_path> <OLL_label_ids> <OLR_label_ids> [--intensityImg_path <path>]
-
label_path Path to the whole reference label image (e.g.,
label_whole_01.nrrd). -
OLL_label_ids Comma-separated list of label IDs belonging to the left optic lobe.
-
OLR_label_ids Comma-separated list of label IDs belonging to the right optic lobe.
-
--intensityImg_path (optional) Path to the intensity image to be split in the same way.
python separate_ref.py `
"./reference/label_whole_01.nrrd" `
"2,3,17,19" `
"28,29,41,43" `
--intensityImg_path "./reference/ref_whole_01.nrrd"