ants.deeplearn.cropping_and_padding_utilities
Functions
|
Crop the center of an image. |
|
Crop a patch from an image around a center point |
|
Pad an image based on a factor. |
|
Pad or crop an image to a specified size |
- crop_image_center(image, crop_size)[source]
Crop the center of an image.
- Parameters:
image (
ants.core.ANTsImage) – Input imagecrop_size (
typing.Tuple) – Width, height, depth (if 3-D), and time (if 4-D) of crop region.
- Return type:
ANTs image.
Example
>>> import ants >>> image = ants.image_read(ants.get_ants_data('r16')) >>> cropped_image = crop_image_center(image, crop_size=(64, 64))
- crop_image_from_center_point(image, center_point, patch_size)[source]
Crop a patch from an image around a center point
- image: ANTsImage
Input image
- center_point: tuple
Physical space coordinates of center point.
- patch_size: tuple
List defining patch size.
- pad_image_by_factor(image, factor)[source]
Pad an image based on a factor.
Pad image of size (x, y, z) to (x’, y’, z’) where (x’, y’, z’) is a divisible by a user-specified factor.
- Parameters:
image (
ants.core.ANTsImage) – Input imagefactor (
scalarortyping.Tuple) – Padding factor
- Return type:
ANTs image.
Example
>>> import ants >>> image = ants.image_read(ants.get_ants_data('r16')) >>> padded_image = pad_image_by_factor(image, factor=4)
- pad_or_crop_image_to_size(image, size)[source]
Pad or crop an image to a specified size
- Parameters:
image (
ants.core.ANTsImage) – Input imagesize (
tuple) – size of output image
- Return type:
A croppedorpadded image
Example
>>> import ants >>> image = ants.image_read(ants.get_ants_data('r16')) >>> padded_image = pad_or_crop_image_to_size(image, (333, 333))