A gastric cancer whole section epithelial gland segmentation method and device across staining prototype migration and ROI constraint

CN122966946APending Publication Date: 2026-10-23YUNNAN CANCER HOSPITAL (THE THIRD AFFILIATED HOSPITAL OF KUNMING MEDICAL UNIV)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610865982.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-16
Publication Date
2026-10-23

AI Technical Summary

Benefits of technology

1、显著提升分割精度。本申请通过跨染色原型迁移获得高质量ROI伪标签,结合螺旋块编码的全局分支与残差局部分支构成的双分支分割网络,以及ROI掩膜引导的门控融合机制,在弱监督条件下实现了上皮腺体的高精度分割。实验结果表明,在相同验证条件下,本申请的Dice系数达到0.6926,mIoU达到0.5298,分别较现有代表性方法(如TransUNet)相对提升约12.8%和19.6%,HD95和ASD等边界误差指标也显著降低,证明本发明在腺体区域覆盖完整性、轮廓连续性以及边界定位精度方面均具有明显优势。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122966946A_ABST
    Figure CN122966946A_ABST
Patent Text Reader

Abstract

The application discloses a gastric cancer whole-section epithelial gland segmentation method and device based on cross-staining prototype migration and ROI constraint. In the training stage, paired H&E and CK staining images that are completely aligned in space are obtained, and paired image blocks are extracted in the tissue region; pathological basic models are used to extract H&E and CK image block features respectively, CK features are clustered to construct epithelial positive prototypes and non-epithelial negative prototypes, and prototype labels are migrated to corresponding H&E image blocks to train an ROI classifier; meanwhile, a weakly supervised pseudo mask is generated according to the CK image, and an ROI constraint segmentation network including a spiral block encoding global branch and a convolution residual local branch is constructed to perform training. In the inference stage, only an H&E full field of view slice needs to be input, an ROI heat map and a mask are generated through the ROI classifier, segmentation is performed on windows that meet the coverage condition, and an epithelial gland segmentation result is output after fusion. The application does not require pixel-level manual annotation, can reduce the calculation amount of irrelevant regions, and significantly improves the accuracy and efficiency of epithelial gland segmentation in gastric cancer pathological images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical image processing technology, specifically to a method and apparatus for segmenting epithelial gland structures in a full-view slice image of gastric cancer based on cross-chromosome migration and ROI constraints. Background Technology

[0002] Pathological diagnosis of gastric cancer primarily relies on Hematoxylin and eosin (H&E) stained sections. Accurate segmentation of epithelial and glandular structures is of great value for tumor microenvironment analysis, quantitative morphological assessment, and intelligent assisted diagnosis. However, in H&E full-field images, there are often problems such as insufficient contrast between epithelial and stromal regions, severe glandular adhesion, and strong tissue morphological heterogeneity, making it difficult to achieve accurate segmentation of epithelial glands using H&E images alone.

[0003] Cytokeratin (CK) immunohistochemical staining can clearly identify epithelial regions and provide structural priors for H&E images. In existing technologies, some methods attempt to use paired CK-stained images as supervisory signals to train H&E segmentation models, but these methods typically suffer from the following problems: directly using CK images as inference input increases staining costs and clinical deployment complexity; relying on pixel-level manual annotation to build H&E segmentation models requires significant expert resources, making large-scale application difficult; and registration errors often exist when using adjacent or non-homologous slices. This invention uses CK images obtained by decolorizing and re-staining the same physical slice, thus eliminating the need for registration. Summary of the Invention

[0004] The purpose of this invention is to provide a method and apparatus for segmenting epithelial glands in whole sections of gastric cancer based on cross-chromosome migration and ROI constraints, addressing the aforementioned problems.

[0005] The technical solution of the present invention is as follows: A method for segmenting epithelial glands in whole gastric cancer sections based on cross-chromoprototype migration and ROI constraints includes the following steps: Obtain paired H&E staining full-view slice images and CK staining full-view slice images. The CK staining image is obtained by decolorizing and re-staining the corresponding H&E staining image. The two are spatially perfectly aligned. Tissue region detection is performed on paired images, and paired image patches are extracted within the tissue mask area; H&E image patch features and CK image patch features were extracted separately. The CK features were clustered to construct a prototype set. Based on the DAB staining intensity of the corresponding CK image patch, the prototypes were divided into an epithelial positive prototype set and a non-epithelial negative prototype set. The prototype category of the CK image patch is transferred to the paired H&E image patch to generate pseudo-labels for the H&E image patch, and the pseudo-labels are used to train the ROI classifier. Generate ROI heatmaps and ROI masks at the full field-of-view slice scale based on the ROI classifier; Generating weakly supervised pseudomasks based on CK-stained images; A ROI-constrained segmentation network is constructed, which includes a global branch of spiral block coding and a local branch of convolutional residuals. The network is trained using H&E image windows filtered by ROI masks and corresponding pseudo-masks. During the inference phase, only H&E-stained full-view slice images are input to generate ROI masks. Segmentation is performed on windows that meet the ROI coverage conditions, and the prediction results of overlapping windows are fused to obtain the full-view epithelial gland segmentation results.

