insitupy.spatialdata.convert_from_spatialdata#
- insitupy.spatialdata.convert_from_spatialdata(sdata, verbose=True, strict=False)#
Convert an InSituPy-dialect SpatialData object back into an InSituData or InSituExperiment.
A true inverse of
convert_to_spatialdata(): the dialect and every modality-naming detail (pixel sizes, RGB-ness, per-cell-layer boundaries, per-unit-layer tables, …) are auto-detected from the store itself andsdata.attrs["insitupy_spatialdata_dialect"]- no caller-supplied keys or pixel sizes are needed. Returns a bareInSituDatafor a single-sample store (noSAMPLE.<uid>..prefix in any element key), or anInSituExperimentofInSituDataobjects for a multi-sample store.The returned object has no backing project directory - call
.saveas(path)to persist it as a.insitupyproject before.save()can be used.- Parameters:
sdata (
SpatialData) – A SpatialData object written byconvert_to_spatialdata().verbose (
bool(default:True)) – If True, log progress for each modality.strict (
bool(default:False)) – If True, raise on an incompletely-written store (a cell/units layer present but missing itstable, or a cell layer with boundaries but no recorded_insitupy_seg_mask_value) instead of warning and skipping it (SD-B7). DefaultFalsepreserves the lenient warn-and-skip behaviour.
- Returns:
The reconstructed object(s).
- Return type:
- Raises:
ValueError – If
sdata.attrscarries no InSituPy dialect descriptor (i.e. this is a foreign/labels-native store InSituPy did not write - seeinsitupy.spatialdata.convert_from_foreign_spatialdata()) or if the descriptor’s version is not one this InSituPy version supports.