Breast cancer auxiliary diagnosis method and system based on virtual staining
By using a GAN-based virtual staining model and a kernel density adaptive activation function, combined with a joint loss function, the problem of inconsistency between generation and quantification in virtual staining technology for breast cancer auxiliary diagnosis was solved, achieving efficient and accurate breast cancer auxiliary diagnosis on a single slide.
Patent Information
- Application Number
- CN202511242208.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2045-09-02
AI Technical Summary
Existing virtual staining techniques for the auxiliary diagnosis of breast cancer suffer from problems such as inconsistency between generated images and quantitative assessments, large differences in cross-center staining, and insufficient model robustness, making it difficult to achieve stable and interpretable quantitative output on a single slide.
A virtual staining model based on GANs was used, combined with a nuclear density adaptive activation function and a joint loss function, to generate virtual IHC images of ER/PR/HER2. Nuclear density, nuclear morphology and other indicators were calculated by color deconvolution separation and cell nuclear instance segmentation to generate a structured report and reduce cross-slice alignment errors.
This method enables the simultaneous acquisition of equivalent information and quantization results on a single HE slice, reducing manual intervention, improving the accuracy of generated images and the reliability of quantization, reducing cost and time requirements, and enhancing the robustness and cross-mechanism adaptability of the model.
Smart Images