[0006] By acquiring naturally spatially aligned paired H&E and CK stained images, the adverse effects of traditional cross-slice registration errors on supervised transfer are fundamentally avoided, ensuring the accuracy of the supervised signal. Based on this, positive and negative prototypes are constructed through CK feature clustering, and the prototype categories are transferred to H&E image patches. This automatically generates high-quality ROI pseudo-labels for H&E image patches without requiring pixel-level manual annotation, significantly reducing data annotation costs. Simultaneously, this method utilizes CK images to generate weakly supervised pseudo-masks during the training phase. During the inference phase, only conventional H&E stained full-view slice images are required as input, eliminating the need for additional CK staining. This aligns with the standard clinical pathology diagnostic process, reducing staining costs and deployment complexity. Furthermore, the ROI mask efficiently filters full-view slices, significantly reducing the involvement of irrelevant backgrounds and non-epithelial regions in subsequent pixel-level segmentation calculations, effectively addressing the problem of high computational load in full-view slice inference. Finally, the design of a dual-branch segmentation network significantly improves the accuracy of epithelial gland segmentation in H&E images, overcoming the difficulties of low contrast and strong gland morphological heterogeneity inherent in traditional H&E images.

[0007] Furthermore, the spiral block encoding is used to enhance the segmentation network's ability to model glandular ring or centripetal structures, specifically including: The input image patch is divided into a two-dimensional patch grid; the center position of the patch grid is used as the starting position; the patch tokens are rearranged in a spiral order that expands outward from the center to form the input sequence for Transformer encoding; Among them, the The ring patch set is represented as: ,in Indicates the first Tokens for each location, Centered on; Spiral sort sequence is denoted as Then the input sequence for the global branch is constructed as follows: In the formula For category tokens, For position encoding, This represents the patch embedding result of the image patch.

[0008] The proposed spiral block encoding method is specifically designed for the unique ring-shaped or centripetal structure of gastric cancer epithelial glands. Unlike conventional raster or serpentine scanning, this method starts from the center of the image patch and rearranges each patch token in a spiral order expanding outward from the center, thereby constructing a Transformer input sequence adapted to the gland's topology. This encoding method allows adjacent sequence positions to better correspond to the anatomical relationship of the gland's radial expansion from the center to the edge, significantly enhancing the Transformer model's ability to model the overall contour continuity and ring structure integrity of the gland. Experiments demonstrate that this encoding method can effectively reduce structural breaks and voids in gland segmentation results, improving the overall consistency of segmentation.

[0009] Furthermore, the ROI-constrained segmentation network adaptively fuses gland topology features extracted from global branches with high-resolution boundary detail features extracted from local branches through a gated fusion module; the gated fusion module is represented as follows: Computational spatial gating weights Based on this weight, the local features are weighted and then concatenated with the global features to obtain the fused features. ; in For global branch features, This represents the local branching feature after channel compression. For upsampling operation, For the Sigmoid function, For learnable convolutional kernels, This represents the convolution operation. Indicates channel splicing. This indicates element-wise multiplication.

[0010] The designed gated fusion module adaptively fuses glandular topological features extracted from global branches with high-resolution boundary detail features extracted from local branches. Specifically, the module first generates spatial gate weights based on the upsampled global features and the channel-compressed local features through convolution and the sigmoid function. These weights are then used to weight the local features element-wise, and finally, the local features are concatenated with the global features. This fusion mechanism dynamically adjusts the contribution ratio of global semantic information and local detail information according to the actual needs of different locations in the image. This ensures that the segmentation result maintains the overall structural coherence of the glandular region while restoring fine boundary contours, thus balancing segmentation integrity and edge accuracy under weak supervision.

[0011] Furthermore, the ROI mask and the gating fusion module constitute a two-level progressive collaborative constraint mechanism: The ROI mask filters out candidate regions with a high probability of containing epithelial glands at the window level, excluding irrelevant background. The gated fusion module performs feature fusion within the candidate window selected by the ROI mask, so that the gland topological semantics extracted from the global branch guides the local branch features to enhance the response in the ROI region and suppress the response in the non-target background region, thereby improving the overall structural integrity and boundary detail accuracy of the segmentation under weak supervision.

[0012] Instead of a simple series of independent modules, the ROI mask and gating fusion module are constructed as a two-stage progressive collaborative constraint mechanism. In the first stage, the ROI mask efficiently filters the entire field of view at the window level, retaining only candidate regions with a high probability of containing epithelial glands into the segmentation network, significantly eliminating interference from irrelevant background and mesenchymal regions and reducing computational redundancy. In the second stage, the gating fusion module performs feature-level modulation within the candidate window defined by the ROI mask. It utilizes the gland topological semantic features extracted from the global branch to guide the boundary details of local branches to obtain enhanced responses within the ROI region, while effectively suppressing them in non-target background regions. This two-stage collaborative design of "coarse screening followed by fine tuning" allows the segmentation network to concentrate limited computational resources on high-value regions and achieve deep fusion of global structure and local details at the feature level, ultimately achieving segmentation results superior to simple combinations of modules under weak supervision.

[0013] Furthermore, the prototype category transfer and ROI classifier training specifically include: Calculate the Euclidean distance between the features of each CK image patch and each prototype, and assign it the nearest prototype. The positive or negative category to which the prototype belongs is used as a pseudo-label for the paired H&E image patch: but ,otherwise , ; A ROI classifier is trained based on H&E image patch features and the pseudo-labels, using weighted cross-entropy loss. Optimization was carried out, including The epithelial probability is the output of the classifier. For classifier parameters, This is the weight decay coefficient.

[0014] The proposed prototype category transfer and ROI classifier training method provides a technical path for transferring epithelial priors from CK images to H&E images without manual annotation. Specifically, by calculating the Euclidean distance between the features of each CK image patch and each prototype, the nearest prototype is automatically assigned to each CK image patch, and its positive and negative classes are used as pseudo-labels for the corresponding H&E image patches. Subsequently, an ROI classifier is trained based on the H&E image patch features and these pseudo-labels, and optimized using a weighted cross-entropy loss function. This method effectively addresses the class imbalance problem between epithelial and non-epithelial regions, resulting in a trained ROI classifier with high classification accuracy and sensitivity at the image patch level (experiments show 95.13% accuracy and 93.23% sensitivity). The resulting ROI heatmap provides high-recall candidate regions for subsequent pixel-level segmentation, ensuring the reliability of the supervised signal transfer.

