dvpio.read.shapes.read_lmd#
- dvpio.read.shapes.read_lmd(path, calibration_points_image, transformation_type='similarity', precision=6, switch_orientation=False)#
Read and parse LMD-formatted masks for the use in spatialdata
Wrapper for pyLMD functions.
- Parameters:
path (
str) – Path to LMD-formatted segmentation masks in .xml formatcalibration_points_image (
PointsModel) – Calibration points of the image as DataFrame, with 3 calibration points. Point coordinates are stored as seperate columns inxandycolumn.transformation_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
precision (
int|None(default:6)) – Default 6. Rounding of affine transformation matrix, which can be necessary for numerical stability of shape transformations. PassingNoneskips rounding.switch_orientation (
bool(default:False)) – Per default, LMD is working in a (x, y) coordinate system while the image coordinates are in a (row=y, col=x) coordinate system. If True, transform the coordinate systems by mirroring the coordinate system at the main diagonal.
- Return type:
- Returns:
spatialdata.models.ShapesModelTransformed shapes in image coordinates.Object has special attributes
attrs.transformationglobal(image coordinates)to_lmdTransformation back to leica coordinate system