locan.data.transform.spatial_transformation.transform_affine#
- locan.data.transform.spatial_transformation.transform_affine(locdata, matrix=None, offset=None, pre_translation=None, method='numpy')[source]#
Transform points or coordinates in locdata by an affine transformation.
- Parameters:
locdata (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]],LocData
]) – Localization data on which to perform the manipulation.matrix (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]],None
]) – Transformation matrix. If None the unit matrix is used. Array with shape (ndim, ndim). If None the unit matrix is used.offset (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]],None
]) – Translation vector. Array with shape (ndim,). If None a vector of zeros is used.pre_translation (
Union
[_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]],None
]) – Translation vector for coordinates applied before affine transformation. Array with shape (ndim,). The reverse translation is applied after the affine transformation.method (
Literal
['numpy'
,'open3d'
]) – The method (i.e. library or algorithm) used for computation. One of ‘numpy’, ‘open3d’.
- Returns:
New localization data with transformed coordinates.
- Return type:
npt.NDArray[np.float64] | LocData