[0015] Furthermore, the specific steps of performing segmentation and result fusion on windows that meet the ROI coverage condition include: According to the ROI mask Calculate candidate window ROI coverage ;when Not less than the preset threshold When the H&E image window is in the specified position, it is input into the segmentation model; otherwise, the window is skipped to reduce redundant calculations. The segmentation results of overlapping windows are fused using a cumulative counting average method, with the cumulative matrix set as follows: The counting matrix is Then the full field of view probability map Final segmentation result ,in To prevent tiny constants with a denominator of zero.

[0016] The proposed ROI coverage screening and segmentation result fusion method achieves a good balance between computational efficiency and segmentation accuracy during the inference stage. Specifically, the epithelial region coverage within each candidate window is calculated based on the ROI mask. A window is only sent to the segmentation network if its coverage is not less than a preset threshold; otherwise, it is skipped, effectively avoiding redundant pixel-level predictions in irrelevant background areas. Experiments show that, while maintaining a 98.0% ROI recall rate, the downstream segmentation network only needs to process approximately 45.17% of the tissue region area, significantly reducing the time and memory consumption of full-view inference. For the prediction results of overlapping windows, a cumulative count averaging method is used for seamless stitching, and then combined with the ROI mask to output the final binary segmentation result, ensuring the continuity of the full-view segmentation results and smooth transitions at boundaries.

[0017] Furthermore, the generation of the weakly supervised pseudomask specifically includes: converting the CK-stained image to the HED color space to extract the DAB channel, where the DAB channel reflects the CK-stained positive region; and obtaining the initial mask by combining DAB channel thresholding and CIELAB color constraints. ,in For DAB channel values, The blue and yellow components in the CIELAB color space. , The preset threshold is used; then morphological post-processing is performed. The final pseudomask is obtained, and the morphological post-processing includes at least one of opening operation, closing operation, hole filling and small connected region removal to reduce the impact of CK staining noise on the pseudomask quality.

[0018] The proposed weakly supervised pseudomask generation method achieves automatic and stable extraction of pixel-level supervision signals from CK-stained images. This method first converts the CK image to the HED color space to extract the DAB channel representing CK positivity. Then, it combines DAB channel thresholding and blue-yellow component constraints in the CIELAB color space to obtain an initial pseudomask. Compared to single thresholding, introducing color constraints effectively eliminates interference from non-specific staining and background noise. Finally, morphological post-processing operations such as opening, closing, hole filling, and small connected component removal are used to obtain a high-quality final pseudomask. The entire process requires no manual pixel-level annotation, providing reliable supervision signals for subsequent segmentation network training and significantly reducing the data preparation cost for model training.

[0019] Furthermore, the clustering of CK features adopts K-means clustering with K=2 clusters; the division of prototypes based on DAB staining intensity includes: statistically analyzing the average DAB optical density value of the CK image blocks corresponding to each cluster, taking the clusters with high average optical density values ​​as the epithelial positive prototype set and the low ones as the non-epithelial negative prototype set, thereby automatically distinguishing the prototype representations of epithelial and non-epithelial regions.

[0020] K-means clustering (K=2) was used to cluster the features of CK image patches. The clusters were automatically divided into epithelial positive prototype sets and non-epithelial negative prototype sets by statistically analyzing the average DAB optical density values ​​of the corresponding CK image patches. The advantages of this method are: first, the clustering process requires no prior labels and is entirely data-driven, adapting to differences in different staining batches and samples; second, the use of DAB optical density values ​​as an objective quantitative indicator for positive and negative discrimination avoids the arbitrariness of subjective threshold settings; and finally, the binary classification setting naturally matches the task of binary discrimination between epithelial and non-epithelial cells, simplifying the prototype construction process while ensuring the accuracy and robustness of prototype category classification.

[0021] Furthermore, the segmentation network is trained using a weighted sum of cross-entropy loss and Dice loss to simultaneously optimize pixel-level classification accuracy and region overlap. , in , The focus is on optimizing the overall structure of the glandular region by emphasizing Dice loss.

[0022] The weighted sum of cross-entropy loss and Dice loss is used as the optimization objective of the segmentation network, with the weight of Dice loss set to 0.8 and the weight of cross-entropy loss set to 0.2. This loss function configuration takes into account two evaluation dimensions: pixel-level classification accuracy and region-level overlap. Cross-entropy loss focuses on the independent classification accuracy of each pixel, which helps the model converge quickly; Dice loss directly optimizes the overlap between the predicted and ground truth regions, showing good robustness to class imbalance and focusing more on the overall structure of the gland region. Giving Dice loss a higher weight makes the model focus more on the structural integrity and continuity of the gland region during training, thus achieving better segmentation performance under weak supervision (experimental Dice reaches 0.6926, significantly better than the comparison methods).

[0023] This application also includes a device for segmenting epithelial glands in whole gastric cancer sections based on cross-chromoprototype migration and ROI constraints, realizing a method for segmenting epithelial glands in whole gastric cancer sections based on cross-chromoprototype migration and ROI constraints, including: The data acquisition module is used to acquire paired H&E-stained full-field section images and CK-stained full-field section images, which are spatially perfectly aligned. The image patch extraction module is used to perform tissue region detection and extract paired image patches; The prototype building module is used to extract features from paired image patches, cluster CK features, and divide positive and negative prototype sets. The ROI induction module is used to transfer the prototype category to H&E image patches, generate pseudo-labels, and train the ROI classifier, outputting ROI heatmaps and ROI masks. The pseudomask generation module is used to generate a weakly supervised pseudomask based on the CK-stained image. The segmentation training module is used to construct a dual-branch segmentation network and train it using windows filtered by ROI masks and pseudo-masks. The inference fusion module is used to perform ROI coverage filtering and segmentation result fusion under H&E single staining input, and output the full-view epithelial gland segmentation result.