Figure CN121148652A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing, specifically to a method and system for auxiliary diagnosis of breast cancer based on virtual staining. Background Technology
[0002] Breast cancer is one of the most common malignant tumors in women. Clinical pathological diagnosis usually relies on hematoxylin-eosin (HE) staining to assess morphological characteristics, and combines immunohistochemical (IHC) markers such as estrogen receptor (ER), progesterone receptor (PR), and human epidermal growth factor receptor 2 (HER2) for subtyping and efficacy prediction. Traditional procedures require preparing multiple slides from the same case to complete multiple IHC tests, which has problems such as limited sample availability, long slide preparation and turnaround times, high reagent and labor costs, and spatial misalignment and subjective differences caused by cross-slide comparisons. Especially under staining conditions in different centers and batches, fluctuations in chromatin matrix and background noise can amplify the inconsistencies in grading, making quantitative assessments (such as HER2 membrane circumferential continuity, ER / PR nuclear positivity ratio, etc.) lack stable objective evidence.
[0003] In recent years, the development of digital pathology and generative models has driven the "virtual staining" approach, which involves learning the mapping from HE images to target IHC images to obtain information such as ER / PR / HER2 without additional tissue and reagent consumption. However, existing methods mostly optimize "image appearance" with general goals such as adversarial loss and pixel / perceptual consistency, paying insufficient attention to the clinically important aspects such as the reliability of positive expression distribution, the fidelity of cell-level morphology, and whether it can directly drive standardized quantification and grading. On the one hand, the non-strict registration of training data (such as serial slices) introduces structural drift, causing the model to generate signals that "look like" real positive regions but are difficult to align precisely with the actual positive regions on the DAB channel. On the other hand, most existing models are disconnected between the generation and quantification stages. The generation stage lacks constraints at the cell nucleus / cell instance level, and the segmentation and thresholding in the inference stage easily accumulate errors. In addition, the domain shift problem caused by cross-institutional and cross-batch staining differences limits the robustness and usability of virtual IHC in a wide range of clinical scenarios.
[0004] Meanwhile, pathological quantitative assessment itself also raises more detailed requirements: to complete the localization of cancerous areas, segmentation and counting of nuclear instances on a single slide; to perform intranuclear optical density statistics on ER / PR based on DAB channels obtained from color deconvolution separation; to calculate the circumferential continuity and coverage of HER2 cell membranes; and to output grading results and structured reports consistent with visual interpretation. Therefore, virtual staining models not only need to generate visually reasonable IHC appearances, but also need to introduce constraints coupled with clinical indicators during the training phase and improve their adaptability to staining differences. Furthermore, how to adaptively adjust parameters (such as local nuclear density, chromatin bias, etc.) obtained from HE priors within the network is also key to improving the consistency between the generated results and subsequent quantitative analysis. Existing virtual staining GANs mostly use fixed activation (ReLU / Swish / SiLU), where the activation shape is independent of the pathological scene. This easily leads to domain drift under staining differences (chromatin shift) and tissue structure differences (high / low nuclear density, changes in background ratio), resulting in DAB intensity oversaturation or under-suppression, which in turn affects subsequent ER / PR intranuclear statistics and HER2 membrane continuity calculations. Traditional virtual staining training often relies on adversarial / pixel / perceptual loss, emphasizing "appearance similarity," but it fails to align with clinical quantification goals. In the presence of HE-IHC registration errors and cross-center staining fluctuations, positive areas often "look" similar but cannot be accurately quantified. Therefore, there is an urgent need for an integrated virtual staining and auxiliary diagnostic technology pathway oriented towards clinical quantification and grading, which can ensure reliable alignment between histological structure and positive expression while achieving stable, interpretable, and traceable quantification output and single-slice summary display. Summary of the Invention
[0005] To address the aforementioned problems in existing technologies, this invention proposes a method and system for auxiliary diagnosis of breast cancer based on virtual staining. First, HE-stained sections are obtained and enhanced preprocessed. Then, a GAN-based virtual staining model is used to generate…
[0006] Virtual IHC images of ER / PR / HER2 are used. Based on the DAB channels obtained from color deconvolution separation and the segmentation results of cancerous regions and cell nuclei from virtual IHC and / or HE images, indicators such as nuclear density, nuclear morphology, proportion of ER / PR positive cell nuclei, HER2 membrane continuity / coverage, positive area percentage, and average optical density are calculated to generate overlay and structured reports. During the training phase, a joint loss mechanism is introduced, incorporating positive region consistency, membrane ring continuity, nuclear-level consistency, and hierarchical alignment. An adaptive activation function based on nuclear density is employed to improve the consistency and robustness of virtual staining and quantitative assessment. This approach can reduce the need for IHC reagents, shorten the cycle time, and simplify cross-slice alignment.
[0007] This invention provides a method and system for auxiliary diagnosis of breast cancer based on virtual staining, which can achieve the following beneficial technical effects:
[0008] 1. This application presents a virtual staining-based breast cancer auxiliary diagnostic method that, through a single sample collection and single-image summary, simultaneously obtains equivalent information and quantitative results for ER / PR / HER2 on a single HE slide. This reduces the errors and workload associated with preparing multiple IHC slides and cross-slide registration, achieving fully automated diagnosis without human intervention. The generation constraint for clinical indicator alignment: The joint loss directly incorporates the consistency of positive regions, HER2 membrane ring continuity / coverage, and ER / PR nuclear grade statistics and grading alignment into the training objective, further transforming the "virtual IHC that looks like it" into "accurately quantifiable," thus improving the reliability of subsequent interpretations.
[0009] 2. This application employs nuclear density adaptive activation, introducing an adaptive offset activation function based on local cell nuclear density. This function adaptively adjusts the response under different tissue environments, such as dense glands or sparse stroma, reducing DAB oversaturation or under-suppression and enhancing adaptability to heterogeneous tissues. Domain robust constraints driven by staining / structural descriptors and combined loss mitigate the impact of chromatin differences and batch-to-batch fluctuations on generation and quantization, improving consistency across multiple institutions. Cell / pixel dual-scale closed loop: After aligning the DAB channel with the nuclear / cell instance segmentation results at the same scale, pixel-level and instance-level sampling are performed. ER / PR is quantized in units of "nucleus," and HER2 in units of "membrane ring," reducing bias caused by inconsistent statistical methods.
[0010] 3. This application facilitates physician verification and quality control by outputting overlay maps and structured reports of cancerous regions, nuclear / cell instance outlines, positive grades, and quantitative values, meeting the needs of scientific research and regulatory documentation. It saves time and costs, conserves tissue: No additional IHC reagents or duplicate sections are required, enabling rapid acquisition of key indicators in scenarios with limited tissue volume or time constraints, shortening the diagnostic cycle and reducing costs. It boasts strong engineering feasibility: Training samples can be obtained through "same-slice destaining-restaining" or "serial section precise registration"; the inference chain uses standard GAN inference + color deconvolution + segmentation and statistics, easily integrating with existing digital pathology platforms. It ensures stable training and numerical safety: Range / consistency constraints are introduced for activation and loss (such as parameter pruning, visual...). Figure 1 This improves consistency, reduces the risk of gradient explosion / vanishing, and makes large-scale WSI block training more stable.
[0011] 4. This invention introduces an improved activation mechanism of "kernel density adaptation + structure / stain perception" in the terminal network layer of the generator: on the one hand, a kernel density parameter (obtained and normalized from a lightweight kernel counter of the HE image) is added to adjust the activation offset, so that the model suppresses oversaturation in the dense glandular region and enhances weak positive response in the sparse stroma region; on the other hand, a structure / stain descriptor vector from the HE side (such as H channel mean / variance, background ratio, texture energy, deviation from the reference chromatin, etc.) is added to adjust the activation slope and set learnable upper and lower bounds and basic bias, automatically adapting to staining differences and brightness contrast fluctuations in different centers and batches. With the addition of learnable base offsets, scaling factors, and slope pruning, this improvement makes the DAB expression of the virtual IHC more stable and quantifiable without changing the backbone network and training strategy: the nuclear optical density statistics of ER / PR are more accurate, the proportion of positive nuclei is more stable, and the circumferential continuity and coverage of the HER2 membrane are more consistent, significantly reducing false positives / false negatives caused by domain shift and noise; at the same time, the adaptive and pruning constraints of the activation curve improve the stability of training numerical values and convergence speed, and enhance the robustness and interpretability of cross-institutional implementation. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a flowchart of a method for auxiliary diagnosis of breast cancer based on virtual staining according to the present invention;
[0014] Figure 2 This is a schematic diagram of the cell nucleus positive grading calculation module of the present invention;
[0015] Figure 3 Schematic diagram of the cell membrane positive region grading calculation module. Detailed Implementation
[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] In view of the aforementioned problems mentioned in the prior art, and in order to solve the above technical problems, as shown in the appendix. Figure 1The figure shows a method for auxiliary diagnosis of breast cancer based on virtual staining, including:
[0018] S1: Acquire HE-stained slide images of breast tissue and perform enhanced preprocessing on the HE-stained slide images; 1) Slide preparation and scanning: Take breast tissue for routine HE staining (slide thickness 3-5μm), dehydrate and mount the slides, and then acquire them on a full-frame digital slide scanner; scan magnification 40× (0.25μm / px), while retaining 20× pyramid layers (0.50μm / px), and export in SVS / NDPI / OME-TIFF format. Enable autofocus and interline calibration during acquisition, and record the color reference card; de-identify before export (remove sensitive information such as patient name and barcode). 2) WSI reading and segmentation: Use 20× layers as the inference resolution, read the segments in a 2048×2048 pixel sliding window (overlap 256 pixels), and generate a full-image thumbnail for quality control and visualization. 3) Tissue detection (background removal): Tissue discrimination is performed in optical density space (OD) or HSV space. Tissue pixels with less than 5% coverage within a slice are discarded. A tissue mask is generated for the entire image (Otsu thresholding + morphological closing operation), and saved as a binary PNG for subsequent S3-S4 statistical range references. 4) White balance and illumination correction: Background is automatically sampled at the four corners of each slice to estimate white points. White balance and shadow / vignetting correction are performed (rolling ball radius 80-120px or polynomial fitting) to normalize background brightness to the target range (e.g., 240-255). 5) Color normalization (aligning with reference slices): A departmental "reference slice" is selected, and its chromaticity matrix and intensity distribution are estimated. Color normalization is performed on the current slice to align the chromaticity and saturation of H / E staining. The normalization results are clipped (1st-99th percentile) to avoid abnormal peaks. 6) Denoising and slight sharpening: First, perform median filtering (3×3) or non-local mean denoising to suppress sensor noise, then apply low-intensity anti-sharpening (radius 1.0-1.5, amount 0.3-0.5) to enhance tissue edges and avoid over-sharpening that introduces artifacts. 7) Artifact recognition and masking: Automatically detect and mask folds / bubbles / handwriting / glue marks, etc.: Folds: Local dark high-curvature texture + thick edge shadow discrimination; Bubbles: Circular highlights, strong edge reflection; Handwriting: High-saturation blue / green connected regions. Save the artifact mask along with the slice for removal during S3 / S4 calculation. 8) Focus quality control: Calculate focus score (Tenengrad or Laplacian variance) for each slice; lower threshold such as 50-80 (empirical value, depending on device calibration); slices below the threshold are marked as "out of focus" and will not be included in subsequent virtual staining; trigger rescan or neighborhood interpolation if necessary. 9) Scale and metadata calibration: Write pixel spacing, scan magnification, slice coordinates, tissue mask, artifact mask, and focus score into the JSON / YAML auxiliary file of the slice to ensure that S2-S5 can reproduce the same geometric and statistical standards. 10) Output enhanced preprocessed slices (PNG / TIFF), full-image tissue mask and artifact mask, and quality control report (defocus rate, tissue coverage, color deviation).The output is directly used as input to the S2GAN virtual staining model; since the color and lighting are unified, the impact of cross-batch / cross-center differences on subsequent generation and quantization can be reduced.
[0019] S2: Input the enhanced preprocessed HE-stained slide image into a virtual staining model based on a Generative Adversarial Network (GAN) architecture to generate a virtual immunohistochemical staining image. The virtual staining model employs a joint loss function during training to improve the quality and accuracy of the generated image. In some embodiments, GAN-based virtual staining and joint loss training includes the following steps: 1) Training data and registration. Data source: HE and target IHC (ER, PR, HER2) from the same case. Preferred acquisition methods: ① Same slide "HE → scan → destain → IHC → rescan"; ② Three consecutive slides are subjected to HE / IHC respectively, and elastic deformation registration is performed. Gold standard formation: Perform color deconvolution on the real IHC to obtain the DAB channel; generate a mask for cancerous areas and cell nucleus instances based on pathologist annotations or semi-automatic segmentation. For HER2, a membrane ring mask formed by nuclear expansion is also generated. Slicing strategy: Crop at 20× resolution using a sliding window of 512-1024 pixels, with an overlap of 128-256 pixels, filtering out-of-focus and tissue-free blocks.
[0020] 2) Structure and Function of Virtual Staining GAN. Overall Structure: An adversarial framework consisting of a generator G and a discriminator D. The single input is a HE image patch, and the output is a target IHC image patch (three branches, ER / PR / HER2, are trained independently or a shared encoder and branch decoder are used). Generator (G): Encoder-Decoder (U-Net): The encoder uses ResNet / ConvNeXt residual units, and the decoder upsamples and skips connections with aligned encoded features; multi-scale attention (SE / CBAM) is introduced to enhance structures such as glands, nuclei, and acini. Improved Terminal Layer Activation: At the terminal K≥2 layers of the decoder, "kernel density adaptive + structure / staining awareness" activation is used (as described in the dependent claims): the offset is adjusted by the local kernel density prior; the slope is obtained by lightweight linear mapping and cropping of the HE-side descriptor vector (e.g., H channel mean / variance, background proportion, texture energy, chromaticity bias, etc.). This can suppress oversaturation in dense glandular regions, enhance weak positive responses in sparse stroma regions, and adapt to cross-center staining differences. Normalization and Embedding: Regular instance normalization / layer normalization; descriptor vectors can be used as conditional embeddings, attached to the terminal layer (without changing the backbone structure). Discriminator (D): PatchGAN approach, multi-scale (×1, ×0.5) discrimination of local texture and global consistency, trained separately for ER / PR / HER2. Inference and Reconstruction: Inference is performed on the entire WSI in blocks, and weighted fusion is performed on the output block edges to reconstruct virtual ER / PR / HER2WSI; the same pixel coordinate system as the input HE is preserved to facilitate subsequent S3-S4 alignment and quantization.
[0021] 3) Construction and Implementation of the Joint Loss Function. During training, the objective is to minimize the weighted sum of the following terms (weights tuned from the validation set): Adversarial Consistency: Regularly generate / discriminate adversarial terms to ensure overall style and detail realism. Content / Perceptual Consistency: Constrain the fidelity of structure and texture on paired HE→IHC data (can be a combination of pixel / perceptual feature distances) to avoid "correct color, but misaligned structure". Local Contrast (Patch Contrast): Improve the sharpness and recognizability of small structures (nuclei, gland edges, membrane strips). Positive Expression Region Consistency (DAB Mask Alignment): Spatially align the generated image with the high DAB expression regions of real IHC within the cancerous region, directly targeting subsequent positive statistical objectives and reducing "looks similar but inaccurate measurements". HER2 Membrane Ring Topological Constraint: Constrain the circumferential continuity / coverage of virtual DABs on the cell membrane ring mask to match the real one, suppressing breaks and holes, and improving the discriminability of 0 / 1+ / 2+ / 3+. ER / PR nuclear-level statistical consistency: Using nuclear instance masks as units, the statistics (mean / quantiles / histograms) of intranuclear DABs are aligned with the true values, and the deviation of positive nuclear counts within cancerous regions is constrained, directly improving the stability of the "positive nuclear proportion" indicator. Grading alignment: The generated image is input into a validated ER / PR / HER2 grading evaluator, and sorted / spaced with the true IHC grades, ensuring the generation stage closely approximates clinical grading interpretation. Domain robust consistency: Multi-view training with minor color / intensity perturbations on the input HE ensures consistent spatial distribution of positive masks generated under different views, resisting cross-center staining differences. Key implementation points: All supervision signals related to DAB / nucleus / membrane rings are obtained based on color deconvolution and annotation / segmentation of the true IHC, and used after fine registration with HE; during training, cancerous regions, nuclear instances, and membrane ring masks are simultaneously generated for corresponding loss terms, ensuring consistent supervision caliber. The optimizer uses Adam / AdamW with a learning rate starting at 1e-4, using cosine or segmented decay; batch size is 8-16; training lasts 100-200 epochs, combined with an early stopping strategy. Validation metrics, in addition to PSNR / SSIM, focus on monitoring DAB mask consistency (IoU / Dice), nuclear-level positive detection accuracy, and HER2 membrane continuity deviation, with weights adjusted based on improvements in these metrics.
[0022] 4) Results and Interface: After training, G generates virtual ER / PR / HER2 on the standardized HE; sharing coordinates with the input, it directly enters the color deconvolution, cancerous region / nuclear instance segmentation and alignment in S3. The model is exported as an ONNX / TensorRT or PyTorch script; the interface provides batch block inference and WSI reconstruction tools to ensure seamless integration with the subsequent report generation chain. Key Summary: This embodiment places the "objects required for pathological quantification (DAB, nucleus, membrane ring, grading)" as supervision of the joint loss during the training period, while using "nucleus density and descriptor-driven adaptive activation" to adjust the generation response in the final layer. The combined effect of these two methods makes the virtual IHC not only realistic in appearance, but also stably supports intranuclear / perimembranous quantification and clinical grading in S3-S4.
[0023] S3: Perform image processing on the generated virtual immunohistochemical staining image; image processing includes: obtaining DAB channels through color deconvolution separation, and performing cancerous region segmentation and cell nucleus instance segmentation using a segmentation model trained with labeled data; and resampling and aligning the cancerous region segmentation and cell nucleus instance segmentation results with the DAB channels at the same scale and in the same coordinate system.
[0024] In some embodiments, color deconvolution separation and same-scale alignment include aspects A, B, C, and D. A. Input and overall process: The input is a WSI slice (e.g., 1024×1024, 20× resolution) of the generated virtual IHC image (one of the ER / PR / HER2 branches). Process sequence: 1) Illumination / white point correction → 2) RGB → Optical density space conversion → 3) Chromaticity matrix estimation (reference + adaptive fusion) → 4) Color deconvolution separation (demixing) → 5) DAB channel post-processing and intensity normalization → 6) Cancerous region and nuclear instance segmentation (on virtual IHC and / or HE) → 7) Coordinate alignment and resampling → 8) Quality control and buffered output.
[0025] B. Structure and Functions of the Color Deconvolution Module: Pre-correction function, White Point Estimation: Samples non-organized areas within the four corners and brightness quantile intervals of the block, estimates background RGB, performs white balance and shadow (vignetting) correction, and reduces uneven lighting. Dynamic Cropping: Performs quantile cropping on abnormally bright / dark pixels (e.g., 0.5-99.5 quantiles) to avoid extreme values affecting separation stability. Chromaticity Matrix Estimation Function (Acquisition of Chromaticity Bases): Reference Base: Fixed chromaticity bases (H, DAB) obtained from the system maintenance department's "reference slices". Adaptive Base: Performs pixel configuration analysis (SVD / clustering) on the current block to estimate two principal chromaticity vectors. Fusion Strategy: Uses the reference base when the angle / similarity with the reference base is within a threshold; otherwise, weights the reference base and adaptive base according to confidence level to obtain the final chromaticity base of the block. This strategy balances cross-center stability and local adaptation. Deconvolution Separation Function (Demixing Solution): Optical Density Modeling: Converts RGB to optical density space, making the dye contribution approximately linearly separable. Nonnegative sparse solution: "Concentration maps" of H and DAB are obtained using nonnegative least squares (NNLS) or a fast closed-form approximation. To improve speed, parallel NNLS / thresholding projection can be implemented on a GPU. Residual channels: Low-interpretation residual energies are stored separately for subsequent artifact diagnosis (e.g., strong reflective spots).
[0026] DAB channel post-processing functions include: Intensity normalization: Normalizing the DAB concentration map to [0, 1] and performing mild guided filtering / bilateral filtering to smooth noise while preserving membrane / nuclear boundaries. Adaptive background subtraction: Selecting a negative background sub-region within the block to estimate the baseline, performing drift correction, and reducing batch differences. Threshold suggestion: Outputting suggested thresholds for the Otsu / dual-threshold strategy, used only for downstream judgment reference and not forcibly binarized in this step. Quality indicators: Recording chromophore stability (angle with reference base), interpretability (DAB+H percentage of total energy), and noise ratio for subsequent quality control. The core function of this module is to restore the "color appearance" to "dye intensity," that is, to demix the DAB component in the virtual IHC map from the RGB mixture, providing a single-channel intensity map that can be used for quantification, and ensuring stability across centers / batch.
[0027] C. Segmentation of Cancerous Regions and Cell Nucleus Instances (Interface Separated from Deconvolution): Cancerous Region Segmentation: Run a pre-trained semantic segmentation network (such as U-Net / DeepLab / SegFormer) on HE or a virtual IHC to produce a three-class or two-class mask (cancer / suspicious / background). Nucleus Instance Segmentation: Use an instance-level model (such as HoVer-Net, MaskR-CNN, or StarDist) to prioritize inference within the cancerous region, outputting the kernel outline and instance ID; perform topological repair and small connected component removal on the kernel if necessary. Output Format: Both types of masks (cancerous region, nucleus instance) are saved as binary / labeled images of the same size as the input chunks, along with pixel spacing and the chunk's global coordinates in WSI.
[0028] D. Same-scale, same-coordinate-system resampling alignment: Scale alignment: If segmentation is completed at a 20× layer of HE and DAB is obtained at a 20× layer of virtual IHC, and their pixel sizes are consistent, they are used directly; otherwise, they are resampled to the DAB channel resolution using bilinear / nearest neighbor interpolation based on the recorded pixel spacing. Coordinate alignment: Using the global offset (x, y) of the segment and pyramid hierarchy information, the cancerous region mask and the nuclear instance mask are mapped to the same local coordinate system of the DAB channel. This ensures that "one nuclear instance" corresponds to the same closed region on the DAB image. Geometric correction: Morphological smoothing of the boundaries by 1-2 pixels is applied to eliminate jaggedness caused by interpolation; the "cell membrane ring mask" is obtained by expanding the nucleus outside the nucleus to prepare for subsequent HER2 continuity / coverage calculations. Consistency verification: Several blocks are randomly selected for visual overlay (DAB grayscale + mask outline), and the edge overlap (e.g., average outline distance) is calculated manually or automatically to confirm the alignment quality.
[0029] E. Products and Interfaces: Input DAB intensity map of the same size as the input slices, and cancerous region mask and nuclear instance label map of the same scale and coordinate system. Byproducts: reference threshold, quality control indicators (chromaticity bias, interpretability, noise ratio), membrane ring mask (generated by nuclear expansion). Downstream effects: S4 will sample the intranuclear optical density statistics of ER / PR on the DAB intensity map within the "cancerous region mask limit" in units of "nuclear instances"; and will statistically analyze the circumferential continuity and coverage of HER2 on the "membrane ring mask", thereby generating structured quantitative indicators. The color deconvolution module reliably transforms the RGB appearance of the virtual IHC into a quantifiable DAB intensity map through "reference + adaptive" chromaticity estimation, optical density spatial separation and non-negative solution; it is aligned with the same scale and coordinate system as the cancerous region / nuclear instance segmentation to ensure pixel-to-instance consistency and reproducibility of subsequent sampling and statistics, thus providing a stable foundation for the various clinical quantitative indicators of S4.
[0030] S4: Within the range defined by the cancerous region segmentation results, pixel-level sampling is performed based on the aligned DAB channels and the cell nucleus instance segmentation results to calculate parameters for breast cancer interpretation. These parameters include: cell nucleus density, cell nucleus morphology parameters, ER / PR positive cell nucleus ratio, HER2 positive region coverage, positive region area ratio, and average optical density. In some embodiments, Input 1: DAB intensity map (0-1 normalized) of a virtual IHC in the same coordinate system as HE, with color deconvolution separation and background baseline correction already completed. Input 2: Cancerous region mask (ROI, binary map). Input 3: Cell nucleus instance label map (each pixel records instance ID). All three are aligned at the same scale and in the same coordinate system. The pixel spacing is recorded as 0.50 μm / px.
[0031] Step 1: Sampling Domain and Anomaly Removal. Limit all calculations to the pixels within the cancerous region mask = 1. Remove the corresponding region using an artifact / defocus mask (if applicable). Perform topology cleanup on kernel instances: remove small kernels with an area < 20 pixels, and repair obviously broken instances (merge them according to the minimum neck width).
[0032] Step 2: Nuclear density and nuclear morphology parameters. Nuclear density: Count the total number of kernel instances N in the ROI, and calculate the ROI area A (number of pixels × (0.5μm)). 2 The nuclear density is calculated as N / A (unit: cells / mm²). 2 Kernel morphology: Calculate the area (in μm pixels) for each kernel instance. 2 ), perimeter (pixel outline length converted to μm), circularity (4π·area / perimeter) 2 Output case-level mean / median / quartiles and distribution histograms, etc.
[0033] Step 3: Proportion of ER / PR Positive Cell Nuclei (Pixel-level Sampling within Nuclei). Threshold Acquisition: Within the ROI, use Otsu or dual thresholds (90% and 95% background quantiles) to suggest a positive threshold T_DAB for DAB (departmental standard threshold tables can also be used). Intranuclear Intensity Statistics: For each nucleus instance, take the set of DAB pixels within its mask and calculate the mean / quantile optical density; determine whether the nucleus is positive (mean or P90 ≥ T_DAB, or use an area threshold to avoid noise). Proportion Output: Proportion of Positive Cell Nuclei = Number of Positive Nuclei / Total Number of Nuclei; simultaneously output weak / medium / strong gradations (can be based on multi-level thresholds of T_DAB or the corresponding threshold table of the hospital's H-score); provide case-level summaries: mean, confidence interval, heatmap (distribution of positive nuclei).
[0034] Step 4: HER2-positive region coverage (membrane ring pixel-level sampling). Constructing the membrane ring mask: Morphologically expand each nuclear instance to obtain cell instances (expansion radius set according to resolution: 20× radius 2-4 pixels ≈ 1-2 μm), and obtain the membrane ring region using "cell instance - nuclear instance". Coverage calculation: Calculate the proportion of pixels with DAB ≥ T_DAB in the membrane ring region to the total number of pixels in the membrane ring, obtaining the membrane coverage per cell; at the case level, take the median and distribution. Continuity: Discretize the membrane ring outline into equally spaced boundary points, calculate the longest continuous arc length of the suprathreshold response / total circumference, as a continuity indicator; used together with coverage for 0 / 1+ / 2+ / 3+ recommendations.
[0035] Step 5: Positive Region Area Percentage and Average Optical Density (Pixel-Level Global Statistics). Threshold the DAB image directly within the ROI (DAB ≥ T_DAB) to obtain the positive mask. Positive region area percentage = Positive mask pixel area / Total ROI area (unit: %). Average optical density: Calculate the mean of DAB pixels within the positive mask (or simultaneously provide the median and P90 as robust alternatives).
[0036] Step 6: Stratification and Robustness Management. Regional Stratification: Statistical analysis can be performed separately in high-density glandular areas and low-density stroma areas (using nuclear density thermal analysis). Figure 2 (Points) facilitate the observation of heterogeneity. Small connected component removal: Removes small spots with an area <10 pixels in the positive mask to reduce noise. Boundary erosion: Erodes the kernel mask by 1 pixel before kernel statistics to reduce the impact of contour leakage; performs an opening operation on the membrane ring mask before membrane ring statistics to eliminate burrs. Threshold adaptation: If the chromaticity deviation is large, T_DAB can adapt to the local background (block-level estimation + smoothing).
[0037] Step 7: Case-level Summary and Output. The table outputs the mean / median / quantile of nuclear density and nuclear morphology (area / perimeter / circumference); the proportion of ER / PR positive nuclear regions (and their classification); HER2 membrane coverage (and optional continuity); the percentage of positive area; and the average optical density. Visualization Overlay: Overlays the cancerous region boundary, nuclear instance outline, positive nuclear markers, membrane ring staining, and a translucent positive mask layer onto HE or a virtual IHC. Quality Control: Includes the DAB threshold for this case, alignment deviation estimation (e.g., average outline distance), and artifact / defocus ratio for easy retrospective analysis. Typical Parameter Examples: Thresholding Method: Initial Otsu value + local background offset; nuclear positivity is determined by P90 ≥ threshold and positive pixels occupying ≥10% of the nuclear area. Membrane Ring Outer Radius: e.g., 3 pixels (≈1.5μm) at 20× resolution; membrane coverage threshold is used for grading recommendations (e.g., ≥80% is considered a strong positive candidate, adjusted according to hospital standards). Small spot removal area: 10-20 pixels; lower limit of kernel area: 20 pixels; out-of-focus block removal threshold: Tenengrad < 50 (device-dependent and calibrable).
[0038] The above embodiments ensure consistent statistical standards across the "pixel-instance-case" three-layer framework: within the cancerous area, robust statistics are first obtained from the DAB intensity map using the nuclear / membrane ring as the sampling container, and then summarized into case-level structured indicators, thereby providing reproducible, traceable, and clinically friendly quantitative evidence for the interpretation and reporting of ER / PR / HER2.
[0039] S5: Generate auxiliary diagnostic results and / or structured reports based on the parameters and display them visually. In some embodiments, the generation of structured reports and the visualization overlay include the following steps:
[0040] 1) Input and Preparation. Input Data: Case-level parameters and intermediate products from S4, including: nuclear density, nuclear morphology (area / perimeter / roundness) statistics; proportion of ER / PR positive cell nuclei (and intensity grading); HER2 membrane coverage (and optional continuity), positive area area percentage, average optical density; and cancerous area mask, nuclear instance label, membrane ring mask, DAB intensity map. Quality Control Information: Alignment bias estimation, chromatin bias, defocus / artifact percentage, DAB threshold source, etc. In-Hospital Threshold Configuration: Load the department / in-hospital validated "interpretation threshold table", such as the positive proportion and intensity grading of ER / PR, HER2 coverage / continuity grading, and recommended rules for 0 / 1+ / 2+ / 3+ (configurable in the interface, with version number and effective date).
[0041] 2) Auxiliary Diagnostic Rule Engine (Interpretable and Configurable). ER / PR Logic (Example caliber, actual execution follows hospital threshold table): Generates grading suggestions based on "positive nuclear proportion + intensity level"; when the positive proportion is close to the threshold or the intensity distribution is highly discrete (e.g., significant difference between P10 and P90), it is marked as "boundary warning," suggesting a review area. HER2 Logic: Generates 0 / 1+ / 2+ / 3+ suggestions based on membrane coverage and (optional) continuity; when coverage / continuity falls within the "suspicious interval" or tumor heterogeneity is high (large differences in distribution between different blocks of the case), it suggests "supplementary molecular testing / review." Consistency Check: Whether parameters are calculated within the cancerous area, whether the sample size is sufficient (nuclear count threshold), whether there is uncertainty caused by large-area artifacts / defocus; provides a regularized confidence level (high / medium / low).
[0042] 3) Visual Overlay Design. Overlay Base Map: By default, it overlays on the HE base map (it can also be switched to a virtual IHC base map), with the resolution and coordinate system consistent with the input. Layers and Color Scheme: Cancerous area boundary: red semi-transparent surface; Cell nucleus instances: cyan thin line outline; ER / PR positive nuclei: colored according to intensity levels (light pink / pink / magenta); HER2 membrane ring: suprathreshold region with a yellow to orange gradient (the higher the coverage / continuity, the darker the color); Interaction: Enables "Layer Switch", magnifying glass, single-nucleus / single-cell mouse hover display of statistical values; provides an "Export Current View" screenshot button. Legends and Explanations: The report footer displays a legend color card and the source of the interpretation threshold.
[0043] 4) Structured Report Format and Fields. Cover Area: Case Number, Sampling Site, Scan Information (Magnification, Pixel Spacing), Model and Version (GAN and Segmentation Model Version, Activation Function Version, Threshold Table Version). Results Overview (Summary): ER: Positive Nucleus Percentage (%) and Intensity Distribution (Weak / Medium / Strong Percentage); PR: Same as above; HER2: Membrane Coverage (%) and (optional) Continuity Grading, providing suggestions of 0 / 1+ / 2+ / 3+ (clearly "for auxiliary purposes only, should be combined with pathologist's judgment"); Positive Area Percentage (%), Average Optical Density of Positive Area (unitized); Nucleus Density (number / mm²) 2 Kernel morphology statistics (mean / median / quartiles). Visualization page: Overlay large... Figure 1 : Cancerous area + ER / PR positive nuclear spot distribution; superimposed large Figure 2 HER2 membrane ring chromatogram (with enlarged images of typical areas); DAB heatmap + threshold marking; key area thumbnails (ROI1 / ROI2 / ...) and their numerical summaries. Tables and charts: Detailed indicator table (case-level and stratified RO1); histograms / box plots (nuclear area, roundness, DAB intensity distribution); quality control table (chromatic bias, explanatory power, alignment error, defocusing rate, artifact ratio). Notes and limitations: It is clearly stated that "this report is only a computer-aided result and does not replace physician diagnosis"; factors that may affect accuracy are recorded (insufficient tissue volume, defocusing, many artifacts, automatic threshold adjustment, etc.); it is recommended to conduct verification or supplementary testing in borderline or suspicious cases.
[0044] 5) Export and Traceability. Export formats: PDF (official copy), HTML (internal system preview), JSON (machine-readable indicators for research / quality control); image attachments are archived as PNG / TIFF. Traceability information: Includes a unique case ID, processing timestamp, model and threshold version, operator and review records; hash values are calculated for each key layer for tamper detection. System integration: Supports writing JSON indicators to the internal LIS / PACS or research database; supports quick retrieval (by case number, sampling site, time period).
[0045] 6) Example output snippet (text example). ER (virtual): Positive cell nucleus percentage 78%, strong / medium / weak percentage 40% / 28% / 10%, confidence level "high". PR (virtual): Positive cell nucleus percentage 62%, strong / medium / weak percentage 25% / 27% / 10%, confidence level "high". HER2 (virtual): Median membrane coverage 68% (focal 85%), median continuity "medium", overall recommendation "2+ tendency", suggesting "combination with morphology and supplemental molecular testing if necessary". Positive area percentage: DAB positive area 23%. Average optical density: 0.41 (unitized). Nuclear density: 4,800 / mm² 2 Nuclear roundness: median 0.82. Quality control: alignment error 0.7 pixels; color gradation deviation within acceptable range; out-of-focus rate 1.5%; artifact ratio 0.8%.
[0046] This embodiment combines quantitative indicators, images, and threshold suggestions to form a closed-loop output, which not only meets the needs of doctors for quick browsing and retrospective verification, but also retains all calculation details and quality indicators, facilitating in-hospital quality control and cross-case horizontal comparison; and through version and threshold traceability, it ensures that the results are reproducible and compliantly retained.
[0047] The cell nucleus positivity grading calculation module, such as Figure 2 As shown: S1 acquires breast HE slices WSI and performs enhancements such as white balance, color normalization, and noise reduction; S2 inputs the preprocessed image into a GAN-based virtual staining model to generate ER / PR / HER2 virtual IHCs; S3 performs color deconvolution separation on the virtual IHCs to obtain DAB channels, and completes the segmentation of cancerous regions and cell nuclei on the virtual IHCs and / or HE, then aligns them with the DABs at the same scale and coordinates; S4 performs pixel / instance sampling on the DABs within the cancerous region according to the "nucleus / membrane ring", and calculates nuclear density, positive nuclear ratio, HER2 membrane coverage, positive area ratio, and average optical density; S5 outputs overlay display and structured report.
[0048] Cell membrane positive region grading calculation module, such as Figure 3 As shown, the system includes: a full-frame slide scanner and scanning workstation, a preprocessing server, a virtual staining / segmentation inference server (GPU), centralized NAS storage, an application / reporting server, and a pathologist workstation; all nodes are interconnected via a 10 / 25GbE core switch. After the WSI is written to the NAS, it is enhanced by the preprocessing server; the inference server performs GAN virtual staining and segmentation and writes it back; the application server performs color deconvolution, quantization calculations, and report generation; and the doctor's workstation views and reviews the overlay images via HTTPS; the system interfaces with LIS / PACS via HL7 / DICOM.
[0049] In some embodiments, the virtual staining model includes a generator and a discriminator; the joint loss function includes at least any three of the following:
[0050] (i) Consistency loss of positive expression region: Based on the DAB channel obtained by color deconvolution separation of the generated image and the real IHC image, the consistency of the DAB positive mask in the cancerous region between the two is constrained in terms of position and range.
[0051] (ii) Loss of topological continuity of membrane ring: Using the cell membrane ring region obtained by extrapolation from the cell proof as a template, the circumferential connectivity and coverage of the DAB channel of the generated image on the membrane ring are constrained to be consistent with the real IHC, and breaks / holes are penalized.
[0052] (iii) Nuclear-level statistical consistency / count preservation loss: Within the nucleus instance mask, the generated image is subjected to distribution matching with the mean, quantiles, and histogram of the DAB statistics of the real IHC, and the deviation of positive cell nucleus counts in the cancerous region is constrained;
[0053] (iv) Color invariance consistency loss: Apply color matrix or intensity perturbation or normalization dithering to the input HE to constrain the DAB positive mask of the generated image under different perturbations to maintain a consistent spatial distribution, so as to improve domain robustness;
[0054] (v) Clinical grade alignment loss: The generated image is input into an labeled or validated ER / PR / HER2 grading evaluator to minimize the order constraint / interval loss between the generated image and the real IHC grade, so that the generated result is consistent with the real IHC in negative / positive grades.
[0055] In some embodiments, the joint loss function operates according to the following process (training process and the value of each loss): Overall training loop: read the registered HE / IHC image patch pairs and their corresponding labels (cancer region mask, nuclear instance mask; HER2 re-prepared membrane ring template); use HE as input, and output virtual IHC through generator G; perform color deconvolution on the virtual IHC and the real IHC respectively to obtain two DAB intensity maps (linear differentiable operation); calculate each loss (iv) under the same ROI / coordinate system; sum and weight, add to the conventional adversarial / content / style / local contrast loss, and backpropagate to update G (and D). Soft / differentiable processing: threshold masking uses Sigmoid + temperature to obtain a "soft positive mask", and counting uses "soft area sum" to achieve differentiability; morphological operations (expansion, thinning) are approximated by convolution or differentiability.
[0056] (i) Loss of consistency in positive expression regions: Within cancerous areas, two DAB intensity maps are used to obtain a soft positive mask through a "soft threshold," and the spatial overlap between the two is measured using IoU / BCE / Focal, etc. The purpose is to constrain the alignment of the "position and range of positive distribution" and avoid "shifting / distorting" positives in pursuit of appearance. (ii) Loss of topological continuity of membrane rings (HER2): Based on the cell membrane ring template obtained by verification exception expansion, the following are measured only within the template ring: ① Overthreshold pixel coverage; ② Percentage of the longest continuous arc length along the circumference / penalty of the number of connected segments; Aligned with the real IHC; The purpose is to suppress membrane strip breaks / holes / serrations, so that the virtual HER2 presents a clinically readable continuous membrane morphology, serving the 0 / 1+ / 2+ / 3+ classification.
[0057] (iii) Kernel-level statistical consistency / count preservation loss (ER / PR): The mean, quantiles and histogram of DAB intensity are statistically analyzed within the kernel mask on a kernel instance basis, and the distribution is matched with the same index of the real IHC. At the same time, the "number of positive kernels" is constrained to be close to the real number of kernels with soft counting. Purpose: To directly use "intranuclear intensity and proportion of positive kernels" as training target to reduce the accumulation of bias after generation and subsequent statistics.
[0058] (iv) Loss of consistency in staining invariance (domain robustness): Apply chromatin / brightness / contrast perturbation or normalized jitter to the same HE input to obtain multiple views, requiring that the positive masks generated by each view are highly consistent in spatial distribution; Purpose: To combat cross-center staining differences and batch-to-batch fluctuations, and reduce interpretation instability caused by domain shift.
[0059] (v) Clinical grade alignment loss (order relation): The virtual IHC is fed into a validated grading evaluator (which can be frozen or semi-frozen), and the output grade is made consistent with the grade of the real IHC using order / interval loss. The purpose is to optimize "grading correctness" during the generation stage, rather than just pursuing pixel / appearance similarity. Weights and training stability: The sub-loss settings can be learned or manually adjusted (starting with 1:1:1:0.5:0.5, and then fine-tuning according to validation set indicators). A phased training method is adopted: first convergence of "appearance (adversarial / content / style) + region consistency (i)," then gradually opening (ii)(iii)(v), and finally adding (iv). Monitoring indicators: DAB mask IoU, nuclear grade positive determination accuracy, membrane continuity bias, and grading consistency rate are used as the basis for early stopping and weight adjustment.
[0060] Transforming "quantifiable" into "trainable": Traditional methods only optimize appearance, resulting in results that "look like it but are inaccurate in measurement." This approach directly incorporates positive spatial consistency, intranuclear statistics, membrane continuity, and grading results into the loss function, ensuring consistent training and inference objectives and more stable indicators. Nuclear / membrane dual-scale consistency: Nuclear level (iii) ensures reliable intranuclear intensity and positive nuclear counts for ER / PR; membrane level (ii) ensures readable circumferential connectivity and coverage of HER2, significantly reducing "fracture / cavitation" artifacts. Cross-center robustness: By incorporating the consistency of staining perturbations into training (iv), combined with color normalization and adaptive activation, the generated results are insensitive to chromatin drift, improving out-of-domain generalization ability. More clinically relevant grading: (v) Directly optimizing grading consistency makes the virtual IHC output more discriminative of 0 / 1+ / 2+ / 3+ and negative / positive cases, reducing recurrence of borderline cases. Reduced error accumulation: With the pre-constraints in (i), (ii), and (iii), the subsequent deconvolution and segmentation-statistical link in S3 / S4 are no longer sensitive to generation errors. The DAB positive mask aligns with the ground truth, and quantization bias is significantly reduced. More stable and interpretable training: The three types of signals—region, instance, and rank—provide multi-perspective supervision, complementing adversarial, content, and style signals, and still converges under extreme batch conditions. Each loss can correspond to visual evidence (positive mask, membrane loop, kernel statistics, rank output). Clinically applicable: The joint loss optimizes the indicators and ranks that doctors need to see in reports, improving report consistency and review pass rates, and reducing the time for re-testing and film resubmission.
[0061] This joint loss transforms the "pathologically interpretable quantitative object" into the "optimization target during the training period." While ensuring visual fidelity, it significantly improves DAB alignment, intranuclear statistics, membrane continuity, and rank consistency. Furthermore, it enhances cross-center robustness through staining invariance, ultimately enabling virtual staining to be truly used for quantitative closed-loop diagnostic assistance.
[0062] In some embodiments, the color deconvolution separation uses a color matrix to obtain DAB channels; ER / PR positivity determination is based on the average optical density and area threshold of DAB at the cell nucleus instance level; HER2 positivity determination is based on the DAB coverage of cell instances obtained by external expansion of cell nuclei at the cell membrane periphery.
[0063] In some embodiments, the segmentation model trained with labeled data is a Transformer architecture; and the cell nucleus instance segmentation is used to define the determination range of ER / PR positive cell nuclei and the calculation region of HER2 cell membrane grading.
[0064] In some embodiments, the HE-stained slide image is subjected to enhancement preprocessing, including flipping the HE-stained slide image horizontally or vertically, and randomly adjusting the brightness and contrast of the HE-stained slide image to expand the graphic data sample.
[0065] In some embodiments, a mask N is applied to each instance of a cell nucleus. i The average optical density and / or quantile optical density are calculated on the aligned DAB channel and compared with a preset threshold to determine whether the nucleus is negative or positive. The ER / PR positive cell nucleus ratio is the ratio of the number of positive nuclei to the total number of nuclei. The cell nucleus density is the ratio of the total number of cell nucleus instances within the cancerous region mask to the area of that region. Cell nucleus morphology parameters include nuclear area, perimeter, and roundness. The positive region area ratio is the ratio of the area of positive pixels that meet the threshold on the DAB channel within the cancerous region mask to the area of that region. The average optical density is the average optical density of positive pixels on the DAB channel.
[0066] In some embodiments, the cancerous region, cell nucleus / cell instance outline, ER / PR / HER2 positivity grade, and numerical results of the parameters are overlaid on a single slice image, and a structured report containing quantitative indicators and grading recommendations is output.
[0067] In some embodiments, the generator of the virtual staining model employs an improved kernel density adaptive activation function f(x) in at least the last K network layers, where K ≥ 2.
[0068] f(x) = x * σ(β) p *x-τ)
[0069] τ=τ0+r*n uc
[0070] β p =clip(β0+α) T d, β min ,β max )
[0071] Where x is the input to the activation function, σ() represents the Sigmoid activation function, τ0 is the learnable base offset scalar, and r is the learnable scaling factor scalar used to adjust the strength of the influence of the kernel density on the offset; n uc The normalized estimate of cell nuclear density is used as input to the lightweight nuclear counter of the corresponding local block in the HE image; β p The structure descriptor vector d from the input HE image is obtained through a learnable linear mapping and interval clipping; the structure descriptor vector d is the normalized deviation between the estimated chromaticity matrix and the reference chromaticity; K is the number of terminal network layers using this activation function; clip(β0+α) T d, β min ,β max ) represents β0+α T d is cut off to the interval [β] min ,β max Operators within ] are used for numerical stability; β minLet β be the lower boundary of the interval. max α represents the upper boundary of the interval; α is the learnable weight vector; T represents the transpose.
[0072] This application also provides a virtual staining-based auxiliary diagnostic system for breast cancer, including: the hardware composition and connection method of the virtual staining-based auxiliary diagnostic system for breast cancer (a set of reference topologies that can be implemented in engineering). In some embodiments, the hardware configuration is as follows: The specimen digitization subsystem includes a full-width pathological slide scanner (WSIScanner): supporting 20× / 40× (typically 0.50 / 0.25μm / px), autofocus and batch uploading; outputting SVS / NDPI / OME-TIFF and (optionally) DICOM-WSI. Scanning workstation: CPU ≥ 8 cores, memory ≥ 32GB, NVMe ≥ 1TB; directly connected to the scanner (USB / dedicated interface), responsible for scanning task scheduling and preliminary quality control. Barcode printer + barcode gun: consistent with the hospital's LIS barcode, used for unique identification of slides.
[0073] The computing and storage subsystem includes: a preprocessing server (HE enhancement / tissue detection / color normalization / artifact masking): CPU ≥ 24 cores, memory ≥ 128GB, NVMe cache ≥ 2TB, 10 / 25GbE. A virtual staining / segmentation inference server (the main AI inference server): GPU × 2-4 (equivalent to NVIDIA RTX 6000 / A100), CPU ≥ 24 cores, memory ≥ 256GB, NVMe ≥ 2TB, 10 / 25GbE. A training server: used for offline retraining / calibration, GPU × 4-8, independent of production inference. A centralized storage array (NAS / SAN): unified archiving of raw WSI, preprocessing chunks, virtual IHC, and overlay results; capacity ≥ 100TB, RAID 6 / DP, SSD cache; external NFS / SMB and (optional) S3 object protocol. Backup and disaster recovery: LTO tape library or secondary object storage for daily / weekly backups and cross-datacenter replication. Application and Display Subsystem, Application / Interface Server: Backend API, task orchestration, report generation, and integration with hospital systems; CPU ≥ 16 cores, memory ≥ 64GB, redundant dual machines. Database Server: Stores case metadata, task status, and audit logs (e.g., PostgreSQL / Oracle); primary / backup deployment, enterprise-grade SSD array. Pathologist workstation: CPU ≥ 8 cores, RAM ≥ 32GB, mid-range GPU; equipped with a medical-grade calibrated monitor (≥ 27" 4K, hardware-calibrated) and a graphics tablet / high-precision mouse for annotation and review. Visualization screen (optional): for multidisciplinary consultations. Network and power security subsystem: Core switch: 10 / 25GbE, uplink to server and NAS; supports VLAN / QoS. Access switch: 1 / 2.5 / 10GbE, connecting scanning terminals and doctor workstations. Firewall / Security gateway / VPN: In-hospital zone access control, TLS endpoint, zero-trust or LDAP / AD unified authentication. NTP time source: unified audit timestamp. UPS and intelligent PDU: Full coverage of servers, storage, and network, supporting 48-72 minutes of battery life and orderly shutdown.
[0074] Connection methods and data streams include scanning and data entry, scanners Scanning workstation (USB / dedicated line); Scanning workstation The core switch (1 / 10GbE) writes the WSI to the NAS (NFS / SMB shared directory) and simultaneously writes the case barcode / basic information to the application server (API) and database (metadata table). Preprocessing and inference are performed: the preprocessing server is mounted on the NAS (NFS), retrieves WSI slices, completes white balance, color normalization, tissue / artifact masking, and quality control results; the product is then written back to the NAS.
[0075] The inference server is also mounted on NAS, reads enhanced HE slices, performs GAN virtual staining (ER / PR / HER2) and segmentation inference, and produces virtual IHC, cancerous region masks, nuclear instance labels, etc., which are then written back to NAS. The application server calls the color deconvolution, pixel / instance sampling and quantization calculation modules (which can be executed on the inference machine or application machine) to generate structured indicators and visualization overlays; the results are stored in the database: indicators are stored in the database, and large images and overlays are stored in NAS; it interfaces with the hospital: it exchanges report summaries with LIS via HL7v2 / FHIR, and archives images (virtual IHC and PDF reports / secondary captures) with PACS via DICOMweb (STOW / WADO-RS).
[0076] Physician access: The pathology workstation accesses the application server via a browser / client (HTTPS / TLS); virtual IHC and overlay images from the NAS are loaded instantly, supporting progressive zoom, layer switching, and annotation; after approval, the report is saved as a PDF and DICOMSR and uploaded to the hospital system. End-to-end VLAN isolation: partitioning of the scanning network segment, computing network segment, and physician terminal network segment; unified LDAP / AD authentication and RBAC fine-grained authorization; data transmission TLS1.2+ encryption; full auditing of database records (login, viewing, downloading, issuing) and version numbers (model / threshold / rule). Typical ports and protocols include NAS: NFSv4 / SMB3 (for compute and workstation mounting); S3 (object interface, optional). Application API: HTTPS443; internal gRPC / REST (for compute node integration). Hospital integration: HL7v2 (TCP2575 / MLLP), FHIR (HTTPS), DICOMweb (HTTP / HTTPS8042 / 8443). Remote maintenance: SSH (bastion host management), SNMP / Prometheus (monitoring).
[0077] The system features dual-machine hot standby or master-slave configurations for compute nodes and applications / databases; dual controllers and multipathing for the NAS; horizontal scaling: preprocessing / inference servers can be horizontally expanded (K8s / Slurm task orchestration); storage expansion: NAS can be linearly expanded by disk enclosure, with cold data tiered to object storage / tape libraries. The system operates along the main line of "scanning → storage → preprocessing → AI inference → quantification → reporting → in-hospital integration," forming a central hub through a core switch and NAS; compute nodes and applications / databases are deployed in layers, with physician workstations accessing the application layer via HTTPS; it interacts with LIS / PACS via standard protocols, and, in conjunction with UPS and security boundaries, constitutes a hardware and connectivity implementation for a virtual staining-based breast cancer auxiliary diagnostic system that can be deployed within hospitals.
[0078] The acquisition module acquires HE-stained section images of breast tissue and performs enhancement preprocessing on the HE-stained section images;
[0079] The virtual staining model processing module inputs the enhanced preprocessed HE staining slice image into a virtual staining model based on the generative adversarial network (GAN) architecture to generate a virtual immunohistochemical staining image. The virtual staining model uses a joint loss function during training to improve the quality and accuracy of the generated image.
[0080] The image processing module performs image processing on the generated virtual immunohistochemical staining image. The image processing includes: obtaining the DAB channel through color deconvolution separation, and performing cancerous region segmentation and cell nucleus instance segmentation using a segmentation model trained with labeled data; and resampling and aligning the cancerous region segmentation and cell nucleus instance segmentation results with the DAB channel at the same scale and in the same coordinate system.
[0081] The parameter calculation module performs pixel-level sampling based on the aligned DAB channel and cell nucleus instance segmentation results within the range defined by the cancerous region segmentation results, and calculates parameters for breast cancer interpretation. The parameters include: cell nucleus density, cell nucleus morphology parameters, ER / PR positive cell nucleus ratio, HER2 positive region coverage, positive region area ratio, and average optical density.
[0082] The visualization module generates auxiliary diagnostic results and / or structured reports based on the parameters and displays them in a visual overlay.
[0083] Preferably, the virtual staining model includes a generator and a discriminator; the joint loss function includes at least any three of the following:
[0084] (i) Consistency loss of positive expression region: Based on the DAB channel obtained by color deconvolution separation of the generated image and the real IHC image, the consistency of the DAB positive mask in the cancerous region between the two is constrained in terms of position and range.
[0085] (ii) Loss of topological continuity of membrane ring: Using the cell membrane ring region obtained by extrapolation from the cell proof as a template, the circumferential connectivity and coverage of the DAB channel of the generated image on the membrane ring are constrained to be consistent with the real IHC, and breaks / holes are penalized.
[0086] (iii) Nuclear-level statistical consistency / count preservation loss: Within the nucleus instance mask, the generated image is subjected to distribution matching with the mean, quantiles, and histogram of the DAB statistics of the real IHC, and the deviation of positive cell nucleus counts in the cancerous region is constrained;
[0087] (iv) Color invariance consistency loss: Apply color matrix or intensity perturbation or normalization dithering to the input HE to constrain the DAB positive mask of the generated image under different perturbations to maintain a consistent spatial distribution, so as to improve domain robustness;
[0088] (v) Clinical grade alignment loss: The generated image is input into an labeled or validated ER / PR / HER2 grading evaluator to minimize the order constraint / interval loss between the generated image and the real IHC grade, so that the generated result is consistent with the real IHC in negative / positive grades.
[0089] This invention utilizes a Generative Adversarial Network (GAN) based architecture to implement virtual staining technology, specifically generating immunohistochemical staining images such as ER, HER2, and PR from HE-stained images. During the training of this GAN, multiple loss functions are employed to ensure the quality and accuracy of the generated images. These include: Adversarial Loss: Through adversarial training between the generator and discriminator, the virtual staining images generated by the generator are made as close as possible to real immunohistochemical staining images, while the discriminator strives to distinguish between real and generated images. This mutual competition continuously improves the quality of the generated images. Content Loss: Ensures that the generated immunohistochemical staining images are consistent in content with the corresponding HE-stained images; for example, the position and morphology of key elements such as cell nuclei and cell structures should remain relatively consistent in both images. Style Loss: Enables the generated virtual staining images to possess the stylistic features of real immunohistochemical staining images, such as color distribution and staining intensity, to achieve a visually similar effect. Patch Contrast Loss: Comparison is performed on local regions (patches) of the image to further refine the similarity between the generated and real images, ensuring the accuracy of image details. Loss of consistency in positive expression regions: For key positive expression regions in immunohistochemical staining, ensuring a high degree of consistency in location and extent between the positive expression regions in the generated image and those in the actual immunohistochemical staining image is crucial for subsequent analysis and diagnosis based on these positive regions. Loss of cell consistency: Ensuring that the morphology, quantity, and distribution of cells in the generated image are consistent with the cell characteristics in the actual immunohistochemical staining image helps to perform more accurate cellular-level analysis and diagnosis.
[0090] The dataset creation scheme is as follows: Sample acquisition: Take 3 consecutive slices, first stain each of these 3 consecutive slices with HE and scan them. After scanning, wash off the HE stain, then stain the slices with immunohistochemistry and scan them again, thus obtaining 3 pairs of registered HE and immunohistochemical stained slices. Data augmentation scheme: To increase the robustness of the model, data augmentation processing is performed on the dataset. Specifically, this includes: Random rotation (0-360°): Rotate the images at random angles to simulate different angle situations that may occur during the actual sample acquisition and processing, enabling the model to learn the features of the image at different angles and improve the model's generalization ability. Horizontal / vertical flipping: By flipping the images horizontally or vertically, the diversity of the dataset is expanded, allowing the model to adapt to the feature representation of the image in different directions and enhancing the model's comprehensive understanding of image features. Random cropping: Randomly crop image patches of different sizes and positions from the original image, enabling the model to learn the features of different local regions of the image and improve the model's ability to recognize local details of the image. Brightness / contrast jitter: The brightness and contrast of the image are randomly adjusted to simulate the differences in image brightness and contrast caused by factors such as lighting conditions during actual imaging, making the model more adaptable to images under different lighting conditions. Each slice generates 5-10 times enhanced samples. By using a large number of data enhanced samples, the features of the dataset are enriched, enabling the model to learn a wider range of image features during training, thereby improving the robustness and accuracy of the model.
[0091] Cancerous region segmentation: A cancerous region segmentation model is used to process HE-stained sections to segment out cancerous regions. This model, trained on a large number of HE-stained images labeled with cancerous regions, can accurately identify and segment cancerous regions in images, providing precise regional boundaries for subsequent targeted analysis.
[0092] Nucleus segmentation and counting in cancerous regions: The cancerous region obtained above, along with the HE-stained slides, is input into a nucleus segmentation model. This model segments the nuclei within the cancerous region, obtaining the segmentation results and counting them. This process accurately locates and counts the nuclei within the cancerous region, providing fundamental data for subsequent analysis.
[0093] Obtaining ER-positive cell nuclei from cancerous areas: Input the cancerous area, virtual ER-stained sections, and cell nucleus segmentation results from the cancerous area into the cell nucleus positivity grading calculation module. This module processes the data to obtain ER-positive cell nuclei from the cancerous area.
[0094] Obtaining PR-positive cell nuclei from cancerous areas: Input the cancerous area, virtual PR-stained sections, and cell nucleus segmentation results from the cancerous area into the cell nucleus positivity grading calculation module. This module processes the data to obtain PR-positive cell nuclei from the cancerous area.
[0095] Obtaining HER2-positive cell membranes from cancerous areas: Input the cancerous area, virtual HER2-stained sections, and cell nucleus segmentation results from the cancerous area into the cell membrane-positive area grading calculation module. This module processes the data to obtain the HER2-positive cell membrane region of the cancerous area.
[0096] The calculation process of the cell nucleus positivity grading module is as follows: Immunohistochemical stained sections are separated by deconvolution of color channels and divided into H channels, E channels, and DAB channels. The DAB channel and the cell nucleus instance segmentation results are taken, and the positive cell nucleus grading results are obtained by image processing methods (such as threshold segmentation, setting an appropriate threshold, determining the regions in the DAB channel with an average optical density higher than the threshold and overlapping with the cell nucleus instance segmentation results as positive cell nuclei, and grading according to the average optical density).
[0097] The cell membrane positive region grading calculation module process is as follows: The cell instance segmentation result is obtained by expanding the cell nuclear instance segmentation result outward to a specified degree. At the same time, the immunohistochemical stained section is separated by deconvolution of the color channels and divided into H channel, E channel and DAB channel. The DAB channel and the cell instance segmentation result are taken, and the cell membrane positive region grading result is obtained by image processing methods (such as calculating the signal intensity distribution of the DAB channel in the cell instance segmentation result area and grading according to the signal intensity and distribution range).
[0098] Nucleus-related quantifications are as follows: Nuclear density: This calculates the number of nuclei per unit area, using the formula: total number of nuclei divided by the area of the corresponding tissue region. This indicator reflects the density of cells. In breast cancer diagnosis, cancer cells typically exhibit high proliferative activity, and their nuclear density may be higher than in normal tissue. Higher nuclear density may suggest active tumor cell proliferation and a higher degree of malignancy. Nuclear morphology parameters: These include the perimeter, area, and roundness of the nucleus. The formula for roundness is 4π × area ÷ perimeter. 2 The values range from 0 to 1, with values closer to 1 indicating a more rounded nucleus. Cancer cells often have irregular nuclei; quantitative analysis of these parameters can provide a basis for distinguishing between normal and cancer cells. For example, abnormal nuclear morphology parameters may indicate that the cell has become cancerous.
[0099] The quantification of immunohistochemical positivity is as follows: **Positive Nucleus Ratio:** This calculates the proportion of positive nuclei to the total number of nuclei, i.e., the number of positive nuclei divided by the total number of nuclei multiplied by 100%. This ratio directly reflects the positive expression level of the immunohistochemical marker. Different breast cancer types and grades correspond to different ranges of positive nucleus ratios. For example, HER2-positive breast cancer typically requires a certain standard for the positive nucleus ratio, and this quantification result can serve as an important basis for determining whether HER2 is positive. **Positive Region Area Ratio:** This calculates the proportion of the area of the immunohistochemically positive region to the entire cancerous region area, i.e., the area of the positive region divided by the area of the cancerous region multiplied by 100%. This indicator reflects the expression range of the immunohistochemical marker at the regional level. The size of the positive region area ratio is closely related to the progression of breast cancer and treatment efficacy. A larger positive region area ratio may indicate widespread expression of the immunohistochemical marker in tumor tissue. **Mean Optical Density of Positive Region:** This calculates the average optical density value within the positive region using optical density calculation methods. Optical density values are related to staining intensity; a higher average optical density indicates a greater intensity of positive expression. This indicator can quantify the strength of positive expression and help determine the expression level of immunohistochemical markers, which is of great significance for assessing the biological behavior of tumors.
[0100] Based on the results of the above image processing and analysis, doctors can be assisted in diagnosing the type and grade of breast cancer and provide a reference for the formulation of subsequent treatment plans. For example, by analyzing information such as the size, morphology, characteristics of cell nuclei, and expression of immunohistochemical indicators of the cancerous area, the type (such as invasive ductal carcinoma, invasive lobular carcinoma, etc.) and grade (such as the malignancy grade of the tumor) of the patient's breast cancer can be comprehensively determined.
[0101] This invention allows all analytical results from four slides (HE slide and ER, HER2, and PR immunohistochemical staining slides) to be plotted on any single slide. For example, information such as cancerous areas, cell nucleus counts, and positive areas can be overlaid on the HE slide using different colors or markings. This enables doctors to intuitively obtain all key information from a single slide, significantly reducing diagnostic difficulty and improving efficiency. Furthermore, this invention makes traditionally subjective grading diagnostic standards more objective. Through quantified analytical indicators and standardized analytical procedures, diagnostic results can be retrospectively reviewed. When follow-up examinations or further analysis are needed, doctors can clearly view the previous analytical process and results, ensuring the accuracy and reliability of the diagnosis.
[0102] In some embodiments, the virtual staining model training phase includes the following steps: Dataset preparation: Following the dataset preparation scheme described above, obtain three pairs of registered HE and immunohistochemical staining slide images, and divide them into training, validation, and test sets. Perform data augmentation on the training set to generate a large number of diverse training samples. Model building: Construct a generative adversarial network model based on a GAN architecture, including a generator and a discriminator. The generator is responsible for converting HE staining images into immunohistochemical staining images, and the discriminator is used to determine whether the generated images are real immunohistochemical staining images. Loss function settings: During model training, adversarial loss, content loss, style loss, patch contrast loss, positive expression region consistency loss, and cell consistency loss are used simultaneously. By adjusting the weights of these loss functions, the model can comprehensively optimize the quality and accuracy of the generated images during training. Model training: Input the HE staining images from the training set into the generator to generate corresponding virtual immunohistochemical staining images. The discriminator distinguishes between the generated images and real immunohistochemical staining images. Based on the discrimination results and the calculation results of various loss functions, backpropagation updates the parameters of the generator and discriminator. During training, the model performance metrics on the validation set are continuously monitored, such as similarity metrics between generated images and real images (e.g., PSNR, SSIM). When the performance metrics on the validation set no longer improve or reach the preset number of training rounds, training is stopped, and a well-trained virtual coloring model is obtained.
[0103] In the auxiliary diagnosis stage of breast cancer, image acquisition and preprocessing involve acquiring HE-stained sections of the patient's breast cancer tissue and preprocessing the images, including image denoising and normalization, to improve image quality and make them meet the input requirements of the virtual staining model. Virtual staining generation involves inputting the preprocessed HE-stained images into the trained virtual staining model, which then outputs corresponding immunohistochemical staining images for ER, HER2, and PR.
[0104] Image Processing and Analysis: Cancerous Region Segmentation: HE-stained sections are processed using a cancerous region segmentation model to obtain cancerous regions. Cancerous Region Nucleus Instance Segmentation and Counting: The cancerous region and HE-stained sections are input into the nucleus instance segmentation model to obtain and count the segmented nuclei. Acquisition of ER, PR-positive Nuclei and HER2-positive Cell Membrane Regions: The corresponding cancerous regions, virtual stained sections, and cancerous region nucleus segmentation results are input into the corresponding calculation modules to obtain ER-positive, PR-positive, and HER2-positive cell membrane regions within the cancerous region. Quantitative Index Calculation: Based on the above segmentation and counting results, quantitative indicators such as nuclear density, nuclear morphology parameters, proportion of positive nuclei, area ratio of positive regions, and average optical density of positive regions are calculated according to the corresponding formulas.
[0105] Assisted Diagnosis and Result Presentation: Based on the results of all image processing, analysis, and quantitative indicators, an auxiliary diagnostic report is generated, including information such as the type and grade of breast cancer. Simultaneously, all key diagnostic information and quantitative indicators are presented to the doctor in an intuitive way on a single slide image (e.g., an HE slide image), assisting the doctor in making the final diagnostic decision. Based on the presented results, report, and quantitative indicators, combined with their clinical experience, the doctor can make an accurate judgment on the patient's condition and formulate an appropriate treatment plan. If retrospective review of the diagnostic results is needed, the entire image processing and analysis process, as well as related quantitative indicators, can be viewed at any time to ensure the accuracy and reliability of the diagnosis.
[0106] The significance of quantitative results for diagnosis is as follows: Nuclear density: This indicator reflects the degree of cell proliferation. In breast cancer diagnosis, a significantly higher nuclear density than normal tissue may suggest rapid tumor cell proliferation and a higher degree of malignancy. For example, a high nuclear density is often observed in invasive breast cancer, which helps doctors assess the tumor's invasiveness. Nuclear morphology parameters: The nuclei of normal cells have a relatively regular shape, while the nuclei of cancer cells usually exhibit morphological abnormalities, such as increased perimeter, irregular area, and decreased roundness. Analyzing these parameters can help doctors distinguish between normal cells and cancer cells, providing a basis for the early diagnosis of breast cancer. For example, in ductal carcinoma in situ, the morphological changes in the nuclei are quite obvious and can be identified through morphological parameters.
[0107] Positive cell nucleus ratio: The positive expression of different immunohistochemical markers (ER, HER2, PR) is closely related to the type of breast cancer and the treatment plan. For example, breast cancer patients who are ER and PR positive may be sensitive to endocrine therapy; while HER2 positive patients may be suitable for targeted therapy. The quantitative results of the positive cell nucleus ratio can accurately reflect the expression level of these markers and are an important basis for determining breast cancer subtypes and selecting treatment plans.
[0108] This invention provides a method and system for auxiliary diagnosis of breast cancer based on virtual staining, which can achieve the following beneficial technical effects:
[0109] 1. This application achieves simultaneous acquisition of ER / PR / HER2 equivalent information and quantitative results on a single HE slide through a single sampling and single-image summary, reducing the errors and workload associated with preparing multiple IHC slides and cross-slide registration. The generation constraint for clinical indicator alignment: the combined loss directly incorporates the consistency of positive regions, HER2 membrane ring continuity / coverage, and ER / PR nuclear-level statistics and grading alignment into the training objective, transforming the "virtual IHC that looks like it" into a "precisely quantifiable" one, thus improving the reliability of subsequent interpretations.
[0110] 2. This application employs nuclear density adaptive activation: It introduces an adaptive offset activation function based on local cell nuclear density to adaptively adjust the response under different tissue environments, such as dense glands or sparse stroma, reducing DAB oversaturation or under-suppression and enhancing adaptability to heterogeneous tissues. Domain robust constraints driven by staining / structural descriptors and combined loss mitigate the impact of chromatin differences and batch-to-batch fluctuations on generation and quantization, improving consistency across multiple institutions. Cell / pixel dual-scale closed loop: After aligning the DAB channel with the nuclear / cell instance segmentation results at the same scale, pixel-level and instance-level sampling are performed. ER / PR is quantized in units of "nucleus," and HER2 in units of "membrane ring," reducing bias caused by inconsistent statistical methods.
[0111] 3. This application facilitates physician verification and quality control by outputting overlay maps and structured reports of cancerous regions, nuclear / cell instance outlines, positive grades, and quantitative values, meeting the needs of scientific research and regulatory documentation. It saves time and costs, conserves tissue: No additional IHC reagents or duplicate sections are required, enabling rapid acquisition of key indicators in scenarios with limited tissue volume or time constraints, shortening the diagnostic cycle and reducing costs. It boasts strong engineering feasibility: Training samples can be obtained through "same-slice destaining-restaining" or "serial section precise registration"; the inference chain uses standard GAN inference + color deconvolution + segmentation and statistics, easily integrating with existing digital pathology platforms. It ensures stable training and numerical safety: Range / consistency constraints are introduced for activation and loss (such as parameter pruning, visual...). Figure 1 This improves consistency, reduces the risk of gradient explosion / vanishing, and makes large-scale WSI block training more stable.
[0112] 4. This invention introduces an improved activation mechanism of "kernel density adaptation + structure / stain perception" in the terminal network layer of the generator: on the one hand, a kernel density parameter (obtained and normalized from a lightweight kernel counter of the HE image) is added to adjust the activation offset, so that the model suppresses oversaturation in the dense glandular region and enhances weak positive response in the sparse stroma region; on the other hand, a structure / stain descriptor vector from the HE side (such as H channel mean / variance, background ratio, texture energy, deviation from the reference chromatin, etc.) is added to adjust the activation slope and set learnable upper and lower bounds and basic bias, automatically adapting to staining differences and brightness contrast fluctuations in different centers and batches. With the addition of learnable base offsets, scaling factors, and slope pruning, this improvement makes the DAB expression of the virtual IHC more stable and quantifiable without changing the backbone network and training strategy: the nuclear optical density statistics of ER / PR are more accurate, the proportion of positive nuclei is more stable, and the circumferential continuity and coverage of the HER2 membrane are more consistent, significantly reducing false positives / false negatives caused by domain shift and noise; at the same time, the adaptive and pruning constraints of the activation curve improve the stability of training numerical values and convergence speed, and enhance the robustness and interpretability of cross-institutional implementation.
[0113] The above provides a detailed description of a method and system for auxiliary diagnosis of breast cancer based on virtual staining. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas and methods of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for auxiliary diagnosis of breast cancer based on virtual staining, characterized in that, Including the following steps: S1: Obtain HE-stained section images of breast tissue, and perform enhancement preprocessing on the HE-stained section images; S2: Input the enhanced preprocessed HE staining slice image into a virtual staining model based on the Generative Adversarial Network (GAN) architecture to generate a virtual immunohistochemical staining image. The virtual staining model uses a joint loss function during training to improve the quality and accuracy of the generated image. S3: Perform image processing on the generated virtual immunohistochemical staining image; image processing includes: obtaining DAB channels through color deconvolution separation, and performing cancerous region segmentation and cell nucleus instance segmentation using a segmentation model trained with labeled data; and resampling and aligning the cancerous region segmentation and cell nucleus instance segmentation results with the DAB channels at the same scale and in the same coordinate system. S4: Within the range defined by the segmentation results of the cancerous region, pixel-level sampling is performed based on the aligned DAB channels and the segmentation results of cell nuclei to calculate parameters for breast cancer interpretation. The parameters include: cell nucleus density, cell nucleus morphology parameters, proportion of ER / PR positive cell nuclei, coverage of HER2 positive regions, area ratio of positive regions, and average optical density. S5: Generate auxiliary diagnostic results and / or structured reports based on the parameters and display them visually overlay.
2. The method for auxiliary diagnosis of breast cancer based on virtual staining as described in claim 1, characterized in that, The virtual coloring model includes a generator and a discriminator; the joint loss function includes at least any three of the following: (i) Consistency loss of positive expression region: Based on the DAB channel obtained by color deconvolution separation of the generated image and the real IHC image, the consistency of the DAB positive mask in the cancerous region between the two is constrained in terms of position and range. (ii) Loss of topological continuity of membrane ring: Using the cell membrane ring region obtained by extrapolation from the cell proof as a template, the circumferential connectivity and coverage of the DAB channel of the generated image on the membrane ring are constrained to be consistent with the real IHC, and breaks / holes are penalized. (iii) Nuclear-level statistical consistency / count preservation loss: Within the nucleus instance mask, the generated image is subjected to distribution matching with the mean, quantiles, and histogram of the DAB statistics of the real IHC, and the deviation of positive cell nucleus counts in the cancerous region is constrained; (iv) Color invariance consistency loss: Apply color matrix or intensity perturbation or normalization dithering to the input HE to constrain the DAB positive mask of the generated image under different perturbations to maintain a consistent spatial distribution, so as to improve domain robustness; (v) Clinical grade alignment loss: The generated image is input into an labeled or validated ER / PR / HER2 grading evaluator to minimize the order constraint / interval loss between the generated image and the real IHC grade, so that the generated result is consistent with the real IHC in negative / positive grades.
3. The method for auxiliary diagnosis of breast cancer based on virtual staining as described in claim 1, characterized in that, The color deconvolution separation uses a color matrix to obtain DAB channels; ER / PR positivity is graded based on the average optical density and area threshold of DAB, with cell nuclei as the unit; HER2 positivity is graded based on the DAB coverage of cell instances obtained by external expansion of cell nuclei around the cell membrane.
4. The method for auxiliary diagnosis of breast cancer based on virtual staining as described in claim 1, characterized in that, The segmentation model trained with labeled data is based on the Transformer architecture; and the nuclear instance segmentation is used to limit the range of determination of ER / PR positive cell nuclei and the calculation region of HER2 cell membrane grading.
5. The method for auxiliary diagnosis of breast cancer based on virtual staining as described in claim 1, characterized in that, Enhancement preprocessing is performed on the HE-stained slide images, including flipping the HE-stained slide images horizontally or vertically, and randomly adjusting the brightness and contrast of the HE-stained slide images to expand the graphic data samples.
6. The method for auxiliary diagnosis of breast cancer based on virtual staining as described in claim 1, characterized in that, For each instance of cell nucleus, mask N i The average optical density and / or quantile optical density are calculated on the aligned DAB channel and compared with a preset threshold to determine whether the nucleus is negative or positive. The ER / PR positive cell nucleus ratio is the ratio of the number of positive nuclei to the total number of nuclei. The cell nucleus density is the ratio of the total number of cell nucleus instances within the cancerous region mask to the area of that region. Cell nucleus morphology parameters include nuclear area, perimeter, and roundness. The positive region area ratio is the ratio of the area of positive pixels that meet the threshold on the DAB channel within the cancerous region mask to the area of that region. The average optical density is the average optical density of positive pixels on the DAB channel.
7. The method for auxiliary diagnosis of breast cancer based on virtual staining as described in claim 1, characterized in that, The cancerous region, cell nucleus / cell instance outline, ER / PR / HER2 positivity grade, and numerical results of the parameters are overlaid on a single slice image, and a structured report containing quantitative indicators and grading recommendations is output.
8. The method for auxiliary diagnosis of breast cancer based on virtual staining as described in claim 1, characterized in that, The generator of the virtual staining model employs an improved kernel density adaptive activation function f(x) in at least the last K network layers, where K ≥ 2. f(x)=x*σ(β p *xT) τ=τ0+r*n uc b p =clip(β0+α T d, b min ,b max ) Where x is the input to the activation function, σ() represents the Sigmoid activation function, τ0 is the learnable base offset scalar, and r is the learnable scaling factor scalar used to adjust the strength of the influence of the kernel density on the offset; n uc The normalized estimate of nuclear density is derived from a lightweight nuclear counter of the corresponding local block in the input HE image; β p The structure descriptor vector d from the input HE image is obtained through a learnable linear mapping and interval clipping; the structure descriptor vector d is the normalized deviation between the estimated chromaticity matrix and the reference chromaticity; K is the number of terminal network layers using this activation function; clip(β0+α) T d, β min ,β max ) represents β0+α T d is cut off to the interval [β] min ,β max Operators within ] are used for numerical stability; β min Let β be the lower boundary of the interval. max α represents the upper boundary of the interval; α is the learnable weight vector; T represents the transpose.
9. A breast cancer auxiliary diagnostic system based on virtual staining, characterized in that, The acquisition module acquires HE-stained section images of breast tissue and performs enhancement preprocessing on the HE-stained section images; The virtual staining model processing module inputs the enhanced preprocessed HE staining slice image into a virtual staining model based on the generative adversarial network (GAN) architecture to generate a virtual immunohistochemical staining image. The virtual staining model uses a joint loss function during training to improve the quality and accuracy of the generated image. The image processing module performs image processing on the generated virtual immunohistochemical staining image. The image processing includes: obtaining the DAB channel through color deconvolution separation, and performing cancerous region segmentation and cell nucleus instance segmentation using a segmentation model trained with labeled data; and resampling and aligning the cancerous region segmentation and cell nucleus instance segmentation results with the DAB channel at the same scale and in the same coordinate system. The parameter calculation module performs pixel-level sampling based on the aligned DAB channel and cell nucleus instance segmentation results within the range defined by the cancerous region segmentation results, and calculates parameters for breast cancer interpretation. The parameters include: cell nucleus density, cell nucleus morphology parameters, ER / PR positive cell nucleus ratio, HER2 positive region coverage, positive region area ratio, and average optical density. The visualization module generates auxiliary diagnostic results and / or structured reports based on the parameters and displays them in a visual overlay.
10. The breast cancer auxiliary diagnostic system based on virtual staining as described in claim 9, characterized in that, The virtual coloring model includes a generator and a discriminator; the joint loss function includes at least any three of the following: (i) Consistency loss of positive expression region: Based on the DAB channel obtained by color deconvolution separation of the generated image and the real IHC image, the consistency of the DAB positive mask in the cancerous region between the two is constrained in terms of position and range. (ii) Loss of topological continuity of membrane ring: Using the cell membrane ring region obtained by extrapolation from the cell proof as a template, the circumferential connectivity and coverage of the DAB channel of the generated image on the membrane ring are constrained to be consistent with the real IHC, and breaks / holes are penalized. (iii) Nuclear-level statistical consistency / count preservation loss: Within the nucleus instance mask, the generated image is subjected to distribution matching with the mean, quantiles, and histogram of the DAB statistics of the real IHC, and the deviation of positive cell nucleus counts in the cancerous region is constrained; (iv) Color invariance consistency loss: Apply color matrix or intensity perturbation or normalization dithering to the input HE to constrain the DAB positive mask of the generated image under different perturbations to maintain a consistent spatial distribution, so as to improve domain robustness; (v) Clinical grade alignment loss: The generated image is input into an labeled or validated ER / PR / HER2 grading evaluator to minimize the order constraint / interval loss between the generated image and the real IHC grade, so that the generated result is consistent with the real IHC in negative / positive grades.
Citation Information
Patent Citations
Cell nucleus immunohistochemical image segmentation method based on GAN model
CN118334343A
Image virtual dyeing method and device based on deep learning and related components
CN120125696A
Tumor budding automatic identification method fusing pathological staining migration and YOLO target detection
CN120495170A
Label-free virtual immunohistochemical staining of tissue using deep learning
US20250046069A1