Cell virtual staining method and system, computer equipment and storage medium
By employing multi-scale feature extraction and cross-domain mapping techniques, combined with end-to-end adversarial networks and adaptive instance normalization mechanisms, the problem of unclear boundaries in virtual cell staining was solved, achieving high-precision cell structure reconstruction and staining effects to meet clinical diagnostic needs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN LANDING TIANRAN MEDICAL IMAGING CO LTD
- Filing Date
- 2026-01-08
- Publication Date
- 2026-04-17
AI Technical Summary
Existing virtual cell staining techniques struggle to accurately capture edge details in densely packed cellular regions or complex morphologies, resulting in blurred or artifact-like areas at the junction of the cell nucleus and cytoplasm, which fails to meet clinical needs for identifying fine structures.
Employing multi-scale feature extraction and cross-domain mapping techniques, cell structure features are weighted through a region attention mechanism. Feature fusion is achieved by combining an end-to-end adversarial network, adaptive instance normalization, and cross-attention mechanism. A dual-branch feature extraction network is used to enhance cell boundary and category features. Clear stained images are generated through an image reconstruction module.
It significantly improves the display of fine structures such as cell nuclear membranes and chromatin distribution, ensures clear transitions in image reconstruction, meets clinical diagnostic needs, reduces experimental material and manual operation costs, and improves staining efficiency.
Smart Images

