ai4med.libs.transforms.helper package


DLMed dataset in TFAPI module.

crop_image(data, image_field, label_field, crop_size, start_dim, end_dim, max_displacement, data_format)

Simultaneously crops image_field and label_field

Utility function to randomly crop 2D image. Optionally crops a label image in the same way

  • [dict] (data) – dictionary of elements being processed

  • [string] (data_format) – field corresponding to image np.array

  • [string] – field corresponding to label np.array, none if you don’t have one

  • [list] (crop_size) – 2d list of crop size

  • [int] (max_displacement) – starting dimension of image grid in array , e.g., if CxMxN, then start_dim is 1

  • [int] – ending dimensions of image grid in array, e.g., if CxMxN, end_dim is 3

  • [int] – max displacement from center for random crop

  • [string] – ‘channels_last’, ‘channels_last’, or ‘grayscale’

find_random_foreground_or_background(a, is_foreground=False)
find_random_foreground_or_background_naive(a, is_foreground=False)
pad_if_needed(image, out_size, is_channels_first=True)
pad_to_minimal_size(image, out_size, start_dim, end_dim, pad_mode='constant')

DLMed dataset in TFAPI module.

create_matrix_rotation_2d(angle, matrix=None)
create_matrix_rotation_x_3d(angle, matrix=None)
create_matrix_rotation_y_3d(angle, matrix=None)
create_matrix_rotation_z_3d(angle, matrix=None)
elastic_deform_coordinates(coordinates, alpha, sigma)
interpolate_img(img, coords, order=3, mode='nearest', cval=0.0, is_seg=False)
rotate_coords_2d(coords, angle)
rotate_coords_3d(coords, angle_x, angle_y, angle_z)
scale_coords(coords, scale)
scale_coords_2d(coords, scale_x, scale_y)
scale_coords_3d(coords, scale_x, scale_y, scale_z)
© Copyright 2020, NVIDIA. Last updated on Feb 2, 2023.