extract-image-region

Synopsis

extract-image-region <input> <output> [options]

Description

Crop/pad image by extracting a region of interest and optionally split the extracted region into separate image files, e.g., individual slices of a volume saved as individual image files. The output image region is chosen such that it contains the union of all specified axis-aligned rectangular input image regions. In case of extract-image-region -pad, the output region does not have to be fully contained within the input image. Values outside are then set to the specified padding value.

Arguments

input

Input image file path.

output

Output file path.

Command options

-Rx1 <int>

Leftmost input voxel index along x axis.

-Rx2 <int>

Rightmost input voxel index along x axis.

-Ry1 <int>

Leftmost input voxel index along y axis.

-Ry2 <int>

Rightmost input voxel index along y axis.

-Rz1 <int>

Leftmost input voxel index along z axis.

-Rz2 <int>

Rightmost input voxel index along z axis.

-Rt1 <int>

Leftmost input voxel index along t axis.

-Rt2 <int>

Rightmost input voxel index along t axis.

-patch <i> <j> <k> <nx> [<ny> [<nz>]]

Extract image patch of given size centered at the specified voxel.

-closest-patch <x> <y> <z> <nx> [<ny> [<nz>]]

Extract image patch of given size centered at nearest voxel to specified point [mm].

-landmarks <file>...

Extract minimum bounding box containing the landmark points.

-ref <file>

Extract region specified by discrete reference image domain.

-margin <int>

Add fixed-width margin to union of image regions. (default: 0)

-scale <float>

Scale resulting region by specified factor. (default: 1)

-crop [value]

Crop background with intensity below or equal specified value. (default: 0)

-pad [value]

Pad output image by the specified value. (default: 0)

-split <dim>|x|y|z|t

Split extracted region along specified dimension into separate images. For example, use ‘-split z’ to save individual slices of a 3D volume. The <output> file path is appended with a format string ‘_%03d’ before the file name extension to create unique output file paths, unless such format specification is part of the given file path already.

-swap [on|off]

When -split is used, first swap the dimension along which the extracted region is split with the last dimension such that when splitting a volume along the first dimension, the output image files have z=1. (default: off)

-noswap

Set -swap to off.

Standard options

-v, -verbose [n]

Increase/Set verbosity of output messages. (default: 0)

-debug [level]

Increase/Set debug level for output of intermediate results. (default: 0)

-version [major.minor]

Print version and exit or set version to emulate.

-revision

Print revision (or version) number only and exit.

-h, -help

Print help and exit.