[0024] The provided segmentation device systematically integrates the key technology modules in the aforementioned method claims, including a data acquisition module, an image patch extraction module, a prototype construction module, a ROI induction module, a pseudomask generation module, a segmentation training module, and an inference fusion module. This device can fully automate the entire process from paired-stained image input to H&E single-stain inference output. The interfaces between modules are clearly designed and can be flexibly configured according to actual deployment needs (e.g., deployed in different processing units to work collaboratively through data interfaces). This device is particularly suitable for large-scale gastric cancer pathology image analysis scenarios in hospital pathology departments or third-party testing institutions, enabling efficient and accurate output of epithelial gland segmentation results without increasing additional staining costs and manual annotation burden, demonstrating promising prospects for engineering application.

[0025] Compared with existing technologies, the advantages of this invention are: 1. Significantly Improved Segmentation Accuracy. This application obtains high-quality ROI pseudo-labels through cross-chromosome transfer, combines a bi-branch segmentation network consisting of global branches of spiral block encoding and residual local branches, and employs a gated fusion mechanism guided by ROI masks to achieve high-precision segmentation of epithelial glands under weak supervision. Experimental results show that, under the same validation conditions, the Dice coefficient of this application reaches 0.6926, and the mIoU reaches 0.5298, representing improvements of approximately 12.8% and 19.6% respectively compared to existing representative methods (such as TransUNet). Boundary error indices such as HD95 and ASD are also significantly reduced, demonstrating that this invention has significant advantages in terms of glandular region coverage integrity, contour continuity, and boundary localization accuracy.

[0026] 2. No pixel-level manual annotation required, reducing annotation costs. This application only requires paired H&E and CK stained images. Positive and negative prototypes are constructed through CK feature clustering, and the prototype categories are transferred to H&E image patches to automatically generate ROI pseudo-labels. Simultaneously, pixel-level weakly supervised pseudo-masks are automatically generated based on DAB channel extraction and color constraints of the CK images. The entire process requires no pixel-level manual annotation, avoiding the time-consuming, labor-intensive, and subjective issues of expert annotation, and significantly reducing the data preparation cost for model training.

[0027] 3. Natural spatial alignment, avoiding registration errors. The CK staining images used in this application are obtained by decolorizing and re-staining the corresponding H&E staining images. Both originate from the same physical slice and are perfectly aligned spatially, eliminating the need for additional image registration steps. This fundamentally avoids registration errors caused by tissue deformation, scanning differences, and other factors in traditional cross-slice supervised migration methods, ensuring the accuracy of the supervised signal.

[0028] 4. Only H&E images are required during the inference stage, resulting in high computational efficiency. This application only requires input of conventional H&E-stained full-view slice images during the inference stage, eliminating the need for CK staining. This aligns with standard clinical pathology diagnostic procedures, reducing staining costs and deployment complexity. Simultaneously, an ROI mask is generated through an ROI classifier, performing pixel-level segmentation only on candidate windows that meet the coverage threshold, significantly reducing computational load on irrelevant background regions. Experiments show that while maintaining a 98.0% ROI recall rate, the downstream segmentation network only needs to process approximately 45.17% of the tissue area, significantly reducing full-view inference time and memory consumption, demonstrating good engineering deployment feasibility.

[0029] 5. Unexpected technical effects from collaborative design. The ROI constraint and bi-branch segmentation network in this application are not simply superimposed, but rather form a two-level collaborative mechanism of "window-level filtering" and "feature-level modulation": the ROI mask narrows the search range at the window level, and the gated fusion module further utilizes the ROI mask to guide global topological features to adaptively weight local detail features, enhancing glandular structure response and suppressing interstitial noise within the ROI. This collaborative design enables the segmentation network to focus on learning high-value regions, simultaneously ensuring overall structural continuity and boundary detail accuracy under weak supervision, achieving technical results superior to simple combinations of individual modules. Attached Figure Description

[0030] Figure 1 This is a flowchart illustrating the method described in this application.

[0031] Figure 2 This is a schematic diagram of the ROI-induced process based on cross-chromosome migration.

[0032] Figure 3This is a schematic diagram of the process for generating a weakly supervised pseudomask based on CK-stained images.

[0033] Figure 4 A schematic diagram of a dual-branch split network structure constrained by ROI.

[0034] Figure 5 This is a schematic diagram of the H&E single-color inference and full-view result output process.

[0035] Figure 6 This is a schematic diagram of the module structure of the device in this application.

[0036] Figure 7 This is a comparison of the segmentation results of this application on a representative full-view slice. Detailed Implementation

[0037] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0038] The features and performance of the present invention will be further described in detail below with reference to embodiments.

