List of Samplers

Table of contents

CenterROISampler

Sampler which samples one ROI from the input image and label map with a target size. The ROI is centered on the image center. The arrays will be padded if the target size is larger than the input image.

DefaultROISampler

Sampler which simply returns the image and the label map, after padding of a specified dimension divisor: each spatial dimension of the output arrays will be divisible by dimension_divisor.

LabelROISampler

Sampler which samples ROIs from the input image and label map, such that one particular label appears. For each ROI, one of the labels_values will be selected and the sampler will make sure that the ROI includes this label. If the sample_boundaries_only flag is set to true, regions will at least have two different label values. If the constraints are not feasible, the sampler will either extract a random ROI with the target size or return an empty image, based on the flag fallback_to_random. (The actual purpose of returning an empty image is to actually chain this sampler with a FilterDataLoader, so that images without a valid label are just completely skipped).

OrientedROISampler

The OrientedROISampler draws num_samples randomly ROIs of size roi_size with spacing roi_spacing per dataset. The sampler takes n_guided = floor(sample_from_labels_proportion * num_samples) label guided samples, and uniformly random samples for the rest of the samples. Labelmaps and Keypoints are supported for label guided sampling; for labelmap sampling, the labelmap is interpreted as a probabilistic output and sampled accordingly (thus negative values break the sampling, and labelmaps need to be one-hot encoded in case of multiple label values). Random augmentations can applied, including rotation, flipping, shearing, scaling and jitter. These augmentations are directly changing the matrix of the sample, thus the samples are not guaranteed to be affine or even in a right-handed coordinate system. The samples retain their matrices, so they can be viewed in their original position. May throw an ImageSamplerError

RandomROISampler

Sampler which randomly samples ROIs from the input image and label map with a target The images will be padded if the target size is larger than the input image.

SplitROISampler

Sampler which splits the input image into overlapping ROIs for sliding window inference. This sampler mimics the situation at test-time, when one image needs to be processed in regularly spaced patches.

The step size is used to compute valid ROI positions that cover the full input image. The sampling behavior is controlled by the patch_step_size parameter, which is used to compute the ROIs offsets in the input image as a fraction of the specified ROI size.