Spatial transcriptomics
Explore spatial-transcriptomics data such as 10x Xenium: view individual molecules, use any gene as a measurement, compare expression between groups, and compute neighborhood and region statistics
NimbusImage can hold a whole spatial-transcriptomics run in one place: the tissue images, every segmented cell, the full gene-expression table for every cell, and the individual detected molecules. Everything you already use for cell analysis — filters, the Analysis panel, gates, color-by-property, CSV export — works on genes too, so you can, for example, gate on two genes in a scatter plot and then look at where those cells sit in the tissue.
The feature was built around 10x Xenium output bundles (Xenium Onboard Analysis 1.3 through 4, including Prime 5K and the XOA 4 protein panels). It has been used on datasets with over 700,000 cells and more than 4,600 genes.
The workflow at a glance
Ingest a Xenium bundle with the
nimbusimagePython tooling. This creates the image datasets, draws a polygon for every cell, and registers the expression table and the molecules.Look at molecules with the Transcripts palette — individual points when zoomed in, a density heat map when zoomed out.
Use genes as measurements: add genes as live columns, copy them into a stored measurement, or compute a gene-set score. Genes then work in filters, plots, gates and color-by.
Ask questions from the Selection summary: composition and mean expression of a population, differential expression between two groups, neighborhood enrichment between cell types, and per-region summaries.
Edit cells and recompute: if you redraw, add or delete cell outlines, rebuild the expression table from the molecules. Earlier tables are kept as versions you can switch between.
Getting your data in
Loading a Xenium bundle is done with the xenium-ingest tooling in the nimbusimage Python package, not through the upload page. It is usually run by whoever administers your server, or by an AI coding assistant such as Claude Code (the package ships an xenium-ingest skill with the full runbook). If you don't have access to run it yourself, ask your server administrator to ingest the bundle.
What files are needed
From the 10x download, the ingest uses:
The output bundle (
*_xe_outs.zip), from which it needsmorphology_focus/,cells.zarr.zip(cell outlines),cell_feature_matrix.zarr.zip(the counts),analysis.zarr.zip(clusterings),experiment.xenium(pixel size and run details) and, for the molecule overlay,transcripts.zarr.zipThe H&E image (
*_he_image.ome.tif) and its alignment matrix (*_he_imagealignment.csv), if you want the H&E as wellCell types (
*_cell_types.csv), if 10x provides them for your datasetPathology regions (
*_annotation.geojson), optionally
Running the ingest
The tooling is installed with pip install 'nimbusimage[xenium]' (use nimbusimage[xenium-umap] to also compute a UMAP). Every step is available both as a Python function and as a subcommand of the nimbusimage-xenium command; nimbusimage-xenium <step> --help lists each step's options. In order, the steps are:
morphology— create the image dataset frommorphology_focus/, with channels named after their stains (for examplec00-DAPI)polygons— draw one polygon per segmented cell, and save a cell map file that later steps reuseumap— compute a UMAP embedding (10x does not ship one)properties— write a marker-gene panel, clusterings and the UMAP coordinates as measurementscell-types— tag each cell with its typespatial-table— build and register the full expression tabletranscripts— register the molecules as an overlayregions— import pathology regions as polygons taggedregion
What you end up with
Two datasets: a morphology dataset with the fluorescence stains (protein bundles can have ~35 channels), and a separate H&E dataset. The H&E is imaged on its own pixel grid, so the ingest uses 10x's alignment matrix to place cells, regions and molecules correctly on it.
Cell polygons, one object per segmented cell, each tagged
cellplus its cell type (for exampleMemory B Cell)Measurements such as
Gene Expression(the marker panel),Clustering(for examplegraphclust) andUMAP(x,y)A spatial expression table with every gene for every cell. On protein bundles, antibody targets are named
<name> (protein)(for exampleCD4 (protein)) so they don't collide with the gene of the same name.A transcripts overlay of the individual molecules
Optionally, pathology regions as polygons tagged
region
A new collection shows at most 6 channels as layers; use Add layer in the Layers panel to show the rest.
How cells relate to the expression table
Each row of the expression table belongs to exactly one cell polygon. The table keeps all genes in a single file on the server rather than as millions of stored measurement values, which is what makes a whole-transcriptome table practical. Cells you add later have no row until you recompute the table; an analysis that finds objects without a row reports them (for example "N of the summarized objects have no row in the spatial table").
Importing pathology regions yourself
Region layers drawn in QuPath or shipped by 10x can also be imported from the app:
Open the Import / export data menu (up/down-arrows icon in the top bar) → Import GeoJSON…
Choose the
.geojsonor.jsonfile and check the Preview (counts by shape and by class)Pick the Layer (sets the channel)
Keep Extra tag for every annotation as
region(the default); each feature's class name also becomes a tagClick Import
Coordinates are read as this image's pixels, with the origin at the top-left (QuPath's convention). A warning appears if coordinates fall outside the image, which usually means the file is in microns or belongs to the other image — files drawn on the H&E image must be imported on the H&E dataset. Export GeoJSON in the same menu does the reverse, for use in QuPath and similar tools.
Viewing molecules: the Transcripts palette
On datasets with registered transcripts, a Transcripts button (hexagon-of-dots icon) appears in the palette toolbar.
Open Transcripts and turn on Show transcripts
Search for and pick genes in Genes (up to 8). Each gets its own color, which you can change next to the gene name
Adjust Quality ≥ (default 20, Xenium's own cut-off) and Opacity
Choose a Rendering mode:
Auto — individual molecules as points when zoomed in, a density Heat map when zoomed out
Points or Heat map to force one
Points on screen at most caps how many molecules are drawn at once
Clicking a molecule shows its gene, position and quality. If it lies inside a cell outline, Go to cell jumps to and selects that cell.
A few things to know:
The status line under the controls says what is being shown — a number of molecules, or "Density heat map"
Zoomed out, the quality threshold is approximate: points are merged into clusters, and the heat map counts molecules of every quality. Zoom in for an exact threshold
On the H&E dataset only points are available — there is no heat map there
To see every cell at once rather than a subset, see the zoomed-out overview in Working with large annotation datasets.
Genes as measurements
Every gene in the expression table can be used like any other measurement.
Open the Object Browser and go to the Measurements tab
Click Add genes (DNA icon). The button only appears when the dataset has an expression table
Search for and pick genes, then choose one of three modes:
Add as live columns (the default) — genes are read straight from the table, instantly. They work in filters, plots, color-by, the object list and CSV export, but you can't sort the object list by them
Copy into a measurement — writes each gene's count for every cell as a stored value under a Measurement name (default
Gene Expression). Stored values are sortable and exportable. On large datasets this runs as a server jobGene-set score — writes one value per cell, the mean (default) or sum of the picked genes, under a Score name you choose. Scores are stored in a
Gene set scoresmeasurement
Click the button at the bottom (for example Add 3 genes as columns, Copy 3 genes or Score 3 genes)
Live gene columns are listed under a single Spatial table group in the Measurements tab, without a Run button, since there is nothing to compute. From there they behave like the rest of your properties:
Showing values — show and hide them as columns in the object list, as described in Finding and showing measurements
Filtering — use them in property filters, like any numeric property
Coloring — pick a gene in Color by Property. For cluster ids, choose Categorical, since Auto may give integer clusters a continuous ramp
Plotting and gating — use genes as axes in the Analysis panel and draw gates on them
Exporting — CSV export includes live columns, named
spatial / <gene>
Cell types arrive as tags, and categorical measurements such as clusters can be filtered as described in Filtering by text-valued properties.
Analyses
All the spatial analyses start from the Selection summary: open the Import / export data menu (up/down-arrows icon in the top bar) → Selection summary.
Selection summary
What it answers: what is in this population, and how much do its cells express a given gene?
Choose Objects to summarize: All objects, Filtered objects (your current filters and gates), or Selected objects
Read the Composition by tag table — count and percentage for each tag, which for Xenium cells means each cell type
Optionally pick Properties to summarize to get n, mean, SD, min and max for each
In the Expression section, pick genes under Genes from the spatial table to see each gene's Mean count and % expressing over the same objects
Download CSV saves the summary, expression included
Mean counts include cells with zero counts.
Differential expression
What it answers: which genes are most differently expressed between two groups of cells?
In the Selection summary, choose Filtered objects or Selected objects — this is group A. (The button is disabled for All objects, since there would be nothing to compare against.)
In the Expression section, click Compare expression…
Choose group B: B: everything else (the default) or B: objects with any of these tags
Choose the test: Welch t-test (the default) or Wilcoxon (Mann-Whitney)
Set Genes to list (default 50, up to 500) and click Compare
Every gene in the table is tested. The result is a ranked table with each gene's log₂ FC, Mean A, Mean B, % A, % B, the test statistic and p, along with the number of cells in each group and the number of genes tested. A positive log₂ fold change means higher in A. Download CSV saves the table.
Neighborhood enrichment
What it answers: which cell types sit next to which, more or less often than expected by chance?
In the Selection summary, under Spatial statistics, click Neighborhood…
Set the Radius (µm) (default 30)
Check Tags that are not types (default
cell): tags listed here are ignored when deciding each cell's typeClick Compute
Each cell's neighbors within the radius are counted by type, where a cell's type is its first tag not in the ignore list. The result is a matrix of log₂ observed / expected neighbor pairs between every pair of types — positive values mean two types are neighbors more often than expected if the type labels were shuffled. Hover over a cell of the matrix for its value; CSV downloads it. Each cell's neighbor fractions by type are also saved as a Neighborhood measurement, so you can filter, gate and color by them.
The radius needs the dataset's pixel size. When it is blank, NimbusImage fills it in from the expression table, including on the H&E dataset; the hint under the radius shows the conversion to image pixels.
Region summaries
What it answers: how many cells of each type, and how much expression, fall inside each tissue region?
In the Selection summary, under Spatial statistics, click Regions…
Choose Polygons with a tag and pick the Region tag (for example
region), or Selected polygons (up to 50)Optionally pick Genes (mean per region)
Click Summarize
Each row shows a region, its number of cells and their composition by type, plus the mean count of each chosen gene. A cell belongs to a region when its center lies inside the region polygon. CSV downloads the table.
Editing cells and recomputing the table
When you redraw, add or delete cell outlines, the expression table no longer matches your cells. You can rebuild it from the molecules: every molecule is assigned to the cell polygon it falls in (the smallest polygon wins where outlines overlap), and a new table is written.
The Cell table card in the Transcripts palette shows the active table and whether it is out of date — for example "12 cells added, 3 edited since this table was built" or "Up to date with the cell polygons." Use its refresh button to check for new edits.
To recompute:
In the Cell table card, click Recompute counts…
Enter a Version label (default "Recomputed")
Choose the scope:
Edited cells only — rebuilds only the cells that were added, edited or removed, plus their neighbors (molecules may have moved from one cell to the next). Every other row is carried over unchanged. This is much faster on large sections, and needs an existing table with something changed
Every cell (full rebuild) — reassigns every molecule from scratch
Optionally adjust the quality threshold (default 20) and Only cells tagged (default
cell; leave blank to count every polygon)Optionally tick Also recompute PCA / UMAP / k-means, which takes minutes on large sections
Click Recompute
Cell types carry over to the new table from each cell's tags.
Switching between table versions
Recomputing never discards the previous table: it is kept as a version. Use the drop-down in the Cell table card to switch which table is active. Each entry shows its label and size (cells × genes). Switching re-points everything at the newly active table — live gene columns, filters, gates, plots, summaries and differential expression — and gates keep their shapes but are re-evaluated against the new values.
Python API
The nimbusimage Python package exposes the same features through ds.spatial: the expression table, transcripts, table versions, neighborhoods and region summaries.
aggregate and differential take the same filter object the Objects tab uses, analysis gates included. The Xenium ingest steps are in nimbusimage.xenium; see the API reference for details.
Limitations and tips
No Transcripts or Add genes button? The dataset has no registered transcripts or expression table. Ask whoever runs your server to run the ingest step.
"unknown feature" means that gene isn't in this dataset's table — check the spelling, the
(protein)suffix, or whether you switched datasets.Live gene columns can't be sorted. Use Copy into a measurement if you need to sort the object list by a gene.
H&E and morphology are separate images. Use the objects and regions ingested onto the dataset you are viewing; don't import morphology-pixel files onto the H&E dataset or vice versa.
Distances or areas off by a constant factor? Check the pixel size: click the scale bar in the viewer to open Scale settings. A pixel size typed by hand is never overwritten automatically.
Region counts look wrong? Cells are counted by their center. Make sure every region carries the region tag and no cell does; "No polygon carries that tag" means the tag is misspelled or missing.
Image area black right after an ingest finishes? Reload the page.
Recompute is 2D. Molecules are assigned to cells in the image plane; z position is ignored.
Ask Nimbus AI. The Nimbus AI assistant knows how these tools work and can walk you through them.
Last updated