[0039] Please see Figure 1-7 A method for segmenting epithelial glands in whole gastric cancer sections using cross-chromoprototype migration and ROI constraints, such as... Figure 1 As shown, it includes the following steps: Training phase: Obtain paired H&E stained full-field section images and CK stained full-field section images, wherein the CK stained full-field section image is obtained by decolorizing and re-staining the corresponding H&E stained full-field section image, so the two are perfectly aligned in space. Tissue regions are detected on paired slices, blank backgrounds are removed, and tissue masks are obtained. Extract ROI image patches and segmented image patches within the tissue mask area to establish paired training samples; H&E and CK features were extracted from the paired ROI image patches respectively; Cluster the CK features to construct an epithelial positive prototype set and a non-epithelial negative prototype set; The positive and negative prototype categories are transferred to paired H&E ROI image patches to generate H&E ROI pseudo-labels and train an ROI classifier. The ROI classifier output is projected back onto the full-view slice to obtain the ROI heatmap and ROI mask. Pixel-level weakly supervised pseudomasks are generated based on CK images, and segmentation samples are selected based on ROI masks; Reasoning stage: During the training phase, CK-stained images are introduced to provide epithelial priors and weakly supervised masks. A ROI-constrained bi-branch segmentation network is constructed, and H&E segmentation image patches and pseudo-masks are used for training to balance the training supervision strength and the feasibility of actual deployment.

[0040] In the inference stage, the CK-stained image is no longer relied upon. Only the H&E-stained full-view slice image is input. First, a ROI mask is generated. Then, segmentation is performed only on windows that meet the ROI coverage conditions. Finally, the full-view segmentation results are stitched together.

[0041] Slice acquisition and tissue region localization: The training samples consist of paired stained images of the same tissue section. First, H&E stained full-field section images were acquired. Then, the same section was destained and re-stained with CK to obtain CK stained full-field section images that correspond one-to-one with the H&E stained full-field section images. Since the two stained images originate from the same physical section, they are perfectly aligned spatially, thus eliminating the need for additional registration steps.

[0042] First, the full-view slice image is previewed at low magnification or downsampled. Then, an initial mask for the tissue region is obtained using grayscale thresholding, color thresholding, or the Otsu adaptive thresholding method. For the initial mask, further hole filling, small connected component removal, edge smoothing, and opening / closing operations can be performed to obtain a more stable tissue mask. The tissue mask is used to constrain the extraction range of subsequent image patches, preventing a large amount of blank background from entering the training and inference process.

[0043] Image patch extraction and feature extraction: like Figure 2 As shown, within the effective organization area, ROI image blocks and segmentation image blocks are paired according to a preset sliding window. The image block size used for ROI identification can be set to 1024×1024, and the image block size used for segmentation can be set to 224×224. The sliding window step size can be set to be the same as or smaller than the image block side length, thereby ensuring coverage while controlling the overlap ratio of adjacent image blocks.

[0044] For the For each paired ROI image patch, H&E and CK features are extracted respectively: , in, This represents a pre-trained pathological feature extraction network. The pre-trained pathological feature extraction network can be any of the following: a basic pathological model, a pre-trained convolutional neural network, or a pre-trained visual Transformer. The feature dimension is 1024, and normalization is performed before entering the subsequent clustering and classification processes.

[0045] Prototype building: Clustering is performed on the CK features to obtain the prototype set: , in, Represents a set of prototypes. Indicates the first The prototype indexes corresponding to each CK feature. The clustering method used is K-means. It can be set to 2.

[0046] After obtaining the prototype set, the prototypes are divided into epithelial positive prototype set and non-epithelial negative prototype set based on the average DAB staining intensity of the corresponding CK image patches. Alternatively, prototypes can be classified as positive or negative based on the proportion of CK-positive areas, color density statistics, or expert prior thresholds.

[0047] ROI-induced: To transfer the CK-stained epithelial prior to the H&E image patch, the distance between each CK feature and its prototypes is first calculated, and the nearest prototype is assigned to it: , Then, the positive and negative categories to which the most recent prototype belongs are used as pseudo-labels for paired H&E image patches: , Subsequently, a ROI classifier was trained using H&E image patch features to obtain the probability that the corresponding image patch belongs to the epithelial region. The ROI classifier uses a multilayer perceptron and is optimized using weighted cross-entropy loss. , in, Indicates batch size, This represents the learnable parameters for ROI classification. The ROI classifier consists of an input layer, hidden layers, ReLU activation layers, Dropout layers, and an output layer; the number and width of the hidden layers can be adjusted according to the scale of the training data to balance classification performance and inference efficiency.

[0048] After training, the ROI classifier output is projected back onto the full-view slice network to obtain the ROI heatmap. Thresholding and morphological processing are then performed on the ROI heatmap to obtain the full-view ROI mask. The ROI threshold can be set to 0.5, and the ROI mask can also be dilated to preserve safe boundaries for subsequent pixel-level segmentation, thereby reducing the risk of missing edge epithelial regions.

[0049] Weakly supervised pseudomask generation: like Figure 3 As shown, a weakly supervised pseudomask is generated using CK-stained images, thereby avoiding pixel-level manual annotation for epithelial gland segmentation tasks.

[0050] First, the CK-stained image is converted to the HED color space, and the DAB channels are extracted; then, by combining DAB thresholding and CIELAB color constraints, an initial pseudomask is obtained. , in, Indicates the DAB channel. This represents the blue and yellow components in the CIELAB color space. and Both represent adaptive thresholds.

[0051] Then, through post-processing operations such as morphological opening and closing operations, hole filling, and small region removal, the final pseudomask is obtained: , in, This represents a morphological post-processing operator. Morphological post-processing includes at least one of the following operations: opening, closing, hole filling, small region removal, fragmented connected component removal, and boundary smoothing. These operations can reduce the impact of noise points and non-target staining in CK staining on the quality of the pseudomask.

[0052] ROI-constrained bi-branch segmentation network: like Figure 4 As shown, in order to maintain both the continuity of the overall gland structure and the accuracy of boundary details under weak supervision, this application constructs a ROI-constrained bi-branch segmentation network.

