spatialdata.transformations.get_transformation_between_landmarks#
- spatialdata.transformations.get_transformation_between_landmarks(references_coords, moving_coords)#
Get a similarity transformation between two lists of (n >= 3) landmarks.
Note that landmarks are assumed to be in the same space.
- Parameters:
references_coords (
Union
[GeoDataFrame
,DataFrame
]) – landmarks annotating the reference element. Must be a valid element describing points or circles.moving_coords (
Union
[GeoDataFrame
,DataFrame
]) – landmarks annotating the moving element. Must be a valid element describing points or circles.
- Return type:
- Returns:
: The Affine transformation that maps the moving element to the reference element.
Examples
If you save the landmark points using napari_spatialdata, they will be alredy saved as circles. Here is an example on how to call this function on two sets of numpy arrays describing x, y coordinates. >>> import numpy as np >>> from spatialdata.models import PointsModel >>> from spatialdata.transformations import get_transformation_between_landmarks >>> points_moving = np.array([[0, 0], [1, 1], [2, 2]]) >>> points_reference = np.array([[0, 0], [10, 10], [20, 20]]) >>> moving_coords = PointsModel(points_moving) >>> references_coords = PointsModel(points_reference) >>> transformation = get_transformation_between_landmarks(references_coords, moving_coords)