NeighborhoodCloud
NeighborhoodCloud is a 3D, orbit-camera view of precomputed tissue
neighborhoods — one alpha-shape polygon per cluster/slice, so it stays cheap
to display regardless of dataset size. It replaces Landscape's older
technology="neighborhood-cloud" mode.
What it shows
- Neighborhood polygons: one alpha-shape region per (cluster, slice),
rendered in 3D with the same orbit camera as
CellCloud. - On-demand cell detail: real cell centroids load in only when a neighborhood is selected, instead of being loaded up front.
- A slice control for stepping through multi-slice datasets.
Draw and edit neighborhoods in spatial, UMAP, and XY views with
Landscape. NeighborhoodCloud displays precomputed
neighborhoods across slices.
Usage
import celldega as dega
nbhd_cloud = dega.viz.NeighborhoodCloud(
base_url="https://your-landscape-files-url",
adata=adata,
)
nbhd_cloud
Build the underlying neighborhood-cloud DegaFiles from per-slice alpha shapes:
gdf = dega.nbhd.alpha_shape_cell_clusters_by_slice(
adata, cluster_attr="leiden", slice_attr="slice_id", z_attr="Z"
)
dega.pre.write_nbhd_cloud_dataset(
adata, gdf, "path/to/dega_files",
cluster_attr="leiden", slice_attr="slice_id", z_attr="Z",
max_cells=50_000, # cap the cells written per cluster for large datasets
)
Shape colors come from adata.uns["leiden_colors"] (or pass meta_cluster=
with a color column); without either, each cluster gets a distinct fallback
color.
See File Formats
for the layout.
NeighborhoodCloud can also be linked to a Clustergram, exactly like
Landscape — see dega.viz.spatial_clustergram.
For the full list of constructor arguments, see the Viz Module API reference.