[0053] The global branch employs a Transformer-based coding structure and rearranges the image block sequence using a spiral block coding method to enhance the modeling ability of glandular ring or centripetal structures. The local branch uses a convolutional residual structure to preserve high-resolution local boundary information. The coding structure of the global branch can also be fed into a dilated spatial pyramid pooling module to further enhance multi-scale contextual representation capabilities. The local branch can be composed of several concatenated residual convolutional blocks to preserve local texture and edge details.

[0054] Suppose that the input segmented image block is divided into Patch blocks to form The nth Patch Token, i.e., the nth Patch Token The token for each position is Spiral block coding with center position Starting from the center, rearrange the tokens in a ring-by-ring order expanding outwards. The ring patch set can be represented as: , Then, the tokens on each ring are traversed in a preset clockwise or counterclockwise direction to obtain the spiral sequence. And construct the global branch input: , in, For category tokens, This represents the patch embedding result of the image patch. This represents positional encoding. Compared to the conventional row-by-row token sorting method, the spiral block encoding described above allows adjacent sequence positions to better correspond to the topological relationship of the gland extending from the center to the edge, thereby improving the modeling ability of the gland's contour continuity and the integrity of its ring structure.

[0055] During the decoding stage, global and local features are fused using a gated fusion module: , , in, Represents global branch features. This represents the local branching characteristics after channel compression. This represents the Sigmoid function. Represents convolution. Indicates channel splicing. This indicates element-wise multiplication.

[0056] The ROI mask first removes large irrelevant background and low-confidence regions during the sample selection phase, ensuring that candidate windows entering the dual-branch segmentation network are mainly concentrated within suspected epithelial regions. Building upon this, the gated fusion module further utilizes the topological semantics of the global branch output to adaptively modulate the boundary details of the local branch output. This enhances the local response within the ROI that is consistent with the glandular structure and suppresses interference from mesenteric textures, noise staining, and false boundaries. In other words, ROI constraints narrow the search range at the window level, while gated fusion optimizes the consistency between local details and the global topology at the feature level. Together, they improve segmentation stability and boundary accuracy under weak supervision.

[0057] The segmentation network is trained using a weighted sum of cross-entropy loss and Dice loss: , Weight It can be set to 0.2, weight It can be set to 0.8. In addition, boundary loss, FocalLoss, or Tversky Loss can be introduced as additional optimization objectives to further improve the segmentation quality of edge and small target regions.

[0058] Training process and parameter examples: The ROI classifier and segmentation network can be trained in stages. First, the ROI classifier is trained using H&E ROI pseudo-labels obtained from prototype transfer. Then, the segmentation network is trained by jointly constraining the CK pseudo-mask and the ROI mask.

[0059] The ROI classifier is trained using the Adam optimizer, and the learning rate can be set to... The weight decay can be set to The number of training epochs can be set to 50; the segmentation network is trained using the AdamW optimizer, and the learning rate can be set to... The weight decay can be set to The number of training rounds can be set to 100. Furthermore, a cosine annealing learning rate scheduling strategy can be employed, and the optimal model parameters can be selected based on the validation set performance.

[0060] The specific parameters above are merely examples and do not constitute a limitation on the scope of protection of this application. Without departing from the concept of this application, those skilled in the art can adjust the image size, number of clusters, threshold parameters, number of network layers, and loss weights.

[0061] H&E Single-Color Inference: like Figure 5 As shown, during the inference phase, this application only requires H&E-stained full-view slice images as input. First, a full-view ROI heatmap is generated using an ROI classifier, and then an ROI mask is formed; then, epithelial gland segmentation is performed only on candidate windows that meet the ROI coverage criteria.

[0062] For candidate windows Its ROI coverage is defined as: , in, Indicates the ROI mask. When Not less than the preset threshold If the condition is met, the corresponding window is sent to the segmentation network; otherwise, the window is skipped.

[0063] The prediction results of overlapping windows are stitched together using a cumulative count averaging method. Let... Represents the cumulative matrix. Let the counting matrix be represented, then the full field-of-view probability map is: , The final output mask is: , in, This represents a small constant to prevent the denominator from being zero. The probability map is then transformed into a final binary epithelial gland segmentation result through thresholding. Using this method, this application deploys a pixel-level segmentation model only within high-confidence ROI regions, which helps reduce full-view inference time and GPU memory consumption.

[0064] Comparison of proportions and effects: To further illustrate the technical effects of the technical solution in this application, comparative verification can be performed under the same data partitioning, the same training parameters, and the same weakly supervised pseudo-labels.

[0065] The quantitative results of comparing the method of this application with existing representative segmentation methods are shown in Table 1: Table 1. Quantitative comparison results between the method of this application and existing representative segmentation methods. Method Dice mIoU Precision Recall HD95 ASD U-Net 0.6026 0.4313 0.5520 0.6635 27.1276 8.1024 Attention U-Net 0.5673 0.3960 0.5300 0.6104 34.2502 8.6826 DeepLabV3+ 0.5864 0.4148 0.5614 0.6136 34.7117 9.0490 TransUNet 0.6141 0.4431 0.6060 0.6224 27.1321 10.6884 Swin-Unet 0.5602 0.3891 0.5119 0.6186 39.0980 10.5921 VM-UNet 0.5585 0.3874 0.5104 0.6165 36.2539 9.4657 VENet 0.6017 0.4303 0.5506 0.6632 27.4785 7.9906 Ours 0.6926 0.5298 0.6448 0.7481 24.1534 4.8430 As shown in Table 1, under the same validation conditions, the method of this application outperforms the listed comparison methods in terms of Dice, mIoU, Precision, Recall, HD95, and ASD. Specifically, the higher Dice and mIoU of the method of this application indicate superior performance in terms of overlap consistency and overall segmentation integrity in the epithelial gland region; the higher Precision and Recall indicate that it maintains high target detection capability while reducing false positives; and the lower HD95 and ASD indicate superior performance in terms of boundary localization accuracy, contour smoothness, and full-field segmentation stability. This further demonstrates that the collaborative design of cross-chromosomal prototype transfer, ROI constraint, and bi-branch fusion segmentation in this application can effectively improve the segmentation performance of epithelial glands in complex gastric cancer pathological images.