Figure CN121884337A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of cell detection, specifically relating to a virtual cell staining method, system, computer equipment, and storage medium. Background Technology
[0002] Cervical cytology is a crucial method for cervical cancer screening, and cell staining is a key step in revealing the morphological and structural information of the cell nucleus, cytoplasm, and surrounding tissues. Traditional chemical staining methods, such as Papanicolaou staining, typically involve multiple steps including sample fixation, staining, dehydration, and mounting. This process is complex, time-consuming, and requires the use of chemical reagents and manual operation. The procedure is as follows... Figure 1 As shown, sample preparation involves steps such as cell sampling, smear fixation, chemical staining, and dehydration mounting. This not only increases experimental costs but also results in inconsistent staining effects due to variations in experimental conditions, reagent quality, and operational procedures, thus affecting the accuracy and stability of cytological diagnosis.
[0003] To overcome the aforementioned problems, virtual staining techniques based on artificial intelligence and deep learning have emerged in recent years. This technique utilizes deep learning methods such as convolutional neural networks (CNNs), generative adversarial networks (GANs), and diffusion models to learn the mapping relationship between bright-field images of unstained cells and artificially stained images. The workflow of virtual staining technology is as follows: Figure 2 As shown, virtual staining is achieved by generating stained images through inputting images into a pre-trained network model, thus realizing virtual staining without the need for chemical reagents. This virtual staining method can shorten staining time, reduce experimental material consumption, and decrease dependence on operators to some extent. However, existing network structures neglect the feature modeling of cell boundaries and small-scale microstructures, making it difficult to accurately capture edge details in densely cellular regions or complex morphologies, leading to issues such as… Figure 3 The blurring or artifacts at the junction of the cell nucleus and cytoplasm shown make it difficult to meet the clinical needs for identifying fine structures. Summary of the Invention
[0004] To address the problem of unclear boundaries in existing virtual cell staining methods, this invention provides a virtual cell staining method, system, computer equipment, and medium.
[0005] To achieve the above objectives, the present invention provides the following technical solution: A method for virtual staining of cells, comprising: Obtain microscopic images of the cells to be stained; Multi-scale structural feature maps are extracted from microscopic images. Based on a region attention mechanism, the multi-scale structural feature maps are weighted to obtain the cell structure features of the cells to be stained. The weight of the boundary features is positively correlated with the cell nuclear density. Color distribution features are extracted from a pre-set reference staining image. The color distribution features are spatially aligned and semantically mapped with the cell structure features to obtain fused features. Image reconstruction is performed based on fusion features to obtain stained images of the cells to be stained.
[0006] Optionally, in a cell virtual staining method provided by the present invention, a staining image of the cell to be stained is obtained by processing a microscopic image and a reference staining image through an end-to-end adversarial network; the end-to-end adversarial network includes a dual-encoding architecture, a cross-domain mapping module and an image reconstruction module connected in sequence, and the dual-encoding architecture includes an unstained image encoder and a reference staining image encoder; Cellular structural features were obtained by processing microscopic images using an unstained image encoder. The color distribution features are obtained by processing the reference stained image using a reference stained image encoder. The color distribution features and cell structure features are processed by the cross-domain mapping module to obtain the fused features; The fusion features are processed by the image reconstruction module to obtain the stained image.
[0007] Optionally, the unstained image encoder includes a dual-branch feature extraction network and a fusion module connected in sequence. The dual-branch feature extraction network includes a parallel detail capture branch and a semantic extraction branch. The cell virtual staining method provided by this invention also includes: Cell boundary features are extracted from microscopic images using detail capture branches; Cell category features are extracted from microscopic images using a semantic extraction branch; Cell boundary features and cell category features are cross-fused using a gating mechanism through a fusion module to obtain cell structure features.
[0008] Optionally, the cell virtual staining method provided by the present invention further includes: Acquire microscopic images for training; The training microscopic images are input into the untrained unstained image encoder to obtain the training cell structure features; the training cell structure features and color distribution features are fused to obtain the training fused features; The adversarial loss function is calculated based on the fusion features used in training and the features of the stained images corresponding to the microscopic images used in training. The unstained image encoder is then optimized based on the adversarial loss function value to obtain the optimized unstained image encoder.
[0009] Optionally, the cell virtual staining method provided by the present invention further includes: Training morphological features and training texture features are obtained by decoupling the training cell structure features; The orthogonal constraint loss is determined by the correlation matrix of the training morphological features and the training texture features. The parameters of the uncolored image encoder are optimized based on the orthogonal constraint loss to obtain the uncolored image encoder.
[0010] Optionally, the cell virtual staining method provided by the present invention further includes: Based on the adaptive instance normalization mechanism, the statistical distribution of color distribution features and cell structure features in the feature space are aligned to obtain spatially aligned color distribution features and cell structure features. Based on the cross-attention mechanism, color distribution features and cell structure features are semantically fused to obtain fused features.
[0011] Optionally, the cell virtual staining method provided by the present invention further includes: The fused features are progressively upsampled to the resolution of the microscopic image to obtain an upsampled feature map; The edge sharpness of the upsampled feature map is optimized based on the anisotropic diffusion equation to obtain a boundary-optimized staining image. The color consistency of the boundary-optimized staining image is then optimized to obtain the staining image of the cells to be stained.
[0012] The present invention also provides a cell virtual staining system, comprising: The microscopic image acquisition module is used to acquire microscopic images of the cells to be stained; The feature fusion module is used to extract multi-scale structural feature maps from microscopic images. Based on the region attention mechanism, the multi-scale structural feature maps are weighted to obtain the cell structure features of the cells to be stained. The weight of the boundary features is positively correlated with the cell nuclear density. Color distribution features are extracted from a pre-set reference staining image. The color distribution features are spatially aligned and semantically mapped with the cell structure features to obtain the fused features. The image reconstruction module is used to reconstruct images based on fusion features to obtain stained images of the cells to be stained.
[0013] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement any of the steps in a cell virtual staining method.
[0014] The present invention also provides a computer-readable storage medium storing a computer program that, when loaded by a processor, can perform any step of a cell virtual staining method.
[0015] The cell virtual staining method provided by this invention has the following beneficial effects: The cell virtual staining method provided by this invention extracts multi-scale structural feature maps from microscopic images, simultaneously capturing the microscopic details and macroscopic morphological features of cell boundaries, providing a complete geometric information basis for the junction region. Based on the region attention mechanism, the feature maps are weighted, enabling the network to automatically focus on the dense nucleus region and the nucleoplasmic junction. Through the design that the weight is positively correlated with the nucleus density, the feature response intensity of the junction region is significantly enhanced, ensuring that the fine structure of the nucleoplasmic boundary has been specifically enhanced before feature fusion. This ensures that the reconstructed image can accurately restore the clear transition of the nucleoplasmic junction, eliminate artifacts, and significantly improve the display effect of fine structures such as the nuclear membrane and chromatin distribution, meeting the high-precision requirements of clinical diagnosis for the identification of cell substructures. Attached Figure Description
[0016] To more clearly illustrate the embodiments and design schemes of the present invention, the accompanying drawings required for this embodiment will be briefly described below. 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.
[0017] Figure 1 This is an example of a traditional cell staining procedure; Figure 2 This is an example of an existing virtual cell staining workflow; Figure 3 Example of existing cell staining; Figure 4 This is a schematic diagram of a virtual cell staining method provided in an embodiment of the present invention; Figure 5 This is an example of a virtual cell staining process provided in an embodiment of the present invention; Figure 6 This is a cell staining example provided in an embodiment of the present invention. Detailed Implementation
[0018] To enable those skilled in the art to better understand and implement the technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and should not be construed as limiting the scope of protection of the present invention.
[0019] Example 1 This invention provides a method for virtual cell staining, specifically as follows: Figure 4 As shown, it includes the following steps: Step 11: Obtain microscopic images for training.
[0020] Step 12: Input the training microscopic image into the untrained unstained image encoder to obtain the training cell structure features; fuse the training cell structure features and color distribution features to obtain the training fused features.
[0021] Step 13: Calculate the adversarial loss function based on the fusion features used in training and the features of the stained images corresponding to the microscopic images used in training. Optimize the unstained image encoder based on the adversarial loss function value to obtain the optimized unstained image encoder.
[0022] Step 14: Decouple the training cell structure features to obtain the training morphological features and training texture features.
[0023] Step 15: Determine the orthogonal constraint loss from the correlation matrix of the training morphological features and the training texture features, optimize the parameters of the uncolored image encoder based on the orthogonal constraint loss, and obtain the uncolored image encoder.
[0024] Step 16: Obtain microscopic images of the cells to be stained.
[0025] Step 17: Extract multi-scale structural feature maps from the microscopic image. Weight the multi-scale structural feature maps using a region attention mechanism to obtain the cell structure features of the cells to be stained. The weight of boundary features is positively correlated with the cell nuclear density. Extract color distribution features from a pre-set reference stained image. Spatially align and semantically map the color distribution features with the cell structure features to obtain fused features. For example, an end-to-end adversarial network processes the microscopic image and the reference stained image to obtain the stained image of the cells to be stained. The end-to-end adversarial network includes a dual-encoding architecture, a cross-domain mapping module, and an image reconstruction module connected in sequence. The dual-encoding architecture includes an unstained image encoder and a reference stained image encoder. The unstained image encoder processes the microscopic image to obtain cell structure features; the reference stained image encoder processes the reference stained image to obtain color distribution features; the cross-domain mapping module processes the color distribution features and cell structure features to obtain fused features.
[0026] The unstained image encoder includes a dual-branch feature extraction network and a fusion module connected in sequence. The dual-branch feature extraction network includes a parallel detail capture branch and a semantic extraction branch. Cell structure features can be determined through the following steps: Step 171: Extract cell boundary features from the microscopic image through the detail capture branch.
[0027] Step 172: Extract cell category features from the microscopic image through the semantic extraction branch.
[0028] Step 173: The cell boundary features and cell category features are cross-fused using a gating mechanism through the fusion module to obtain cell structure features.
[0029] Specifically, such as Figure 5 As shown, the present invention first extracts the microscopic image to be virtually stained by the image acquisition module, and performs preprocessing such as denoising on the microscopic image by the preprocessing module. Then, the feature extraction module extracts features from the image. For example, the unstained microscopic image and the reference stained image are processed separately by a dual encoder architecture. The unstained image encoder extracts the structural features of cells, such as the morphology of the cell nucleus and geometric information such as the distribution of cytoplasm, from the unstained microscopic image, and the reference stained image encoder extracts the color distribution features from the reference stained image.
[0030] The unstained image encoder can be a dual-branch feature extraction network. The detail capture branch enhances the sharpness of cell boundaries through high-frequency filters and uses small-stride convolutions to preserve spatial detail information, resulting in cell boundary features for providing accurate spatial localization. The semantic extraction branch understands the cell category attributes and region division through deep networks, resulting in cell category features for providing semantic guidance. Then, the high-level cell category features and the low-level cell boundary features complement each other through top-down and bottom-up paths.
[0031] Furthermore, both the detail capture branch and the semantic extraction branch employ multi-level convolutional processing to extract and fuse features from the microscopic image. For example, shallow networks focus on pixel-level edge detail detection, using small receptive field convolutional kernels to extract the subtle contours of the cell membrane; mid-level networks expand the receptive field and integrate local edge information to form complete cell boundaries; and deep networks understand the overall morphology of the cell boundaries from a semantic perspective, ultimately obtaining cell boundary features and cell category features respectively. The input feature map is X, the first... Layered convolution features As shown in formula (1):
[0032] (1) in, It is the ReLU activation function. and For convolution parameters, This indicates a convolution operation. Afterwards, the features from each level are fused using a feature pyramid structure, as shown in formula (2):
[0033] (2) in, For the first The layered pyramid features are the backbone features of the corresponding layers, thus ensuring that boundary information from the micro to the macro level is completely preserved.
[0034] After multi-scale feature extraction, these feature maps are weighted using a region attention mechanism to ensure the network automatically focuses on regions with dense cell nuclei. The weights of the region attention mechanism are... As shown in formula (3):
[0035] (3) Where F is the weight of the region attention. Corresponding features, weighted features , This indicates element-wise multiplication.
[0036] Subsequently, the features of the two branches were cross-fused at multiple scales based on a gating mechanism to obtain fused cellular structural features. As shown in formulas (4) and (5): (4) (5) in, This represents a gating signal, where the value of each element is determined by the Sigmoid function. For the Sigmoid activation function, This is the weight matrix for the gating mechanism. This represents a feature concatenation operation involving multiple branches, where For high-resolution feature maps, This is a low-resolution feature map. For gating mechanism bias. The image is an upsampled version of the low-resolution feature map.
[0037] Furthermore, during the model training phase, this invention also learns features such as the roundness and size distribution of the cell nucleus and the granular texture of the cytoplasm by using the training cell structure features corresponding to the training microscopic images. Combined with the context awareness module, it uses the arrangement pattern of surrounding cells to assist in the accurate identification of individual cells, and performs optimization processing specifically for overlapping cell regions.
[0038] The fusion features can be constructed through the following steps: Step 174: Based on the adaptive instance normalization mechanism, the statistical distribution of the feature space of color distribution features and cell structure features is aligned to obtain spatially aligned color distribution features and cell structure features.
[0039] Step 175: Based on the cross-attention mechanism, semantically fuse color distribution features and cell structure features to obtain fused features.
[0040] Specifically, such as Figure 5As shown, after the dual encoder architecture completes the extraction of color distribution features and cell structure features, the cross-domain mapping module aligns the statistical distributions of the feature spaces corresponding to the two types of features using adaptive instance normalization technology, as shown in formula (7): (7) in, For the aligned features, These are the content features corresponding to the high-resolution structure map. The style features corresponding to the low-resolution staining prior. The mean of the content features. The standard deviation of content features The mean of the style features. The standard deviation of the style features is used to achieve style transfer at the feature level from the reference stained image to the microscopic image. Then, through feature projection, such as a transformation function... Cellular structural features Mapped to a shared latent space z that can simultaneously accommodate structural and color information, as shown in Equation (8):
[0041] (8) Then, using a semantic alignment mechanism, the correspondence between cell structures is established in the latent space, with its attention weights... As shown in formula (9): (9) in, Let be the query vector at the i-th position in the cell structure features. Let be the key vector at the j-th position in the color distribution features. Let k be the key vector at the k-th position in the color distribution feature, where k is the summation index used to traverse all possible positions or feature points in the color distribution feature, thus ensuring that cell structures of the same type can be matched with the correct staining pattern. Finally, the content feature and style feature are separated through the style transfer module to achieve color conversion while preserving structure, applying the staining characteristics of the reference stained image to the structural features of the microscopic image. The entire process maintains the integrity of cell morphology without damage.
[0042] Furthermore, during the training of the adversarial model, the adversarial loss function As shown in formula (10): (10) in, The expected value is determined by calculating the average of the losses across all samples. For realistic stained images, The original microscopic image to be stained is denoted by G, which is the generator in the adversarial training process, and D is the discriminator in the adversarial training process. Through the adversarial training strategy, the feature extraction network is prompted to generate domain-invariant feature representations. Among them, the feature adaptation layer adopts a learnable transformation matrix to gradually reduce the feature distribution differences between different staining styles. The specific distribution distance is measured by MMD, as shown in formula (11):
[0043] (11) in, To maximize the difference in means, m and n are the number of samples drawn from the two distributions, respectively. and Let i and j be individual samples drawn from the two distributions, respectively, where i and j are the summation indices of the two distributions. Let H be the feature mapping function, and H be the reproducing kernel Hilbert space. For example, model training can be achieved by jointly minimizing adversarial loss and patch-based contrastive loss (PatchNCE Loss). Here, adversarial loss... Training fusion features can be generated by an uncolored image encoder The contrast loss is determined by calculating and comparing the real features extracted from the corresponding real stained image with those based on image patches. Trained using fused features at multiple scales The content matching degree between the content and the ground truth features extracted from the corresponding real-world stained image is determined. Then, it is determined by adversarial loss. Compared with loss The joint loss function is used to optimize and update the trainable parameters of the uncolored image encoder, the multi-scale feature extraction branch, and the gated fusion module using gradient descent. Meanwhile, the discriminator parameters are alternately optimized by maximizing the adversarial loss. This process is iterated until the model converges, ultimately yielding the optimized uncolored image encoder.
[0044] In this embodiment, to improve the model's feature consistency and discriminative ability at the local region (patch) level, a contrastive learning approach is introduced to construct the PatchNCE loss function. This loss enhances the model's ability to encode local textures and structures by maximizing the similarity of positive sample features while minimizing the similarity with a large number of negative sample features.
[0045] Specifically, after the input image passes through the encoder, it obtains local feature vectors at several locations. For each location i, a definition is defined. Features (queries) originating from the target domain or after transformation. To and Features corresponding to the same spatial location (positive key), i.e. positive sample features. To and Negative keys are features without a corresponding relationship, i.e., other spatial locations in the image or other images, totaling M. All of the above feature vectors need to undergo L2 normalization, and to control the "sharpness" of the feature similarity distribution, a temperature coefficient greater than 0 can be used. Scaling the dot product similarity for each transformed feature The contrast loss for a single patch is shown in Equation (12):
[0046] (12) in, Formula (12) is based on the temperature coefficient Explicitly written out, as shown in formula (13): (13) Overall comparative loss The average value for all positions is given by formula (14): (14) in, Let N be the average loss across all patches, and N be the total number of patches.
[0047] Step 18: Reconstruct the image based on the fusion features to obtain a stained image of the cells to be stained. For example, the stained image is obtained by processing the fusion features through the image reconstruction module.
[0048] Step 18 includes: Step 181: Progressively upsample the fused features to the resolution of the microscopic image to obtain the upsampled feature map.
[0049] Step 182: Optimize the edge sharpness of the upsampled feature map based on the anisotropic diffusion equation to obtain a boundary-optimized staining image. Optimize the color consistency of the boundary-optimized staining image to obtain the staining image of the cells to be stained.
[0050] Specifically, such as Figure 5 As shown, after the cross-domain mapping from the unstained feature space corresponding to the microscopic image to the target stained feature space of the reference stained image is completed, the image reconstruction module reconstructs the stained image corresponding to the microscopic image through multiple upsampling operations. Specifically, the adapted features are gradually restored to their resolution through a progressive upsampling network, and the upsampling operation is shown in formula (15):
[0051] (15) in, This is the upsampled high-resolution image. For upsampling, This is a convolution operation.
[0052] After each level of upsampling, a residual refinement module connected via short-circuit passes low-level detail information to eliminate artifacts and noise, thus achieving local refinement. Next, cell boundaries are detected based on an edge-aware reconstruction mechanism, and a special convolution strategy is used in these regions using an anisotropic diffusion equation to protect edge sharpness. Finally, a color consistency optimization module ensures uniform coloring and visual naturalness across the entire image, resulting in an image as shown below. Figure 6 The stained image is shown. The anisotropic diffusion equation is shown in equation (16):
[0053] (16) in, For example, the diffusion coefficient can be obtained using the Perona-Malik model, through... Sure, This is the gradient threshold parameter.
[0054] For example, firstly, fused cellular structure features with a spatial resolution of 1 / 8 of the input image are... In the input image reconstruction module, the fused cell structure features are processed by an upsampling network consisting of three consecutive transposed convolutional layers. Transposed convolutions are performed, with each consecutive transposed convolutional layer forming a cascaded upsampling-refining block. First, an upsampling kernel with a stride of 2 and a kernel size of 4×4 is used to double the spatial resolution of the input feature map. Then, a feature refining convolutional block, consisting of a 3×3 convolutional layer, a ReLU activation function layer, and a batch normalization layer, refines the features. Within each upsampling-refining block, corresponding low-level feature maps with the same spatial resolution from the encoder path of the uncolored image are introduced through skip connections and channel concatenation, fusing them with the currently upsampled feature map. Finally, through three levels of upsampling and refining, a preliminary reconstructed feature map with the same spatial resolution as the input image is obtained. .
[0055] Then, edge sharpening based on anisotropic diffusion is used to reconstruct the initial feature map. Processing is performed to enhance the clarity of cell boundaries while suppressing noise in homogeneous regions. For example, anisotropic diffusion equations are applied, and optimization is achieved by iteratively solving the partial differential equations shown in formula (13). After each iteration, the contrast at cell boundaries is enhanced, and the cell interior and background regions become smoother. For example, after 10 iterations, a boundary-optimized stained image is obtained. .
[0056] Finally, the boundary-optimized stained image Converting from the RGB color space to the Lab color space ensures that the generated stained image maintains color style consistency with the target stained technique. For example, first, calculate the global color statistics, such as the color mean, on channels a and b of the target stained image dataset within this color space. and color standard deviation Then, the boundary-optimized stained image is calculated. Mean values on channels a and b and standard deviation The subsequent boundary-optimized colored image. A linear transformation is performed on the a and b color channels to obtain an image with optimized color consistency. As shown in formula (17):
[0057] (17) in, A colorized image optimized for the boundaries of corresponding color channels, such as color channel a and color channel b. The image is optimized for color consistency for this color channel. Finally, the color consistency optimized image is converted from the Lab color space back to the RGB color space to obtain the final stained image. Furthermore, the final stained image is displayed and the corresponding data is stored through a result display and storage module.
[0058] In summary, the virtual cell staining method provided by this invention utilizes multi-scale feature extraction and cross-domain mapping to accurately restore the features of the cell nucleus, cytoplasm, and boundaries, significantly reducing edge blurring and artifacts. Furthermore, it performs high-fidelity reconstruction of internal cellular microstructures such as the nuclear membrane and chromatin distribution, helping doctors accurately determine cell morphology and ensuring the staining accuracy and structural fidelity of virtual cell staining. Moreover, the use of normalized preprocessing and adaptive mapping strategies ensures stable staining results under different laboratory conditions, microscope equipment, and lighting conditions. In cross-sample and cross-device validation experiments, it exhibits high SSIM and PSNR values, approximately 12%-15% higher than existing staining methods. In addition, the virtual cell staining method provided by this invention eliminates the need for chemical staining agents and complex manual operations, significantly reducing experimental consumables and labor costs. Furthermore, the virtual staining time for a single cervical cell image is less than 0.5 seconds, saving several hours of operation time compared to traditional chemical staining methods. Furthermore, the virtual cell staining method provided by this invention can process cervical cell images in batches and store the results directly in a database, facilitating remote diagnosis and data management. It can also be combined with automated microscope acquisition to achieve rapid screening and improve clinical work efficiency.
[0059] Specifically, by introducing an end-to-end adversarial network comprising a dual-encoding architecture, a cross-domain mapping module, and an image reconstruction module, a collaboratively optimized virtual staining framework was constructed. The unstained image encoder and the reference stained image encoder can focus on extracting cell structural information and color style, respectively. The cross-domain mapping module then performs precise feature fusion, and finally, the image reconstruction module generates the image. This clearly defined division of labor ensures efficient and controllable fusion of cell structural content and the staining style of the reference image at the feature level. This significantly reduces blurring or color distortion at the nucleoplasmic junction caused by style-content mismatch, resulting in a higher fidelity in the generated stained image regarding fine structures such as cell nuclear morphology and chromatin distribution.
[0060] The unstained image encoder employs a dual-branch architecture with parallel detail capture and semantic extraction branches, fused through a gating mechanism. The detail capture branch effectively enhances the sharpness of cell boundaries, providing accurate spatial localization, while the semantic extraction branch offers a higher-level understanding of cell categories and region divisions, providing semantic guidance. The gating mechanism dynamically fuses the two information based on feature importance, enabling the network to simultaneously preserve both the microscopic details and macroscopic morphology of cell boundaries. It particularly strengthens the feature expression of key regions such as the cell nucleus edge, effectively avoiding boundary blurring or detail loss that might occur with single feature extraction. This lays a solid structural foundation for generating clear and accurate stained images.
[0061] Furthermore, the model training optimization strategy includes preliminary optimization based on adversarial loss and fine optimization based on orthogonal constraint loss. This joint optimization strategy greatly improves the model's feature decoupling ability and generalization performance, ensuring that the model can still stably extract highly discriminative structural features when facing complex cell structures or overlapping cell regions. This fundamentally reduces the risk of reconstruction artifacts caused by insufficient training or feature entanglement, and guarantees the reliability and stability of virtual staining results.
[0062] The model achieves spatial alignment and semantic mapping of features through adaptive instance normalization and cross-attention mechanisms. Adaptive instance normalization aligns the statistical distribution of the feature space, completing the initial style transfer. The cross-attention mechanism, building upon this, establishes a fine semantic correspondence between cell structures and target staining styles in the latent space. This two-step fusion strategy enables pixel-level accurate color transfer, ensuring that color is accurately applied to the corresponding cell substructures such as the nucleus and cytoplasm. This effectively avoids visual artifacts caused by color bleeding, misalignment, or unevenness, significantly improving the color accuracy and consistency of structure-color correspondence in stained images.
[0063] Furthermore, progressive upsampling and residual connection can gradually restore high-resolution details and suppress artifacts; the anisotropic diffusion equation can specifically enhance cell boundary contrast while smoothing homogeneous areas; and the final color consistency optimization ensures uniform staining of the entire image, effectively protecting the sharpness of cell edges during the magnification process in the image generation stage, preventing edge blurring, and eliminating local color differences through post-processing optimization. The final output is a high-quality stained image with clear boundaries, uniform color, and rich details, which greatly meets the clinical diagnostic needs for the recognition of fine image structures.
[0064] Example 2 The present invention also provides a cell virtual staining system, comprising: The microscopic image acquisition module is used to acquire microscopic images of the cells to be stained; The feature fusion module is used to extract multi-scale structural feature maps from microscopic images. Based on the region attention mechanism, the multi-scale structural feature maps are weighted to obtain the cell structure features of the cells to be stained. The weight of the boundary features is positively correlated with the cell nuclear density. Color distribution features are extracted from a pre-set reference staining image. The color distribution features are spatially aligned and semantically mapped with the cell structure features to obtain the fused features. The image reconstruction module is used to reconstruct images based on fusion features to obtain stained images of the cells to be stained.
[0065] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps in an embodiment of a cell virtual staining method. Specific implementation methods can be found in the method embodiments, and will not be repeated here.
[0066] Furthermore, the present invention also provides a non-transitory computer-readable storage medium containing instructions on which a computer program is stored. For example, a memory containing instructions that can be executed by a processor of a computer device to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc. When the computer program is executed by the processor, it can implement the steps in an embodiment of a cell virtual staining method. Specific implementation methods can be found in the method embodiments, which will not be repeated here.
[0067] Those skilled in the art will understand that embodiments of the present invention can provide methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0068] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0069] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0070] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0071] It should be noted that the specific embodiments described above enable those skilled in the art to more fully understand the present invention, but do not limit the present invention in any way. Therefore, although the present invention has been described in detail in this specification and embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the present invention; and all technical solutions and improvements that do not depart from the spirit and scope of the present invention are covered within the protection scope of the present invention patent. No reference numerals in the claims should be construed as limiting the scope of the claims. Any simple variations or equivalent substitutions of technical solutions that can be readily obtained by those skilled in the art within the scope of the technology disclosed in the present invention are within the protection scope of the present invention.
Claims
1. A method for virtual cell staining, characterized in that, include: Obtain microscopic images of the cells to be stained; Multi-scale structural feature maps are extracted from the microscopic images. The multi-scale structural feature maps are weighted based on a region attention mechanism to obtain the cell structure features of the cells to be stained. The weight of the boundary features is positively correlated with the cell nuclear density. Color distribution features are extracted from a pre-set reference staining image. The color distribution features are spatially aligned and semantically mapped with the cell structure features to obtain fused features. Image reconstruction is performed based on the fusion features to obtain the stained image of the cells to be stained.
2. The method of claim 1, wherein the method is performed in silico. The end-to-end adversarial network processes the microscopic image and the reference stained image to obtain the stained image of the cell to be stained. The end-to-end adversarial network includes a dual coding architecture, a cross-domain mapping module and an image reconstruction module connected in sequence. The dual coding architecture includes an unstained image encoder and a reference stained image encoder. The cell structure features are obtained by processing the microscopic image using the unstained image encoder. The reference stained image is processed by the reference stained image encoder to obtain the color distribution features; The cross-domain mapping module processes the color distribution features and cell structure features to obtain the fused features; The fusion features are processed by the image reconstruction module to obtain the stained image.
3. The method of claim 2, wherein the cell virtual staining method is characterized by, The unstained image encoder includes a dual-branch feature extraction network and a fusion module connected in sequence. The dual-branch feature extraction network includes a parallel detail capture branch and a semantic extraction branch. The cell structure features obtained by processing the microscopic image through the unstained image encoder include: Cell boundary features are extracted from the microscopic image using the detail capture branch; Cell category features are extracted from the microscopic image through the semantic extraction branch; The cell boundary features and cell category features are cross-fused using a gating mechanism by the fusion module to obtain the cell structure features.
4. The method of claim 2, wherein the cell virtual staining method is characterized by, Before processing the microscopic image by the unstained image encoder, the process further includes: Acquire microscopic images for training; The training microscopic image is input into an untrained, unstained image encoder to obtain training cell structure features; the training cell structure features and color distribution features are fused to obtain training fused features; The adversarial loss function is calculated based on the fusion features used for training and the features of the stained image corresponding to the microscopic image used for training. The unstained image encoder is then optimized based on the adversarial loss function value to obtain the optimized unstained image encoder.
5. The method of claim 4, wherein the cell virtual staining method is characterized by, After obtaining the structural features of the training cells, the following is also included: The training morphological features and training texture features are obtained by decoupling the training cell structure features. The orthogonal constraint loss is determined by the correlation matrix of the training morphological features and the training texture features. The parameters of the uncolored image encoder are optimized based on the orthogonal constraint loss to obtain the uncolored image encoder.
6. The cell virtual staining method according to claim 1, characterized in that, Spatially aligning and semantically mapping the color distribution features with the cell structure features yields the following fused features: Based on the adaptive instance normalization mechanism, the statistical distribution of the color distribution features and cell structure features in the feature space is aligned to obtain spatially aligned color distribution features and cell structure features. The color distribution features and cell structure features are semantically fused based on the cross-attention mechanism to obtain the fused features.
7. The cell virtual staining method according to claim 1, characterized in that, Image reconstruction based on the fusion features yields the stained image of the cells to be stained, including: The fused features are progressively upsampled to the resolution of the microscopic image to obtain an upsampled feature map; The edge sharpness of the upsampled feature map is optimized based on the anisotropic diffusion equation to obtain a boundary-optimized staining image. The color consistency of the boundary-optimized staining image is then optimized to obtain the staining image of the cell to be stained.
8. A cell virtual staining system, characterized in that, include: The microscopic image acquisition module is used to acquire microscopic images of the cells to be stained; The feature fusion module is used to extract multi-scale structural feature maps from the microscopic image, and to obtain the cell structure features of the cells to be stained by weighting the multi-scale structural feature maps based on the region attention mechanism, wherein the weight of the boundary features is positively correlated with the cell nuclear density; and to extract color distribution features from a pre-set reference staining image, and to spatially align and semantically map the color distribution features with the cell structure features to obtain the fused features. The image reconstruction module is used to reconstruct the image based on the fusion features to obtain a stained image of the cell to be stained.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the cell virtual staining method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is loaded by the processor, it is able to perform the steps of the cell virtual staining method according to any one of claims 1 to 7.