Spatial transcriptomics measures gene activity at known positions across a thin slice of tissue. To build a 3D picture, or to compare slices from different samples, labs must line slices up. Two kinds of distortion get in the way at the same time. Cutting physically stretches, tears and shears the tissue, so a spot in one slice no longer sits where its partner sits in the next; this is registration error. Separate runs, reagent lots and platforms also shift the measured expression values themselves; these are technical batch effects. The trouble is that both distortions leave the same footprint: two corresponding locations look different. A registration method that compares expression across slices can "fix" a batch shift by bending the tissue. A batch-correction method that pairs neighbors across slices can read a misalignment as a batch difference and correct it away, erasing real biology.
This note proposes to separate the two using a structural fact about their sources. A deformation moves positions but leaves the expression vector at a point unchanged. A batch effect changes expression values but, to first order, does so the same way everywhere in the slice for a given cell type. We would fit a continuous, smooth deformation field together with a low-capacity batch map that is forbidden to vary with position. We would also build a controlled stress test that injects known warps and known batch shifts in a two-dimensional grid, so the cross-talk between registration error and batch correction can be measured rather than argued about. The claim is falsifiable. Under this factorization, registration accuracy should stay flat as batch shift grows, and batch-mixing quality should stay flat as warp grows. Existing sequential and discrete-matching pipelines should degrade along both axes.
Core Claim
Registration error and batch shift are statistically confounded only when a method lets either explanation absorb any discrepancy. If each is given the structure its physical source implies, the two become separable over a wide and measurable range of conditions. Deformation acts on coordinates through a smooth map $\phi$. Batch acts on features through a map $g_c$ that depends on cell type $c$ but not on position. The separation breaks down in a specific, predictable case: when the batch effect is itself spatially structured, such as a gradient across the capture area. The proposal treats that case as a failure condition to be tested, not hidden.
Concretely, for slices $A$ and $B$ with latent expression embeddings $z_A(\cdot)$ and $z_B(\cdot)$ from a shared encoder, we solve
$$\min_{\phi,\,g,\,w}\ \sum_{x \in B} w(x)\,\big\| z_B(x) - g_{c(x)}\big(z_A(\phi(x))\big)\big\|^2 + \lambda\,R(\phi) + \mu \sum_c \|g_c - \mathrm{id}\|^2 + \nu\,\Omega(w).$$
Here $x$ ranges over spot locations in slice $B$. The deformation $\phi$ maps $B$'s coordinates into $A$'s. It is parameterized as an affine transform plus a diffeomorphic (smooth, invertible) displacement field, with smoothness penalty $R$. Each $g_c$ is an affine map in latent space applied to soft cell-type assignment $c(x)$, and it has no dependence on $x$. The weight $w(x)\in[0,1]$ marks whether location $x$ has a true counterpart at all, and $\Omega$ keeps $w$ from collapsing to zero. The weights $\lambda,\mu,\nu$ trade these terms off. The $w$ term matters because slices far apart genuinely differ: vessels branch and layers end. Forcing every location into correspondence is exactly the distortion JADE's file entry flags at 300 µm gaps.
Relation to Prior Work
Two papers motivate this proposal by showing the coupling is real. JADE names the cyclic dependency directly: alignment errors corrupt embeddings and batch effects misguide alignment. It answers with a feedback loop between a graph network embedding and an attention-weighted optimal-transport matching between spots. We keep its insight that the two problems must be solved together. We differ in two ways. JADE outputs a discrete spot-to-spot assignment rather than a continuous physical deformation. And its gene attention down-weights noisy genes without encoding why a discrepancy should be attributed to batch rather than to position. STaCker does produce a continuous elastic field, from a U-Net trained only on synthetic Simplex-noise warps. But it registers contour maps drawn from expression niches clustered beforehand, so any batch distortion in that clustering is frozen into the target. We borrow its synthetic-warp generator for our stress test, and we replace its one-way cluster-then-register pipeline with joint estimation.
Two papers supply method pieces we reuse or contrast against. Effortless Landmark Detection fits thin-plate splines guided by a network and scored with multi-scale structural similarity, which tolerates intensity and stain differences. Its authors' setting assumes anatomy is preserved across slices, so structural similarity cannot tell a stain artifact from a real anatomical change. Our $w(x)$ term and position-independent $g$ are aimed at that gap. Higher-order Spatial Accuracy in Diffeomorphic Image Registration supplies the smooth invertible field parameterization we would use for $\phi$.
Two lines of work constrain the design. Towards Spatial Transcriptomics-guided Pathological Image Recognition with Batch-Agnostic Encoder shows that batch-correcting genes with scVI/scANVI before contrastive pairing with H&E raises macro-F1 from 0.084 for BLEEP to 0.354. It assumes the image-to-spot registration given by slide fiducials is exact, which we do not. The foundation-model audits rule out a shortcut we might otherwise take. Frozen pathology encoders predict tissue source site at over 90% accuracy on TCGA-LUSC-5 even after stain normalization (Do Histopathological Foundation Models Eliminate Batch Effects?). Brain foundation model embeddings carry a site effect of Pseudo-F 717.35 against 0.15 for diagnosis (Batch Effects In Brain Foundation Model Embeddings). Matching slices in such embedding spaces would invite registration to align batch signatures. We therefore estimate $g$ explicitly instead of trusting a pretrained space to be batch-free.
Research Program
The work has three parts, and the first stands on its own even if the method disappoints.
Coupled stress test. We take real slices from the human dorsolateral prefrontal cortex (DLPFC) Visium set and the mouse brain multi-platform set (Visium, MERFISH, Xenium). We duplicate each slice and apply two perturbations to the copy:
- a known non-rigid warp drawn from STaCker-style Simplex displacement fields, at graded magnitudes;
- a known batch perturbation at graded strength, combining per-gene scaling that depends on cell type, reduced library depth, and extra dropout.
Every cell of the resulting grid has ground truth for both the deformation and the batch map. We add one deliberately adversarial column in which the batch perturbation varies smoothly across the slide. This is where our model should fail. Before any method is involved, the grid lets us measure two kinds of cross-talk:
- how much batch-correction quality degrades when the only perturbation is a warp;
- how much registration error grows when the only perturbation is a batch shift.
Method. We implement the objective above with alternating updates:
- a shared encoder, initialized from scVI-style training on all slices;
- $\phi$ fit by gradient descent from a coarse affine start, using a multi-start rotation search to address the orientation sensitivity reported for ELD;
- $g_c$ fit in closed form as affine least squares given $\phi$;
- $w$ fit with an unbalanced-matching relaxation.
For multi-slice stacks, pairwise fields are composed. One lower-weighted term ties the encoder to the corrected correspondences, so that embeddings, like JADE's, improve as alignment improves.
Real-data evaluation. We run the method on all 12 DLPFC slices, using both adjacent and roughly 300 µm-separated pairs, on the cross-platform mouse brain pairs, and on the Stereo-seq axolotl brain series.
Baselines
The naive reference point is rigid or affine alignment with no batch correction. We report it so every gain has a floor. Above it sits the standard sequential pipeline in both orders: scVI followed by STaCker registration, and STaCker registration followed by scVI on the aligned slices. It runs on the same highly variable gene set, preprocessing and encoder size as our model. Its hyperparameters get the same search budget we give ourselves, measured in configurations tried on a held-out DLPFC pair. Beating it means lower ground-truth warp error and higher batch-mixing on the stress grid at matched biology preservation.
The strongest existing competitor is JADE, because it is the only published method that already couples alignment and embedding on exactly these datasets. JADE reports a median adjusted Rand index of about 0.61–0.65 for layer clustering on DLPFC, against 0.58 for GraphST and 0.52 for STAGATE. It reports an iLISI batch-mixing score of 1.98 out of a perfect 2.0. It also reports more than 50% better alignment accuracy than PASTE on 300 µm gaps, though only as a relative margin (JADE). We will run JADE with its released settings, plus the same tuning budget as ours, on identical slice pairs. Its iLISI is already near ceiling, so beating JADE cannot mean higher mixing. It must mean three things:
- matching its layer ARI within its reported range;
- lower layer-label transfer error after registration;
- substantially flatter degradation across the stress grid, especially along the batch-strength axis, where its gene attention has no structural guarantee.
For STaCker, the file reports a 2.7- to 25-fold MSE reduction relative to unaligned input on synthetic warps, but no absolute baseline numbers. We will rerun it rather than quote it.
Three ablations isolate the key ingredient:
- removing $g$ entirely, so deformation must explain everything;
- letting $g$ vary smoothly with position, so batch can explain everything and identifiability should collapse;
- replacing joint fitting with two rounds of naive alternation between scVI and STaCker.
If the second ablation does as well as the full model, the position-independence principle is not doing the work, and the claim fails.
Why not just…?
Why not just batch-correct first, then register? This is the most natural pipeline and it may be adequate when batch shift is mild. The file's evidence against it is indirect. JADE reports large margins over PASTE on wide gaps. And ComBat applied after the fact to brain embeddings left biological decoding weak (Batch Effects In Brain Foundation Model Embeddings), with post-ComBat ALFF $R^2$ of 0.115 and 0.061. Neither is a direct test, so we treat this alternative as a real threat. The stress grid settles it: if both orders of the sequential pipeline stay flat along both axes, our joint model adds nothing and we will say so.
Why not just register on morphology, using H&E or DAPI, and ignore expression? When a clean, high-contrast image accompanies every slice, this may honestly be enough, and ELD-style structural-similarity registration is a strong option. Morphology registration helps least in three regimes: cross-platform pairs where image channels differ, DAPI-only data with weak structure, and wide gaps where anatomy changes. Stain variation is also itself a batch effect that normalization only partly removes (Do Histopathological Foundation Models Eliminate Batch Effects?). We include ELD on the image channel as a baseline and report, regime by regime, where it matches us. We expect it to do so on adjacent Visium H&E pairs.
Why not just use JADE, which is already joint? JADE is joint but leaves the attribution question to learned attention. Nothing stops it from explaining a cell-type-specific batch shift by reassigning spots. It also gives no physical field that can be composed into a 3D coordinate frame. The batch-strength axis of the stress grid is the direct test. If JADE's spot assignments stay accurate under strong injected batch shift, our structural assumption is unnecessary for matching, and our remaining contribution reduces to producing a continuous field.
Why not just match slices in foundation-model embeddings? The cited audits show these spaces encode site more strongly than biology, with site prediction around 85–94% for brain models and above 90% for pathology. Matching in them risks aligning batch signatures. We include a CONCH-feature registration run on H&E slices as a cautionary baseline rather than a serious contender.
Proposed Experiments
Primary experiment. We run the full stress grid on DLPFC and mouse brain slices, using five warp magnitudes, five batch strengths and the spatially structured batch column. For every method we report three outcomes:
- warp error, as mean endpoint distance from the true field over tissue spots;
- batch-mixing, as iLISI;
- biology preservation, as layer or cell-type separation in the corrected latent space.
The decisive check is the shape of these surfaces. Our claim predicts error that stays near-constant along the batch axis and mixing that stays near-constant along the warp axis. The sequential pipelines should show slopes along both axes. Our model should show a clear failure in the spatially structured batch column, and the absence of that failure would make us suspect leakage in the evaluation.
Real-data experiment. On the 12 annotated DLPFC slices we cannot know the true warp, so we measure registration through two proxies:
- layer-label transfer accuracy, which carries one slice's manual layer labels through $\phi$ to its neighbor;
- distance between corresponding layer boundaries after alignment.
These are reported separately for adjacent and roughly 300 µm-separated pairs, and alongside clustering ARI for comparison with JADE's reported 0.61–0.65. On the cross-platform mouse brain pairs we report the same quantities between platforms, where batch shift is largest. The question here is whether the estimated $g_c$ maps recover known platform differences, such as depth and gene-panel dropout, rather than absorbing anatomy.
Diagnostic of the reverse leak. We run spatially aware batch correction on pairs perturbed only by warp and measure how much spurious batch effect each method reports. This puts a number on how often misregistration masquerades as batch, which no paper in the file has measured. The quantity is worth publishing even if the joint model's gains turn out to be modest.
References
- JADE: Joint Alignment and Deep Embedding for Multi-Slice Spatial Transcriptomics
- Image guided construction of a common coordinate framework for spatial transcriptome data
- Spatial landmark detection and tissue registration with deep learning
- Higher-order Spatial Accuracy in Diffeomorphic Image Registration
- Towards Spatial Transcriptomics-Guided Pathological Image Recognition with Batch-Agnostic Encoder
- Do Histopathological Foundation Models Eliminate Batch Effects? A Comparative Study
- Batch Effects In Brain Foundation Model Embeddings