spatialdata.transformations.align_elements_using_landmarks#
- spatialdata.transformations.align_elements_using_landmarks(references_coords, moving_coords, reference_element, moving_element, reference_coordinate_system='global', moving_coordinate_system='global', new_coordinate_system=None, write_to_sdata=None)#
Maps a moving object into a reference object using two lists of (n >= 3) landmarks.
This returns the transformations that enable this mapping and optionally saves them, to map to a new shared coordinate system.
- 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.reference_element (
Union
[SpatialImage
,MultiscaleSpatialImage
,GeoDataFrame
,DataFrame
]) – the reference element.moving_element (
Union
[SpatialImage
,MultiscaleSpatialImage
,GeoDataFrame
,DataFrame
]) – the moving element.reference_coordinate_system (
str
(default:'global'
)) – the coordinate system of the reference element that have been used to annotate the landmarks.moving_coordinate_system (
str
(default:'global'
)) – the coordinate system of the moving element that have been used to annotate the landmarks.new_coordinate_system (
Optional
[str
] (default:None
)) – If provided, both elements will be mapped to this new coordinate system with the new transformations just computed.write_to_sdata (
Optional
[SpatialData
] (default:None
)) – If provided, the transformations will be saved to disk in the specified SpatialData object. The SpatialData object must be backed and must contain both the reference and moving elements.
- Return type:
- Returns:
: A similarity transformation that maps the moving element to the same coordinate of reference element in the coordinate system specified by reference_coordinate_system.