[0066] like Figure 7 As shown, the left side displays a representative full-view H&E slice image, while the right side shows a comparison of the full-view epithelial gland segmentation results for the corresponding sample. Combined with... Figure 7 The visualization results further show that the method of this application performs better in terms of epithelial region coverage integrity, gland contour continuity and scatter noise suppression. It can maintain relatively smooth boundaries under complex tissue morphology and weak contrast background conditions, and reduce holes, breaks and discrete false detection areas.

[0067] Furthermore, the effectiveness of ROI-inducing and ROI-constraining strategies can be verified. For example, the ROI classifier achieves 95.13% accuracy, 93.23% sensitivity, 96.26% specificity, and a ROC-AUC of 0.9860 at the image block level. While maintaining a 98.0% ROI recall, the downstream segmentation network only needs to process 45.17% of the tissue region area; while maintaining a 99.0% ROI recall, the downstream segmentation network only needs to process 53.76% of the tissue region area. These results demonstrate that the ROI-inducing module not only provides highly recalled candidate regions for subsequent segmentation but also significantly compresses the full-view search space requiring pixel-level prediction, thereby reducing the computational load of full-view inference and improving overall processing efficiency.

[0068] The comparative examples and performance verification results above demonstrate that this invention is not a simple superposition of existing network structures, but rather, through a collaborative design of spiral block encoding, ROI constraints, and gating fusion, it balances the continuity of the overall glandular structure, the ability to recover boundary details, and the efficiency of full-view inference under weak supervision. It should be noted that the above experimental data are only used to illustrate the beneficial technical effects that the technical solution of this invention can produce and do not constitute a limitation on the scope of protection of this application.

[0069] like Figure 6 As shown, this application also includes a device for segmenting epithelial glands in a full-field section of gastric cancer based on cross-chromosome migration and ROI constraints, comprising: The data acquisition module is used to acquire paired H&E stained full-field section images and CK stained full-field section images, wherein the CK stained full-field section image is obtained by decolorizing and re-staining the corresponding H&E stained full-field section image, so that the two are perfectly aligned in space. The image patch extraction module is used to perform tissue detection and extract paired ROI image patches and segmented image patches; A prototype building module is used to extract features from paired image patches and build positive and negative CK prototypes. The ROI induction module is used to generate H&E ROI pseudo-labels and train the ROI classifier; The pseudomask generation module is used to generate a weakly supervised pseudomask based on the CK-stained image. The segmentation training module is used to train a two-branch epithelial gland segmentation network based on ROI constraints; The inference fusion module is used to complete ROI selection, window-level segmentation, and full-view result stitching under H&E single-color input.

[0070] Furthermore, the tissue detection module, prototype construction module, ROI induction module, and segmentation training module can be integrated into the same software system as functional modules, or they can be deployed in different processing units and work together through data interfaces.

[0071] According to another aspect of this application, a computer-readable storage medium is also provided, wherein a computer program stored thereon is used to implement the steps in the above method embodiments when executed by a processor.

[0072] The embodiments described above merely illustrate specific implementation methods of this application, and while the descriptions are detailed and specific, they should not be construed as limiting the scope of protection of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the technical solution of this application, and these modifications and improvements all fall within the scope of protection of this application.

Claims

1. A method for segmenting epithelial glands in whole sections of gastric cancer based on cross-chromoprototype migration and ROI constraints, characterized in that, Includes the following steps: Obtain paired H&E staining full-view slice images and CK staining full-view slice images. The CK staining image is obtained by decolorizing and re-staining the corresponding H&E staining image. The two are spatially perfectly aligned. Tissue region detection is performed on paired images, and paired image patches are extracted within the tissue mask area; H&E image patch features and CK image patch features were extracted separately. The CK features were clustered to construct a prototype set. Based on the DAB staining intensity of the corresponding CK image patch, the prototypes were divided into an epithelial positive prototype set and a non-epithelial negative prototype set. The prototype category of the CK image patch is transferred to the paired H&E image patch to generate pseudo-labels for the H&E image patch, and the pseudo-labels are used to train the ROI classifier. Generate ROI heatmaps and ROI masks at the full field-of-view slice scale based on the ROI classifier; Generating weakly supervised pseudomasks based on CK-stained images; A ROI-constrained segmentation network is constructed, which includes a global branch of spiral block coding and a local branch of convolutional residuals. The network is trained using H&E image windows filtered by ROI masks and corresponding pseudo-masks. During the inference phase, only H&E-stained full-view slice images are input to generate ROI masks. Segmentation is performed on windows that meet the ROI coverage conditions, and the prediction results of overlapping windows are fused to obtain the full-view epithelial gland segmentation results.

2. The method for segmenting epithelial glands in whole sections of gastric cancer based on cross-chromoprototype migration and ROI constraints according to claim 1, characterized in that, The spiral block encoding is used to enhance the segmentation network's ability to model glandular ring or centripetal structures, specifically including: The input image patch is divided into a two-dimensional patch grid; the center position or the center neighborhood position of the patch grid is used as the starting position; the patch tokens are rearranged in a spiral order that expands outward from the center to form the input sequence for Transformer encoding. Among them, the The ring patch set is represented as: ,in Indicates the first Token for each location, The central location or the central neighborhood location; Spiral sort sequence is denoted as Then the input sequence for the global branch is constructed as follows: In the formula For category tokens, For position encoding, This represents the patch embedding result of the image patch.

