warp

sofia_redux.toolkit.image.warp.warp(data, source, destination, order=2, interpolation_order=3, mode='constant', output_shape=None, cval=nan, clip=True, get_transform=False, threshold=0.5)[source]

Warp an n-dimensional image according to a given coordinate transform.

Parameters:
datanumpy.ndarray

The data to warp of with n_dimensions of shape (shape,). The data must not contain any NaN values.

sourcenumpy.ndarray

The input coordinates of shape (n_dimensions, shape,). Dimensions should be ordered using the Numpy convention (y, x).

destinationnumpy.ndarray

The warped coordinates of shape (n_dimensions, shape,). Dimensions should be ordered using the Numpy convention (y, x).

orderint, optional

The order of polynomial coefficients used to model the warping.

interpolation_orderint, optional

The order of interpolation.

modestr, optional

May take values of {‘constant’, ‘edge’, ‘symmetric’, ‘reflect’, ‘wrap’}. Points outside the boundaries of the input are filled according to the given mode. Modes match the behavior of np.pad().

output_shapetuple (int), optional

Shape of the output array generated. By default the shape of the input array is preserved. Dimensions should be ordered using the Numpy convention (y, x).

cvalfloat, optional

Used in conjunction with the ‘constant’ mode, and is the value set outside the image boundaries.

clipbool, optional

Whether to clip the output to the range of values of the input array. This is enabled by default, since higher order interpolation may produce values outside the given input range.

get_transformbool, optional

If True, return the polynomial transform in addition to the results.

Returns:
warpednumpy.ndarray (float)

The warped data of shape (shape,).