dvpio.read.shapes.transform_shapes#
- dvpio.read.shapes.transform_shapes(shapes, calibration_points_target, calibration_points_source, *, transformation_type='similarity')#
Apply coordinate transformation to shapes based on calibration points from a target and a source
Computes transformation between source and target coordinates.
- Parameters:
shapes (
ShapesModel) – Shapes in source coordinate system (usually LMD coordinates)calibration_points_target (
PointsModel) – 3 Calibration points in target coordinate system (usually image/pixel coordinates) Expectsspatialdata.models.PointsModelwith calibration points inx/ycolumncalibration_points_source (
PointsModel) – 3 Calibration points, matched tocalibration_points_targetin source coordinate system (usually LMD coordinates) Expectsspatialdata.models.PointsModelwith calibration points inx/ycolumntransformation_type (
Literal['similarity','affine','euclidean'] (default:'similarity')) –- affine
Full affine transformation (scaling, rotation/reflexion, translation, shearing). This operation does not preserve the angles within or distances the shapes
- similarity (recommended)
Similarity transformation. Compared to an affine transformation, a similarity transformation constraints the solution space to scaling, rotations, reflections, and translations, i.e. angles of shapes are retained. If you only want to map between image and microscopy coordinates only the subset of similarity transformations (scaling, rotation, reflection, translation) is required.
- euclidean (Rigid transform)
Only translation and rotation are allowed
- Return type:
- Returns:
spatialdata.models.ShapesModelTransformed shapes in target coordinate system
Object has special attributes
attrs.transformationglobal: (image coordinates)to_lmd: Leica coordinate system transformation
- Raises:
AttributeError – Checks validity of shapes and calibration points data formats