CLI Reference#
The LIOM Toolkit ships seven liom-* command-line tools, registered as
console scripts in pyproject.toml under [project.scripts]. Each tool
is a thin wrapper over a library function: the script module defines
_build_argument_parser() (which builds the argparse tree without
importing heavy dependencies) and main() (which lazy-imports the heavy
deps and wires an optional --dask_scheduler argument to
dask_client_manager.set_client(...) before calling domain logic).
The reference below is auto-generated by sphinx-argparse from each script’s live
_build_argument_parser() function, so the documented options always
match the code — there is no hand-maintained argument table to drift.
Run any tool with --help for the authoritative options list:
liom-convert-hdf5-to-zarr --help
Conversion#
liom-convert-hdf5-to-zarr#
CLI: convert an HDF5 volume to an OME-Zarr store.
usage: liom-convert-hdf5-to-zarr [-h] [--dask_scheduler DASK_SCHEDULER]
[--n_workers N_WORKERS]
[--log-level {DEBUG,INFO,WARNING,ERROR}]
[--resume] [--scales SCALES SCALES SCALES]
[--chunks CHUNKS CHUNKS CHUNKS]
input_file output_file
Positional Arguments#
- input_file
Full path to the input HDF5 file
- output_file
Full path to the output Zarr file
Named Arguments#
- --dask_scheduler
Network address of the dask scheduler (default: local cluster)
- --n_workers
Number of Dask local-cluster workers (default: min(cpu_count()-1, 8))
- --log-level
Possible choices: DEBUG, INFO, WARNING, ERROR
Logging level (default: INFO)
Default:
'INFO'- --resume
Resume from checkpoint if available (default: False)
Default:
False- --scales
Scales (voxel size) for the Zarr dataset (default=(6.5, 6.5, 6.5))
Default:
(6.5, 6.5, 6.5)- --chunks
Chunk size for the Zarr dataset (default=(128, 128, 128))
Default:
(128, 128, 128)
Mask generation#
liom-create-mask#
CLI: create a brain mask for an OME-Zarr volume and write it to disk.
usage: liom-create-mask [-h] [--dask_scheduler DASK_SCHEDULER]
[--n_workers N_WORKERS]
[--log-level {DEBUG,INFO,WARNING,ERROR}] [--resume]
[--scales SCALES SCALES SCALES]
[--chunks CHUNKS CHUNKS CHUNKS] [--fill_holes]
input_file
Positional Arguments#
- input_file
Full path to the input zarr file
Named Arguments#
- --dask_scheduler
Network address of the dask scheduler (default: local cluster)
- --n_workers
Number of Dask local-cluster workers (default: min(cpu_count()-1, 8))
- --log-level
Possible choices: DEBUG, INFO, WARNING, ERROR
Logging level (default: INFO)
Default:
'INFO'- --resume
Resume from checkpoint if available (default: False)
Default:
False- --scales
Scales (voxel size) for the Zarr dataset (default=(6.5, 6.5, 6.5))
Default:
(6.5, 6.5, 6.5)- --chunks
Chunk size for the Zarr dataset (default=(128, 128, 128))
Default:
(128, 128, 128)- --fill_holes
Fill holes in the mask (default: False)
Default:
False
Segmentation#
liom-segment-2d#
Registration#
liom-align-annotations#
CLI: align annotations to a target volume.
usage: liom-align-annotations [-h] [--dask_scheduler DASK_SCHEDULER]
[--n_workers N_WORKERS]
[--log-level {DEBUG,INFO,WARNING,ERROR}]
[--resume] [--resolution RESOLUTION]
[--rigid_type RIGID_TYPE]
[--deformable_type DEFORMABLE_TYPE]
target_volume mask template atlas data_dir
Positional Arguments#
- target_volume
Path to the target volume image (NIfTI/NRRD)
- mask
Path to the mask image (NIfTI/NRRD)
- template
Path to the template image (NIfTI/NRRD)
- atlas
Path to the atlas/annotation image (NIfTI/NRRD)
- data_dir
Directory for intermediary files
Named Arguments#
- --dask_scheduler
Network address of the dask scheduler (default: local cluster)
- --n_workers
Number of Dask local-cluster workers (default: min(cpu_count()-1, 8))
- --log-level
Possible choices: DEBUG, INFO, WARNING, ERROR
Logging level (default: INFO)
Default:
'INFO'- --resume
Resume from checkpoint if available (default: False)
Default:
False- --resolution
Atlas resolution in micron, must be 10/25/50/100 (default=25)
Default:
25- --rigid_type
Rigid registration type (default=’Similarity’)
Default:
'Similarity'- --deformable_type
Deformable registration type (default=’SyN’)
Default:
'SyN'
liom-build-template#
CLI: build a groupwise registration template for a set of OME-Zarr brains.
usage: liom-build-template [-h] [--dask_scheduler DASK_SCHEDULER]
[--n_workers N_WORKERS]
[--log-level {DEBUG,INFO,WARNING,ERROR}] [--resume]
[--resolution_level RESOLUTION_LEVEL]
[--template_resolution TEMPLATE_RESOLUTION]
[--atlas_resolution ATLAS_RESOLUTION]
[--iterations ITERATIONS]
output_file zarr_files [zarr_files ...]
brain_names [brain_names ...]
Positional Arguments#
- output_file
Path where the output template is saved (NIfTI/NRRD)
- zarr_files
Paths to the input OME-Zarr brain files
- brain_names
Brain names for saving pre-registered images
Named Arguments#
- --dask_scheduler
Network address of the dask scheduler (default: local cluster)
- --n_workers
Number of Dask local-cluster workers (default: min(cpu_count()-1, 8))
- --log-level
Possible choices: DEBUG, INFO, WARNING, ERROR
Logging level (default: INFO)
Default:
'INFO'- --resume
Resume from checkpoint if available (default: False)
Default:
False- --resolution_level
OME-Zarr resolution level to load (default=3)
Default:
3- --template_resolution
Template resolution in micron (default=50)
Default:
50- --atlas_resolution
Allen atlas resolution in micron (default: template_resolution)
- --iterations
Number of groupwise registration iterations (default=15)
Default:
15
Statistics#
liom-compute-slice-metrics#
CLI: compute per-region vessel morphometric statistics for a brain slice.
usage: liom-compute-slice-metrics [-h] [--dask_scheduler DASK_SCHEDULER]
[--n_workers N_WORKERS]
[--log-level {DEBUG,INFO,WARNING,ERROR}]
[--resume] [--voxel_size VOXEL_SIZE]
output_dir image mask_file vessel_mask_file
region_map_file vessel_exclude_file
Positional Arguments#
- output_dir
Directory to save the output metrics to
- image
Label (filename/identifier) of the brain slice, used in the output DataFrame
- mask_file
Path to the tissue mask image (TIFF/PNG)
- vessel_mask_file
Path to the vessel mask image (TIFF/PNG)
- region_map_file
Path to the region map image (TIFF/PNG)
- vessel_exclude_file
Path to the vessel-exclude mask image (TIFF/PNG)
Named Arguments#
- --dask_scheduler
Network address of the dask scheduler (default: local cluster)
- --n_workers
Number of Dask local-cluster workers (default: min(cpu_count()-1, 8))
- --log-level
Possible choices: DEBUG, INFO, WARNING, ERROR
Logging level (default: INFO)
Default:
'INFO'- --resume
Resume from checkpoint if available (default: False)
Default:
False- --voxel_size
Voxel size in micron (default=0.65)
Default:
0.65
Deep learning#
liom-train-model#
CLI: train the vessel segmentation U-Net on an OME-Zarr dataset.
usage: liom-train-model [-h] [--dask_scheduler DASK_SCHEDULER]
[--n_workers N_WORKERS]
[--log-level {DEBUG,INFO,WARNING,ERROR}] [--resume]
[--output_train OUTPUT_TRAIN] [--epochs EPOCHS]
[--batch_size BATCH_SIZE]
[--learning_rate LEARNING_RATE]
[--wandb_entity WANDB_ENTITY]
[--wandb_project WANDB_PROJECT]
[--pretrained_artifact PRETRAINED_ARTIFACT]
[--wandb_mode WANDB_MODE]
dataset_file node_name
Positional Arguments#
- dataset_file
Path to the OME-Zarr dataset file
- node_name
Name of the node in the zarr file
Named Arguments#
- --dask_scheduler
Network address of the dask scheduler (default: local cluster)
- --n_workers
Number of Dask local-cluster workers (default: min(cpu_count()-1, 8))
- --log-level
Possible choices: DEBUG, INFO, WARNING, ERROR
Logging level (default: INFO)
Default:
'INFO'- --resume
Resume from checkpoint if available (default: False)
Default:
False- --output_train
Output directory for training artifacts (default=’training’)
Default:
'training'- --epochs
Number of training epochs (default=62)
Default:
62- --batch_size
Training batch size (default=35)
Default:
35- --learning_rate
Optimizer learning rate (default=0.003673)
Default:
0.003673- --wandb_entity
wandb entity/team (default: wandb user default)
- --wandb_project
wandb project name (default: wandb default project)
- --pretrained_artifact
wandb artifact path for pretrained weights (default: train from scratch)
- --wandb_mode
wandb mode: online/offline/disabled (default=’offline’)
Default:
'offline'
Note
The liom-train-model and liom-segment-2d (U-Net mode) tools
require the ai extra (pip install liom-toolkit[ai]). The
liom-build-template and liom-align-annotations tools require the
antspy extra (pip install liom-toolkit[antspy]). See
Getting Started for the full extras matrix.