darsia.CoordinateTransformation#

class CoordinateTransformation(coordinatesystem_src, coordinatesystem_dst, pts_src, pts_dst, fit_options={})[source]#

Bases: object

General affine transformation (translation, scaling, rotation), applicable for general (up to 4d) images.

NOTE: Inherit from base correction to make use of the plain array correction routines but complement with meta corrections.

Constructor.

Parameters:
coordinatesystem_srcCoordinateSystem

Source coordinate system.

coordinatesystem_dstCoordinateSystem

Target coordinate system.

pts_srcCoordinateArray, VoxelArray, VoxelCenterArray

Source points.

pts_dstCoordinateArray, VoxelArray, VoxelCenterArray

Target points.

fit_optionsdict

Options for the affine fit.

Methods

correct_metadata(image)

Correction routine of metadata.

find_intersection()

Determine the active canvas in coordinatesystem_dst, covered by coordinatesystem_src after transformed onto the target canvas.

Attributes

coordinatesystem_src

Coordinate system corresponding to the input.

coordinatesystem_dst

Coordinate system corresponding to the output/target.

dim

Dimension of the underlying Euclidean spaces.

affine_correction

Correction object for the array data.

correct_metadata(image)[source]#

Correction routine of metadata.

Parameters:
imagedarsia.Image

Image corresponding to some source image.

Returns:
dict

Metadata corresponding to a destination image.

find_intersection()[source]#

Determine the active canvas in coordinatesystem_dst, covered by coordinatesystem_src after transformed onto the target canvas.

NOTE: Only supported for 2d. NOTE: Requires extra dependency.

Returns:
tuple of slices

Voxel intervals ready to be used to extract subregions.

Raises:
NotImplementedError

If dimension not 2.

ImportError

If Python package largestinteriorrectangle not installed.

affine_correction#

Correction object for the array data.

coordinatesystem_dst#

Coordinate system corresponding to the output/target.

coordinatesystem_src#

Coordinate system corresponding to the input.

dim#

Dimension of the underlying Euclidean spaces.