ants.ops.resample_image

resample_image(image, resample_params, use_voxels=False, interp_type=1)[source]

Resample image by spacing or number of voxels with various interpolators. Works with multi-channel images.

ANTsR function: resampleImage

Parameters:
  • image (ants.core.ANTsImage) – input image

  • resample_params (tuple/list) – vector of size dimension with numeric values

  • use_voxels (bool) – True means interpret resample params as voxel counts

  • interp_type (int) – one of 0 (linear), 1 (nearest neighbor), 2 (gaussian), 3 (windowed sinc), 4 (bspline)

Return type:

ants.core.ANTsImage

Example

>>> import ants
>>> fi = ants.image_read( ants.get_ants_data("r16"))
>>> finn = ants.resample_image(fi,(50,60),True,0)
>>> filin = ants.resample_image(fi,(1.5,1.5),False,1)
>>> img = ants.image_read( ants.get_ants_data("r16"))
>>> img = ants.merge_channels([img, img])
>>> outimg = ants.resample_image(img, (128,128), True)