API#

SpatialData#

The SpatialData class.

SpatialData([images, labels, points, ...])

The SpatialData object.

Operations#

Operations on SpatialData objects.

bounding_box_query(element, axes, ...)

Perform a bounding box query on the SpatialData object.

polygon_query(sdata, polygons, ...[, ...])

Query a spatial data object by a polygon, filtering shapes and points.

get_values(value_key[, element, sdata, ...])

Get the values from the element, from any location: df columns, obs or var columns (table).

match_table_to_element(sdata, element_name)

Filter the table and reorders the rows to match the instances (rows/labels) of the specified SpatialElement.

concatenate(sdatas[, region_key, instance_key])

Concatenate a list of spatial data objects.

rasterize(data, axes, min_coordinate, ...[, ...])

Rasterize a SpatialData object or a SpatialElement (image, labels, points, shapes).

transform(data, transformation[, ...])

Transform a SpatialElement using this transformation and returns the transformed element.

aggregate(values, by[, values_sdata, ...])

Aggregate values by given region.

Utilities#

unpad_raster(raster)

Remove padding from a raster type that was eventually added by the rotation component of a transformation.

Models#

The elements (building-blocks) that consitute SpatialData.

Image2DModel(*args, **kwargs)

Image3DModel(*args, **kwargs)

Labels2DModel(*args, **kwargs)

Labels3DModel(*args, **kwargs)

ShapesModel()

PointsModel()

TableModel()

Utilities#

get_model(e)

Get the model for the given element.

SpatialElement

alias of Union[SpatialImage, MultiscaleSpatialImage, GeoDataFrame, DataFrame]

get_axes_names(e)

Get the dimensions of a SpatialElement.

get_spatial_axes(axes)

Get the spatial axes of interest.

points_geopandas_to_dask_dataframe(gdf[, ...])

Convert a GeoDataFrame which represents 2D or 3D points to a Dask DataFrame that passes the schema validation.

points_dask_dataframe_to_geopandas(points[, ...])

Convert a Dask DataFrame to a GeoDataFrame.

Transformations#

The transformations that can be defined between elements and coordinate systems in SpatialData.

BaseTransformation()

Base class for all transformations.

Identity()

MapAxis(map_axis)

Translation(translation, axes)

Scale(scale, axes)

Affine(matrix, input_axes, output_axes)

Sequence(transformations)

Utilities#

get_transformation(element[, ...])

Get the transformation/s of an element.

set_transformation(element, transformation)

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

remove_transformation(element[, ...])

Remove a transformation/s from an element, in-memory or from disk.

get_transformation_between_coordinate_systems(...)

Get the transformation to map a coordinate system (intrinsic or extrinsic) to another one.

get_transformation_between_landmarks(...)

Get a similarity transformation between two lists of (n >= 3) landmarks.

align_elements_using_landmarks(...[, ...])

Maps a moving object into a reference object using two lists of (n >= 3) landmarks.

DataLoader#

Input/output#

read_zarr(store[, selection])

Read a SpatialData dataset from a zarr store (on-disk or remote).

save_transformations(sdata)

Save all the transformations of a SpatialData object to disk.