medpy.filter.image.resample#

medpy.filter.image.resample(img, hdr, target_spacing, bspline_order=3, mode='constant')[source]#

Re-sample an image to a new voxel-spacing.

Parameters:
imgarray_like

The image.

hdrobject

The image header.

target_spacingnumber or sequence of numbers

The target voxel spacing to achieve. If a single number, isotropic spacing is assumed.

bspline_orderint

The bspline order used for interpolation.

modestr

Points outside the boundaries of the input are filled according to the given mode (‘constant’, ‘nearest’, ‘reflect’ or ‘wrap’). Default is ‘constant’.

Returns:
imgndarray

The re-sampled image.

hdrobject

The image header with the new voxel spacing.

Warning

Voxel-spacing of input header will be modified in-place!