3. The method for segmenting epithelial glands in whole gastric cancer sections based on cross-chromosome migration and ROI constraints according to claim 1, characterized in that, The ROI-constrained segmentation network adaptively fuses gland topology features extracted from global branches with high-resolution boundary detail features extracted from local branches through a gated fusion module; the gated fusion module is represented as follows: Computational spatial gating weights Based on this weight, the local features are weighted and then concatenated with the global features to obtain the fused features. ; in For global branch features, This represents the local branching feature after channel compression. For upsampling operation, For the Sigmoid function, For learnable convolutional kernels, This represents the convolution operation. Indicates channel splicing. This indicates element-wise multiplication.

4. The method for segmenting epithelial glands in whole gastric cancer sections based on cross-chromoprototype migration and ROI constraints according to claim 1, characterized in that, The ROI mask and gating fusion module constitute a two-level progressive collaborative constraint mechanism: The ROI mask filters out candidate regions with a high probability of containing epithelial glands at the window level, excluding irrelevant background. The gated fusion module performs feature fusion within the candidate window selected by the ROI mask, so that the gland topological semantics extracted from the global branch guides the local branch features to enhance the response in the ROI region and suppress the response in the non-target background region, thereby improving the overall structural integrity and boundary detail accuracy of the segmentation under weak supervision.

5. The method for segmenting epithelial glands in whole sections of gastric cancer based on cross-chromosome migration and ROI constraints according to claim 1, characterized in that, The prototype category transfer and ROI classifier training specifically include: Calculate the Euclidean distance between the features of each CK image patch and each prototype, and assign it the nearest prototype. The positive or negative category to which the prototype belongs is used as a pseudo-label for the paired H&E image patch: but ,otherwise , ; A ROI classifier is trained based on H&E image patch features and the pseudo-labels, using weighted cross-entropy loss. Optimization was carried out, including The epithelial probability is the output of the classifier. For classifier parameters, This is the weight decay coefficient.

6. The method for segmenting epithelial glands in whole sections of gastric cancer based on cross-chromoprototype migration and ROI constraints according to claim 1, characterized in that, The specific steps of performing segmentation and result fusion on windows that meet the ROI coverage condition include: According to the ROI mask Calculate candidate window ROI coverage ;when Not less than the preset threshold When the H&E image window is in the specified position, it is input into the segmentation model; otherwise, the window is skipped to reduce redundant calculations. The segmentation results of overlapping windows are fused using a cumulative counting average method, with the cumulative matrix set as follows: The counting matrix is Then the full field of view probability map Final segmentation result ,in To prevent tiny constants with a denominator of zero.

7. The method for segmenting epithelial glands in whole sections of gastric cancer based on cross-chromoprototype migration and ROI constraints according to claim 1, characterized in that, The generation of the weakly supervised pseudomask specifically includes: converting the CK staining image to the HED color space to extract the DAB channel, which reflects the positive CK staining regions; and obtaining the initial mask by combining DAB channel thresholding and CIELAB color constraints. ,in For DAB channel values, The blue and yellow components in the CIELAB color space. , The preset threshold is used; then morphological post-processing is performed. The final pseudomask is obtained, and the morphological post-processing includes at least one of opening operation, closing operation, hole filling and small connected region removal to reduce the impact of CK staining noise on the pseudomask quality.

8. The method for segmenting epithelial glands in whole sections of gastric cancer based on cross-chromoprototype migration and ROI constraints according to claim 1, characterized in that, The K-means clustering method is used to divide the CK features into two clusters. The prototype division based on DAB staining intensity includes: calculating the average DAB optical density value of the CK image block corresponding to each cluster, taking the cluster with the high average optical density value as the epithelial positive prototype set and the low average optical density value as the non-epithelial negative prototype set, thereby automatically distinguishing the prototype representation of epithelial and non-epithelial regions.

9. The method for segmenting epithelial glands in whole sections of gastric cancer based on cross-chromoprototype migration and ROI constraints according to claim 1, characterized in that, The segmentation network is trained using a weighted sum of cross-entropy loss and Dice loss to simultaneously optimize pixel-level classification accuracy and region overlap. , in , The focus is on optimizing the overall structure of the glandular region by emphasizing Dice loss.

10. A device for segmenting epithelial glands in whole gastric cancer sections based on cross-chromoprototype migration and ROI constraints, characterized in that, A method for segmenting epithelial glands in whole sections of gastric cancer based on cross-chromosome migration and ROI constraints as described in any one of claims 1-9, comprising: The data acquisition module is used to acquire paired H&E-stained full-field section images and CK-stained full-field section images, which are spatially perfectly aligned. The image patch extraction module is used to perform tissue region detection and extract paired image patches; The prototype building module is used to extract features from paired image patches, cluster CK features, and divide positive and negative prototype sets. The ROI induction module is used to transfer the prototype category to H&E image patches, generate pseudo-labels, and train the ROI classifier, outputting ROI heatmaps and ROI masks. The pseudomask generation module is used to generate a weakly supervised pseudomask based on the CK-stained image. The segmentation training module is used to construct a dual-branch segmentation network and train it using windows filtered by ROI masks and pseudo-masks. The inference fusion module is used to perform ROI coverage filtering and segmentation result fusion under H&E single staining input, and output the full-view epithelial gland segmentation result.