spatialdata.transformations.set_transformation(element, transformation, to_coordinate_system=None, set_all=False, write_to_sdata=None)#

Set a transformation/s to an element, in-memory or to disk.

  • element (Union[SpatialImage, MultiscaleSpatialImage, GeoDataFrame, DataFrame]) – The element to set the transformation/s to.

  • transformation (Union[BaseTransformation, dict[str, BaseTransformation]]) – The transformation/s to set.

  • to_coordinate_system (Optional[str] (default: None)) –

    The coordinate system to set the transformation/s to.

    • If None and set_all=False sets the transformation to the ‘global’ coordinate system (default system).

    • If None and set_all=True sets all transformations.

  • set_all (bool (default: False)) – If True, all transformations are set. If False, only the transformation to the specified coordinate system is set. If True, to_coordinate_system needs to be None.

  • write_to_sdata (Optional[SpatialData] (default: None)) – The SpatialData object to set the transformation/s to. If None, the transformation/s are set in-memory. If not None, the element needs to belong to the SpatialData object, and the SpatialData object needs to be backed.

Return type: