spatialvi.data.SpatialCoordsField

spatialvi.data.SpatialCoordsField#

class spatialvi.data.SpatialCoordsField(obsm_key)[source]#

AnnData obsm field for 2D/3D spatial coordinates.

Wraps scvi’s ObsmField with coordinate dimensionality validation. Stores coordinates as-is (no normalization) — callers may normalize before registration if needed.

Parameters:

obsm_key (str) – Key to access the spatial coordinates in adata.obsm.

__init__(obsm_key)[source]#

Methods

__init__(obsm_key)

get_data_registry()

Returns a nested dictionary which describes the mapping to the data field.

get_field_data(adata)

Returns the requested data as determined by the field.

get_summary_stats(state_registry)

Get summary stats.

register_field(adata)

Register the field.

transfer_field(state_registry, adata_target, ...)

Transfer the field.

validate_field(adata)

Validate the field.

view_state_registry(state_registry)

View the state registry.

Attributes

COLUMN_NAMES_KEY

attr_key

The key of the data field within the relevant AnnData attribute.

attr_name

The name of the AnnData attribute where the data is stored.

is_empty

Returns True if the field is empty as a function of its kwargs.

mod_key

The modality key of the data field within the MuData (if applicable).

registry_key

The key that is referenced by models via a data loader.