Spatial functions#

Tissue segmentation#

detect_tissue_threshold(adata[, size, low, high])

Detect the tissue boundary using a thresholding method.

get_approx_tissue_boundary(adata[, size, ...])

Compute approx tissue.

get_tissue_boundary(adata[, threshold_low, ...])

Detect the tissue boundary.

get_tissue_contour_score(cntr, adata[, size])

Get the score of a contour.

Geometries#

get_geom(adata[, threshold, inplace, res])

Get the tissue polygons and tissue boundary from the sample image.

get_spot_coords(adata[, subset, as_tuple, ...])

Get the spot coordinates in the image.

get_visium_spots(adata[, with_radius, res])

Return a GeoSeries of the spots in the Visium slide.

set_geometry(adata, geom[, values, index, ...])

Set the geometry of the AnnData object.

to_points(x, y[, data, scale, radius])

Create a GeoSeries from x and y coordinates.

to_spatial_weights(adata[, graph_name])

Convert a graph adjacency matrix to a spatial weights matrix.

Image transformation#

These functions allow rotating and mirroring the tissue images. These functions perform the same transformations on the spot coordinates.

apply_transforms(adata)

Apply unapplied image transforms.

cancel_transforms(adata)

Cancel unapplied image transforms.

mirror_img(adata[, apply, k, axis])

Mirror the image along an axis.

rollback_transforms(adata[, apply])

Rollback all transformations.

rotate_img90(adata[, apply, k, axis])

Rotate the image by 90 degrees k times.

Metrics and neighbours#

compute_spatial_lag(adata, feature[, ...])

Compute the spatial lag of a feature.

local_moran(adata, feature[, inplace, ...])

Compute local Moran's I for a feature.

losh(adata, feature[, graph_name, ...])

Compute LOSH for a feature.

moran(adata, feature[, graph_name, layer, ...])

Compute Moran's I.

Graphs#

compute_correlogram(adata, feature[, ...])

Compute the correlogram of a feature.

compute_higher_order_neighbors(adata[, ...])

Compute higher order neighbors of graph.

get_default_graph(adata)

Get the default graph for spatial operations.

set_default_graph(adata, graph_name)

Set the default graph for spatial operations.