List of Samplers
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. |
|
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 |
|
Sampler which samples ROIs from the input image and label map, such that one particular label appears. For each ROI, one of the |
|
The OrientedROISampler draws |
|
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. |
|
Sampler which samples one ROI from the input image and label map with a target size, regularly along each dimension. This sampler mimics the situation at test-time, when one image may be regularly divided in all dimensions. |
- class imfusion.machinelearning.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.
- Parameters:
roi_size (vec3i) – Target size of the ROIs to be extracted as [Width, Height, Slices]
device – Specifies whether this Operation should run on CPU or GPU.
apply_to – Specifies fields in a DataItem that this Operation should process (if empty, will select suitable fields based on the current
processing_policy
)seed – Specifies seeding for any randomness that might be contained in this operation.
error_on_unexpected_behaviour – Specifies whether to throw an exception instead of warning about unexpected behaviour.
Other parameters accepted by configure():
device: GPUIfOpenGl
processing_policy: 1
error_on_unexpected_behaviour: False
padding_mode: clamp
label_padding_mode: clamp
- class imfusion.machinelearning.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
.- Parameters:
dimension_divisor (int) – Divisor of dimensions of the output images
device – Specifies whether this Operation should run on CPU or GPU.
apply_to – Specifies fields in a DataItem that this Operation should process (if empty, will select suitable fields based on the current
processing_policy
)seed – Specifies seeding for any randomness that might be contained in this operation.
error_on_unexpected_behaviour – Specifies whether to throw an exception instead of warning about unexpected behaviour.
Other parameters accepted by configure():
device: GPUIfOpenGl
processing_policy: 1
error_on_unexpected_behaviour: False
padding_mode: clamp
label_padding_mode: clamp
- class imfusion.machinelearning.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 sampleBoundariesOnly 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 emptyOutputOnError. (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).- Parameters:
roi_size (vec3i) – Target size of the ROIs to be extracted as [Width, Height, Slices]
labels_values (list) – List of integers representing the target labels
sample_boundaries_only (bool) – Make sure that the ROI contains a boundary (i.e. at least two different label values)
fallback_to_random (bool) – Whether to sample a random ROI or return an empty one when the target label values are not found. Default: True
device – Specifies whether this Operation should run on CPU or GPU.
apply_to – Specifies fields in a DataItem that this Operation should process (if empty, will select suitable fields based on the current
processing_policy
)seed – Specifies seeding for any randomness that might be contained in this operation.
error_on_unexpected_behaviour – Specifies whether to throw an exception instead of warning about unexpected behaviour.
Other parameters accepted by configure():
device: GPUIfOpenGl
processing_policy: 1
error_on_unexpected_behaviour: False
padding_mode: clamp
label_padding_mode: clamp
- class imfusion.machinelearning.OrientedROISampler
The OrientedROISampler draws
num_samples
randomly ROIs of sizeroi_size
with spacingroi_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- Parameters:
roi_size (vec3i) – Target size of the ROIs to be extracted as [Width, Height, Slices]
roi_spacing (vec3) – Target spacing of the ROIs to be extracted in mm
num_samples (int) – Number of samples to draw from one image
random_rotation_range (vec3) – Vector defining deviation in quaternion rotation over the corresponding axis. Default: [0, 0, 0]
random_flipping_chance (vec3) – Vector defining the change that corresponding dimension gets flipped. Default: [0, 0, 0]
random_shearing_range (vec3) – Vector defining the range of proportional shearing in each dimension. Default: [0, 0, 0]
random_scaling_range (vec3) – Vector defining the range of scaling in each dimension. Default: [0, 0, 0]
random_jitter_range (vec3) – Vector defining the range of jitter applied on top of the crop location, defined as the standard deviation in mm in each dimension. Default: [0, 0, 0]
sample_from_labels_proportion (float) – Proportion of ROIs that is sampled from the label values. Default: 0
avoid_borders (bool) – When taking random samples, the samples avoid to see the border if this is turned on. Default: off
align_crop (bool) – Align crop to image grid system, before applying augmentations
device – Specifies whether this Operation should run on CPU or GPU.
apply_to – Specifies fields in a DataItem that this Operation should process (if empty, will select suitable fields based on the current
processing_policy
)seed – Specifies seeding for any randomness that might be contained in this operation.
error_on_unexpected_behaviour – Specifies whether to throw an exception instead of warning about unexpected behaviour.
Other parameters accepted by configure():
device: GPUIfOpenGl
processing_policy: 1
error_on_unexpected_behaviour: False
y_axis_down: False
squeeze: False
padding_mode: zero
label_padding_mode: zero
- class imfusion.machinelearning.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.
- Parameters:
roi_size (vec3i) – Target size of the ROIs to be extracted as [Width, Height, Slices]
device – Specifies whether this Operation should run on CPU or GPU.
apply_to – Specifies fields in a DataItem that this Operation should process (if empty, will select suitable fields based on the current
processing_policy
)seed – Specifies seeding for any randomness that might be contained in this operation.
error_on_unexpected_behaviour – Specifies whether to throw an exception instead of warning about unexpected behaviour.
Other parameters accepted by configure():
device: GPUIfOpenGl
processing_policy: 1
error_on_unexpected_behaviour: False
padding_mode: clamp
label_padding_mode: clamp
- class imfusion.machinelearning.SplitROISampler
Sampler which samples one ROI from the input image and label map with a target size, regularly along each dimension. This sampler mimics the situation at test-time, when one image may be regularly divided in all dimensions.
- Parameters:
roi_size (vec3i) – Target size of the ROIs to be extracted as [Width, Height, Slices]
device – Specifies whether this Operation should run on CPU or GPU.
apply_to – Specifies fields in a DataItem that this Operation should process (if empty, will select suitable fields based on the current
processing_policy
)seed – Specifies seeding for any randomness that might be contained in this operation.
error_on_unexpected_behaviour – Specifies whether to throw an exception instead of warning about unexpected behaviour.
Other parameters accepted by configure():
device: GPUIfOpenGl
processing_policy: 1
error_on_unexpected_behaviour: False
padding_mode: clamp
label_padding_mode: clamp