PolynomialTransform

class sofia_redux.toolkit.image.warp.PolynomialTransform(source=None, destination=None, order=2)[source]

Bases: ABC

Initialize a polynomial transform.

Parameters:
sourcenumpy.ndarray, optional

The source coordinates from which to base the transform of shape (n_dimensions, shape,)

destinationnumpy.ndarray, optional

The destination coordinates from which to base the transform of shape (n_dimensions, shape,).

orderint, optional

The order of polynomial fit.

Attributes Summary

n_coeffs

Return the number of coefficients for the fit.

ndim

Return the number of dimensions in the fit.

Methods Summary

__call__(coordinates[, inverse])

Transform a given set of coordinates using the stored polynomial.

estimate_transform([source, destination, order])

Estimate the transform given source and destination coordinates.

transform(coordinates[, inverse])

Transform a given set of coordinates using the stored polynomial.

Attributes Documentation

n_coeffs

Return the number of coefficients for the fit.

Returns:
int
ndim

Return the number of dimensions in the fit.

Returns:
int

Methods Documentation

__call__(coordinates, inverse=False)[source]

Transform a given set of coordinates using the stored polynomial.

Parameters:
coordinatesnumpy.ndarray

The coordinates to transform of shape (n_dimensions, shape,).

inversebool, optional

If True, perform the inverse transform instead.

Returns:
warped_coordinatesnumpy.ndarray (float)
estimate_transform(source=None, destination=None, order=2)[source]

Estimate the transform given source and destination coordinates.

Parameters:
sourcenumpy.ndarray, optional

The source coordinates from which to base the transform of shape (n_dimensions, shape,)

destinationnumpy.ndarray, optional

The destination coordinates from which to base the transform of shape (n_dimensions, shape,).

orderint, optional

The order of polynomial fit.

Returns:
None
transform(coordinates, inverse=False)[source]

Transform a given set of coordinates using the stored polynomial.

Parameters:
coordinatesnumpy.ndarray or float

The coordinates to transform of shape (n_dimensions, shape,), (n_dimensions,) or a float if one-dimensional.

inversebool, optional

If True, perform the inverse transform instead.

Returns:
warped_coordinatesnumpy.ndarray (float)