arXiv:2610.26217cs.CVOct 2026

Manuscript Offprint

arXiv:2610.26217

SAR2Net: Learning Spatially Anchored Representations for Retrieval-Guided Cross-Stain Alignment

Tianle Shen, Fang Yan, Xiaofan Zhang

Abstract

Achieving spatial alignment between whole-slide images (WSIs) across stains is essential for integrating morphology and molecular information, yet it remains challenging due to extreme resolution, tissue fragmentation, and large nonlinear deformations. Conventional registration pipelines depend on global pre-alignment and spatial consistency, which often collapse under such distortions. We present SAR2Net, a framework that learns spatially anchored representations and reformulates cross-stain alignment as a region-level feature retrieval problem. Instead of estimating explicit transformations, SAR2Net learns pointwise representations encoding the relative spatial relationships to tissue landmarks. Given landmarks and arbitrary coordinates, it predicts spatially anchored features that serve as deformation-invariant descriptors of tissue topology. A two-stage retrieval framework then establishes correspondences between slides, even when global alignment is infeasible. Experiments on biopsy-oriented HE-IHC datasets show that SAR2Net achieves robust region-level alignment under severe tissue distortions, outperforming previous methods. Code is available at https://github.com/Shentl/SAR2Net.

1. Introduction

Histopathological examination is the gold standard for cancer diagnosis [6]. In pathology, tissue sections are stained using different dyes to reveal complementary biological information. Hematoxylin and eosin (HE) staining highlights tissue morphology, while immunohistochemistry (IHC) staining exposes molecular expression patterns. To jointly interpret morphological and molecular information, HE and IHC slides are typically prepared from adjacent sections of the same tissue, motivating the problem of cross-stain correspondence in computational pathology.

Most existing approaches treat this problem as an image registration task, aiming to estimate a spatial transformation that aligns one slide with another. Given the gigapixel scale

Figure

Figure 1. Examples of biopsy slides. (A.1-A.2) HE and IHC slides of a core needle biopsy with tissue fractures and bending. (B.1-B.2) slides of a forceps biopsy with inter-block displacement.

and stain heterogeneity of WSIs, registration is often performed in a multi-stage process, starting with coarse alignment at low magnification, followed by non-rigid refinement at higher resolutions. The methods typically rely on intensity-based optimization of similarity metrics (e.g. MI, NCC, NGF), or feature descriptors matching. Recent works combine both strategies in hybrid pipelines [11, 29], while others employ neural networks to directly predict transformation parameters [25, 28]. Such methods with hierarchical designs perform well when a consistent global correspondence exists between slides.

However, all these methods rely on the assumption that a coarse pre-alignment can be successfully established first. This assumption often breaks down in histopathological slides with fragmented or heavily deformed tissue structures. In many biopsy-derived WSIs, tissues appear as multiple disconnected fragments or elongated strips that undergo bending, tearing, or nonlinear distortion during sectioning. As shown in Fig. 1, adjacent HE–IHC slides of such samples frequently exhibit inconsistent spatial layouts, missing regions, or non-overlapping tissue parts, making global alignment unreliable. These complex structural discontinuities are common [1] in real-world pathology data.

*Corresponding author: xiaofan.zhang@sjtu.edu.cn but are rarely represented in existing benchmarks. When large portions of tissue cannot be coarsely aligned, conventional registration pipelines typically collapse, yielding unstable or meaningless correspondences.

Interestingly, even when global alignment fails, local spatial relations often remain consistent within limited neighborhoods. Points that are close in the tissue tend to preserve their relative configuration despite large-scale deformation or tearing. This observation suggests that correspondence can be established by modeling point-wise relationships to nearby landmarks, rather than estimating a single global transformation. Furthermore, coarse region-level retrieval followed by local refinement allows the system to progressively narrow down corresponding areas, even under severe deformation.

Motivated by these insights, we introduce SAR2Net, a retrieval-guided framework that models geometric correspondence through learned spatial representations rather than explicit transformation prediction. SAR2Net encodes each point's relative geometry with respect to automatically detected landmarks, which are treated as spatial anchors, forming representations that remain consistent across large cross-stain variations. Trained via contrastive learning on simulated coordinates without any image supervision, SAR2Net, coupled with a retrieval guided alignment pipeline, achieves robust region-level correspondence even under extreme deformations or tissue fragmentation, without requiring any pre-alignment.

Our contributions are threefold: (1) We introduce SAR2Net, a network that models local geometric relations between spatial anchors and query points. The spatially anchored representations generated by SAR2Net achieve strong cross-stain robustness. (2) We develop a two-stage retrieval pipeline that can establish region-level correspondences under extreme tissue distortion or fragment misalignment. (3) We demonstrate state-of-the-art performance on a biopsy-oriented cross-stain dataset, achieving reliable alignment in cases where traditional registration fails.

References (32)