Module: Extract Patches ()

Description:

This is an experimental module from the Xtra Library: https://xtras.amira-avizo.com.

This module allows extracting 2D or 3D image patches of fixed size at chosen locations, mostly for training deep learning models. The primary purpose is to focus manual segmentation on a handcrafted subset of the available data, rather than on the full volume or a given subvolume.

Only patches that are fully inside the bounding box of the input image will be generated.

If a disk export is requested, the patches are exported as a set of 2D TIF files in the output folder. The filename is defined by the requested base filename, the patch number (which is the index of its corresponding landmarks), and for 3D patches the slice number between 0 and the number of slices in a 3D patch. Please note when loading TIF files back in the software, label images will not be re-interpreted automatically as such. This is not hindering Deep Learning Training, but you may want to use Convert Image Type to a label type if necessary for display or further manual edition.

Connections:

Data [required]
Input image.

Input Landmarks [required]
Landmarks defining the center of the patches.

Console

Opens the Python Script Object console of the module as the active console window.

Mode

Choose between 2D and 3D patches.

Size of Patches [px]

Size of the image patches to be extracted, in number of voxels.

Show Patches

Displays bounding boxes around the image patches that would be extracted. The patches that extend outside the bounding box of the image will appear in yellow, whereas others are shown in white.

Note: This option may be slow when the number of landmarks is large.

Export Type

Selects whether the module will generate an output dataset in the application, or export the patches as TIF files on the disk.

Output Directory

Directory in which the image patches will be saved. It is recommended to indicate an empty directory.

Base Filename

The filename name will be composed of this basename, an underscore character "_", and the index of the corresponding landmark. For 3D patches, the slice index will also be indicated. Zeros are appended in front of the index to ensure proper alphanumeric sorting (e.g. patch_00012.tif).