Skip to content

Images

These commands work on volumes as arrays of voxels: they report what a file contains, change its format, cut it into smaller pieces or add to it, filter it, and compare it with another image. None of them deals with registration or with resampling onto another grid; for that, see Orientation & resampling and the registration commands.

The commands fall into four families. info and convert look at and rewrite files. crop, pad, chunk, unstack and extract_patches change the field of view or split a volume into pieces, and update the orientation matrix of every result so that it stays aligned with the input in world space. pool, smooth and inpaint compute new voxel values from the old ones. metrics scores a prediction against a reference and writes the result to a JSON file.

Unless a page says otherwise, a command that writes a modified copy of a volume puts it next to the input, under a name built from a template that you can change with -o; see Output filenames. The exception is convert, whose default output name is that of the input, so that it replaces the file.

Commands

Command Summary
info Print the shape, orientation and header metadata of volumes, and optionally their intensity statistics.
convert Convert volumes between file formats and data types, and override header fields.
crop Crop a volume to a box of a given size and position, to a reference image or to a bounding box.
pad Add voxels around a volume, filled according to a boundary condition.
chunk Split a volume into consecutive chunks of a given thickness along one dimension.
unstack Split a volume into one file per slice or volume along one dimension.
extract_patches Cut a volume into a regular grid of patches and save each patch as its own file.
pool Downsample a volume by reducing each window of voxels to one value (mean, sum, minimum, maximum, ...).
smooth Blur a volume with a Gaussian, box or triangular filter.
inpaint Fill in missing voxels of a volume from the values that surround them.
metrics Compare a predicted image with a reference and write overlap and similarity scores to a JSON file.