Method for rapidly obtaining virtual immunohistochemical staining section during operation
Through the deep learning method based on the consistency network, the problem of difficulty in obtaining immunohistochemical tissue staining sections during surgery is solved, virtual IHC staining images can be generated quickly and economically, and the pathological diagnosis process is simplified.
Patent Information
- Application Number
- CN202410535177.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2024-09-27
AI Technical Summary
It is difficult to quickly obtain the patient's immunohistochemistry tissue stained section images during the operation. The existing technology has problems such as complicated staining process, long time consumption and high cost.
A neural network method based on the consistency network is designed to convert HE staining into IHC staining images in stages. Through the steps of data preprocessing, freezing to normal temperature conversion and HE staining into IHC staining, deep learning technology is used to generate virtual IHC staining. Tissue section images.
It realizes the rapid acquisition of IHC stained tissue section images during the operation, reducing the examiner's preparation and staining time and costs. The generated virtual IHC stained image and the HE stained image are aligned at the pixel level, making it easier for pathologists to compare.
Smart Images

Figure CN118710487A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital pathology, and in particular to a method for rapidly acquiring virtual immunohistochemical staining sections during surgery based on deep learning technology. Background Art
[0002] Pathological tissue sectioning is a commonly used method in medical diagnosis. It is done by cutting tissue samples into thin slices and then staining them to show specific parts of cells and tissue structures. Paraffin section is a commonly used sectioning technique in pathological histology. It involves fixing, washing, dehydrating, paraffin embedding, slicing and staining the patient's diseased tissue samples, and finally observing and analyzing them under a microscope for disease diagnosis and tissue health assessment. The entire sectioning process usually takes several hours or even a day to complete. Frozen section is a rapid sectioning method that rapidly freezes tissue samples under low temperature conditions and sections them after they reach a certain hardness. Compared with paraffin sectioning, the production process of frozen section is faster and simpler, and is often used for rapid pathological diagnosis during surgery. It usually only takes tens of minutes to an hour to make a frozen section.
[0003] HE staining (H&E stain, hematoxylin and eosin stain) is one of the most commonly used staining methods in histology. It uses hematoxylin dye to dye the basophilic structure of cells and tissues into blue-purple, and uses eosin dye to dye the eosinophilic structure into pink. HE staining can help pathologists evaluate the overall structure and morphology of tissues, including the morphology, size, arrangement of cells, and structural characteristics of tissues. By observing HE-stained tissue sections, diseases can be diagnosed and the health status of tissues can be evaluated. Immunohistochemical staining (IHC stain, immunohistochemical stain) is an immunostaining technique that uses specific antibodies to bind to antigens in tissues to selectively detect the presence of target antigens in tissue sections or smears. This staining method can determine the expression and location of antigens and improve the sensitivity and specificity of pathological diagnosis. Immunohistochemical staining includes steps such as antigen retrieval, background blocking, primary antibodies, secondary antibodies, staining and sealing, and the entire process usually takes more than several hours. Immunohistochemical staining is usually performed on paraffin sections.
[0004] HE-stained frozen sections can provide rapid histological diagnosis results during surgery. This is crucial for determining the scope of surgery, confirming tissue boundaries, identifying tumor types, etc. However, HE staining can only provide basic information about tissue morphology, cell structure, and tissue distribution. In some cases, it is necessary to observe immunohistochemical staining sections to further confirm or exclude possible lesion types and guide the choice of treatment options. Due to the complicated immunohistochemical staining process, high staining costs, long time, and many problems with the immunohistochemical staining technology of frozen sections, it is impossible to obtain immunohistochemical staining sections of patient tissue samples during surgery using conventional means. Therefore, how to obtain immunohistochemical staining section images during surgery is a problem that the detector needs to solve. Summary of the invention
[0005] The purpose of the present invention is to solve the problem that it is difficult to obtain immunohistochemical tissue staining sections of patients during surgery and propose a method for quickly obtaining virtual immunohistochemical staining sections during surgery. On this basis, a neural network training method for converting staged HE staining into IHC staining images based on a consistency network is designed. The technical solution is as follows:
[0006] Step 1, data preprocessing step, after obtaining the original frozen section HE-stained pathological section digital image of the surgical patient by conventional technology, the original digital image is gridded, and the original digital image is cut into multiple image blocks. Each image block is screened to obtain an image block containing effective tissue. The specific method is: calculate the gray entropy of each image block and the image structure similarity (Structure Similarity, SSlM) value with the reference image block, set the gray entropy threshold and the structure similarity threshold respectively, and use the two thresholds to jointly screen the HE-stained image blocks that meet the requirements. The purpose of screening is to remove the background and some non-ROI areas.
[0007] Step 2, frozen to room temperature conversion step, input the image block containing the effective tissue into the pre-trained neural network for converting the frozen section HE staining image into the paraffin section HE staining image, and output the corresponding virtual paraffin section HE staining image. The training of the neural network for converting the frozen section HE staining image into the paraffin section HE staining image includes the following steps:
[0008] Obtain paraffin section HE-stained tissue whole section images and frozen section HE-stained tissue whole section images, cut the two HE-stained whole section images into image blocks, and screen out image blocks containing valid tissues. Thus, a data set consisting of paraffin section HE-stained image blocks and frozen section HE-stained image blocks is obtained;
[0009] Construct a neural network component, including a frozen-paraffin conversion network consisting of three modules: an encoding module, a conversion module, and a decoding module, and a paraffin section identification network, wherein:
[0010] The encoding module is used to extract image features of the slice image, the conversion module is used to align the style of the frozen section HE-stained tissue image block with the style of the paraffin section HE-stained tissue image block, the decoding module is used to finally output the converted paraffin section HE-stained tissue image block, the entire conversion network is used to convert the input frozen section HE-stained image block into a virtual paraffin section HE-stained image block, and the identification network is used to determine whether the input paraffin section HE-stained image block belongs to a real paraffin section HE-stained image block or a converted paraffin section HE-stained image block.
[0011] During the training phase, the paraffin section HE-stained image blocks in the above dataset are used as style images, and the frozen section HE-stained image blocks are used as content images. Each iteration round accepts a batch of equal number of style and content images as input. The frozen-paraffin converter accepts a pair of style-content images in different pairing methods and outputs a virtual paraffin section HE-stained image with the style of the style image converted from the content image. The identification network accepts real or virtual paraffin section HE-stained images and outputs identification results.
[0012] The loss functions used in training include an adversarial loss function calculated using the output of the identification network and the true label; a style difference loss function calculated using the style of a virtual paraffin section HE-stained image extracted by a pre-trained style feature extractor and the style of the corresponding style image; a content difference loss function calculated using the content of a virtual paraffin section HE-stained image extracted by a pre-trained content feature extractor and the content of the corresponding content image; a style contrast loss function calculated using the style features extracted from a transformed image obtained by inputting different style images / different content images; a content contrast loss function calculated using the content features extracted from a transformed image obtained by inputting different style images / different content images; and a content contrast loss function calculated using the content features extracted from a transformed image obtained by inputting different style images / different content images. The above loss functions are calculated and the network parameters are updated using a gradient descent algorithm. After multiple iterative training, the above loss functions are minimized, and the neural network parameters for converting the frozen section HE-stained image into the paraffin section HE-stained image are saved.
[0013] Step 3, HE staining is converted to IHC staining step, the virtual paraffin section HE staining image is respectively input into the pre-trained HE staining to IHC staining image neural network corresponding to the required IHC staining, and the required virtual IHC staining image block is output. The training of the neural network for converting HE staining to IHC staining image includes the following steps:
[0014] Get the HE-stained tissue slice image and its corresponding IHC-stained tissue slice image obtained by continuous slicing of the same tissue sample, align the HE-IHC image pair, cut it into image blocks, and screen the image blocks containing valid tissues. Thus, a data set consisting of one-to-one corresponding HE-IHC image block pairs is obtained;
[0015] Construct neural network components, including HE to IHC network, IHC to HE network, HE identification network, IHC identification network, and similarity calculation network, wherein: the HE to IHC network is responsible for converting the input HE stained image block into a virtual IHC stained image block, the IHC to HE network is responsible for converting the input real IHC stained image block into a virtual HE stained image block, the HE identification network is responsible for judging whether the input real HE stained image block belongs to a real HE stained image block or a virtual HE stained image block, the IHC identification network is responsible for judging whether the input IHC stained image block belongs to a real IHC stained image block or a virtual IHC stained image block, and the similarity calculation network is responsible for judging whether a pair of input real IHC stained images and virtual IHC stained images are consistent in pathological semantics.
[0016] In the first stage of training, the HE and IHC stained image blocks in the data set composed of the above HE-IHC image block pairs are respectively input into the HE to IHC network and the IHC to HE network to obtain the corresponding virtual IHC stained image blocks and virtual HE stained image blocks, which are respectively input into the HE identification network and the IHC identification network to obtain the identification results, and then the virtual IHC stained image blocks and the virtual HE stained image blocks are respectively input into the IHC to HE network and the HE to IHC network to obtain the restored HE stained image blocks and the restored IHC stained image blocks.
[0017] The loss functions used in training include the adversarial loss function calculated by using the results of the HE identification network and the IHC identification network and the true label; and the cyclic loss function obtained by calculating the norm between the restored stained image block and the true stained image block. The above loss function is calculated and the network parameters are updated using the gradient descent algorithm. After multiple iterative training, the above loss function is minimized, and the HE to IHC network parameters, IHC to HE network parameters, and IHC identification network parameters are saved.
[0018] In the second stage of training, all HE-stained image blocks in the data set are converted into virtual IHC-stained image blocks using the HE-to-IHC network pre-trained in the first stage and saved. They are compared with the corresponding real IHC-stained image blocks, and each pair of virtual IHC-stained image blocks and real IHC-stained image blocks are labeled according to the consistency of pathological semantics. A consistent network training set consisting of a ternary data table of (virtual IHC-stained image blocks, real IHC-stained image blocks, and consistent labels) is established.
[0019] A consistency calculation network is constructed, whose input is an image pair (virtual IHC staining image block, real IHC staining image block), and whose output is pathological consistency (characterizing the consistency of two IHC staining images in pathological semantics). The loss function used in training is a binary loss function calculated by using the pathological consistency output by the consistency network and the consistency label of the input image pair. The above loss function is calculated and the network parameters are updated using the gradient descent algorithm. After multiple iterative training, the above loss function is minimized, and the obtained consistency calculation network parameters are saved.
[0020] The third stage of training is performed, using the above-saved HE-to-IHC network parameters, IHC-to-HE network parameters, and IHC identification network parameters as pre-training parameters, and freezing the parameters of the IHC-to-HE network. The real HE-stained image blocks in the data set consisting of the above HE-IHC image block pairs are input into the HE-to-IHC network to obtain the corresponding virtual IHC-stained image blocks, which are respectively input into the IHC identification network and the IHC-to-HE network parameters to obtain the identification results and the restored HE-stained image blocks, and the virtual IHC-stained image blocks and the real IHC-stained image blocks corresponding to the real HE-stained image blocks in the data set are input into the consistency calculation network to obtain the pathological consistency results.
[0021] The loss functions used in training include the adversarial loss function calculated using the results of the IHC identification network and the true label, the consistency loss function calculated using the pathology consistency results, and the norm loss function calculated using the restored HE-stained image blocks and the true HE-stained image blocks. The above loss functions are calculated and the network parameters are updated using the gradient descent algorithm. After multiple iterative training, the above loss functions are minimized to obtain the final HE-to-IHC network parameters.
[0022] Step 4, a data post-processing step, stitches the virtual IHC staining image blocks corresponding to different IHC stainings to obtain a complete virtual IHC staining tissue image of the required IHC staining.
[0023] The beneficial effects of the present invention are:
[0024] (1) Using neural networks and deep learning technology, virtual IHC-stained tissue section digital images are generated using frozen HE-stained tissue section digital images, so that the patient's IHC-stained tissue section images can be quickly obtained during surgery for auxiliary diagnosis.
[0025] (2) Using neural networks and deep learning technology, the digital images of frozen HE-stained tissue sections are converted into virtual digital images of paraffin HE-stained tissue sections, which improves the problems of cell structure deformation, ice crystals, uneven staining, etc. in frozen HE-stained tissue sections. At the same time, a method for quickly obtaining virtual paraffin HE-stained tissue section images is provided.
[0026] (3) Using neural networks and deep learning technology, the digital image of HE-stained tissue sections is converted into a virtual IHC-stained tissue section image, providing a fast and economical way to obtain IHC-stained tissue section images, greatly reducing the preparation and staining time and financial costs of the tester. At the same time, the generated virtual IHC stained 8-color image can be aligned with the HE-stained tissue section image at the pixel level, making it easier for pathologists to compare.
[0027] (4) Using neural networks and image processing technology, the digital image of HE-stained tissue sections is aligned with the image of IHC-stained tissue sections of continuous sections, which is more convenient for pathologists to compare. Using image processing technology, the effective tissue area in the digital image of HE-stained tissue sections can be quickly screened, which facilitates subsequent calculations or manual observations. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is the overall flow chart of the present invention;
[0029] Figure 2 It is a flowchart of neural network training for converting frozen section HE staining image to paraffin section HE staining image in the present invention;
[0030] Figure 3 It is a flowchart of the first stage of training the neural network for converting HE staining into IHC staining images in the present invention;
[0031] Figure 4 It is a flow chart of the second stage of training the neural network for converting HE staining into IHC staining images in the present invention;
[0032] Figure 5 It is a flowchart of the third stage of training the neural network for converting HE staining into IHC staining images in the present invention; DETAILED DESCRIPTION
[0033] To make the technical solution of the present invention clearer, the present invention is further described below in conjunction with the accompanying drawings. The present invention is specifically implemented according to the following steps:
[0034] Step 1: Obtain a digital image of the original HE-stained frozen section of the surgical patient at a magnification of 400 times by conventional technology, cut the original digital image into image blocks of 1024.1024 size at the original resolution, and screen each image block to obtain an image block containing effective tissue.
[0035] The segmented original frozen section HE-stained pathological section image blocks are screened as described in step 1, including calculating the grayscale entropy of each image block and the image structure similarity (Structure Similarity, SSIM) value with the reference image block. The SSIM is calculated as shown in formula (1-4):
[0036] SSIM(x,y)=[l(x,y)] α [c(x, y)] β [s(x, y)] γ #(1)
[0037]
[0038]
[0039]
[0040] where μ x , μ y are the average values of pixels x and y, respectively, x , σ y are the pixel standard deviations of x and y, σ xy is the pixel covariance between x and y.
[0041] The formula for calculating grayscale entropy is as follows:
[0042]
[0043] Where N is the gray level of the division, take 64, p i is the probability of occurrence of a pixel belonging to gray level i.
[0044] The reference image block mentioned above can be directly intercepted from the effective area of the original HE-stained image, or obtained by an algorithm. Specifically, the gray entropy of all segmented original frozen section HE-stained pathological section images is calculated and sorted, and a piece of the image block with the gray entropy value in the top 2% to 5% is randomly intercepted as the reference image block.
[0045] For the above-mentioned screening method, after calculating the grayscale entropy and structural similarity of all image blocks and sorting them, manually set the threshold or select the image block set with the largest grayscale entropy value of the top 30% and the image block set with the largest structural similarity value of the bottom 30%, and take the intersection of the two to obtain the final screened effective tissue image block set.
[0046] Step 2, the image block of the effective tissue is input into the pre-trained neural network for converting the frozen section HE staining image into the paraffin section HE staining image after image normalization preprocessing, and the corresponding virtual paraffin section HE staining image is output. The training of the neural network for converting the frozen section HE staining image into the paraffin section HE staining image in step 2 includes the following steps:
[0047] Obtain paraffin section HE-stained tissue whole section images and frozen section HE-stained tissue whole section images, cut the two HE-stained whole section images into image blocks, and screen out image blocks containing valid tissues. Thus, a data set consisting of paraffin section HE-stained image blocks and frozen section HE-stained image blocks is obtained;
[0048] Construct neural network components, including the frozen-paraffin conversion network consisting of three modules: encoding module E, conversion module T, and decoding module D, paraffin section identification network Dis, and pre-trained style feature extractor H s and the pre-trained content feature extractor H c ,in:
[0049] During the training phase:
[0050] The paraffin section HE stained image block in the above dataset is used as the style image I s , the frozen section HE stained image block is used as the content image I c , each iteration round accepts a batch of equal number of style and content images as input, denoted as (s 1 ,...s i , ..., c 1 , ...c i , ...), the frozen-paraffin converter accepts a pair of style-content images in different pairing modes and outputs a virtual paraffin section HE-stained image with the style image style converted from the content image, denoted as I sc , which can be abbreviated as s i c j , i, j are used to mark the style image and content image based on which the conversion image is based. The identification network Dis accepts real or virtual paraffin section HE staining images and outputs identification results.
[0051] Calculate the loss function:
[0052] The adversarial loss function calculated using the output of the discriminator network and the true label:
[0053]
[0054] The style difference loss function is calculated by using the style of the virtual paraffin section HE-stained image extracted by the pre-trained style feature extractor and the style of the corresponding style image;
[0055] L s =||H s (I sc )-H s (I s )|| 2
[0056] The content difference loss function is calculated using the content of the virtual paraffin section HE-stained image extracted by the pre-trained content feature extractor and the content of the corresponding content image;
[0057] L c =||H c (I sc )-H c (I c )|| 2
[0058] A style contrast loss function is calculated using style features extracted from the transformed image obtained by taking different style images / different content images as input;
[0059]
[0060] The content contrast loss function is calculated using content features extracted from the transformed image obtained by taking different style images / different content images as input;
[0061]
[0062] L total =L adv +L s +L c +L s-conrra +L c-ontra
[0063] Among them, τ is a hyperparameter.
[0064] The above loss function is calculated and the network parameters are updated using the gradient descent algorithm. After multiple iterative training, the above loss function is minimized, and the neural network parameters of the frozen section HE staining image converted into the paraffin section HE staining image are saved.
[0065] Step 3, the virtual paraffin section HE staining image blocks are respectively input into the pre-trained HE staining to IHC staining image conversion neural network corresponding to the required IHC staining, and the required virtual IHC staining image blocks are output.
[0066] Further, the training of the neural network for converting the HE staining into the IHC staining image described in step 3 includes the following steps:
[0067] A HE-stained tissue section image at 400 times magnification and its corresponding IHC-stained tissue section image obtained by continuous sectioning of the same tissue sample are obtained by conventional technology, and the HE-IHC image pair is aligned. The exemplary alignment process includes:
[0068] Export the original full-slice digital image to tiff format and establish a multi-layer pyramid resolution structure;
[0069] Convert the lower-level images of different resolutions into numpy arrays, perform single-channel processing on each level of the image and segment the foreground area.
[0070] Image features are detected and then matched between all HE images and IHC images.
[0071] The low-resolution layer image is gridded, and rigid alignment is used for each grid. Based on feature detection, the feature distance between the HE image and the IHC image is iteratively reduced by performing affine transformation on the image grid. Finally, the transformation of each grid is merged and applied to the next resolution layer image.
[0072] Based on the alignment of the previous level, the resolution level is gradually increased to perform the above rigid alignment.
[0073] On the basis of the above rigid alignment, the higher resolution levels are gridded and non-rigid micro-alignment is used to iteratively deform the images to reduce the characteristic distance between the HE image and the IHC image, and the final alignment parameters are obtained in combination with the above rigid alignment.
[0074] The final alignment parameters are applied to the original resolution image to obtain the aligned HE-IHC whole-slice image pair.
[0075] The aligned HE-IHC whole-slice image pairs are cut into image blocks, and the image blocks containing valid tissues are obtained by the same screening method as step 1. Thus, a data set consisting of one-to-one corresponding HE-IHC image block pairs is obtained;
[0076] Conduct the first phase of training:
[0077] Construct neural network components, including HE to IHC network, IHC to HE network, HE identification network, and IHC identification network, where:
[0078] The HE-to-IHC network and the IHC-to-HE network use the same resnet-9block network with 9 submodules and skip connections. The HE identification network and the IHC identification network use a convolutional neural network with 6 downsampling convolutional modules.
[0079] The input true HE image block is denoted as x, the input true IHC image block is denoted as y, and the HE to IHC network function is denoted as G x (·), the IHC to HE network function is recorded as G y (·), HE identification network function is recorded as D x (·), the IHC identification network function is recorded as D y (·), calculate the loss function (the loop loss function uses the L1 norm):
[0080]
[0081]
[0082] L=L adv +L cyc
[0083] The above loss function is calculated and the network parameters are updated using the Adam optimization algorithm. After multiple iterative training, the above loss function is minimized, and the HE to IHC network parameters, IHC to HE network parameters, and IHC identification network parameters are saved.
[0084] Conduct the second phase of training:
[0085] The above-mentioned pre-trained HE-to-IHC network is used to convert all the HE-stained image blocks in the dataset into virtual IHC-stained image blocks and save them. They are compared with the corresponding real IHC-stained image blocks. Each pair of virtual IHC-stained image blocks and real IHC-stained image blocks are marked according to the consistency of pathological semantics. The virtual image blocks with consistent pathological semantics are marked as 0, and the inconsistencies are marked as 1. Thus, the virtual IHC-stained image blocks (denoted as I fake ), the real IHC staining image block (denoted as I true ), and the consistent label (denoted as t)) consist of a consistent network training set of ternary data tables.
[0086] Construct a consistency calculation network. The similarity calculation network uses the VGG-19 network pre-trained on the ImageNet dataset and connects a convolutional layer to each feature layer output. During the training process, freeze the backbone of the VGG-19 network and only update the parameters of the added convolutional layer. The similarity calculation network function is recorded as F(·, ·), and the loss function is calculated:
[0087]
[0088] The above loss function is calculated and the network parameters are updated using the gradient descent algorithm. After multiple iterative training, the above loss function is minimized and the obtained consistency calculation network parameters are saved.
[0089] Conduct the third phase of training:
[0090] Use the above saved HE to IHC network parameters, IHC to HE network parameters, IHC identification network parameters, and consistency calculation network parameters as pre-training parameters, and freeze the parameters of the IHC to HE network to calculate the following loss function.
[0091]
[0092]
[0093]
[0094] L=L adv +L cyc +L sim
[0095] The above loss function is calculated and the network parameters are updated using the gradient descent algorithm. After multiple iterative training, the above loss function is minimized to obtain the final HE to IHC network parameters.
[0096] Step 4: splice the virtual IHC stained image blocks corresponding to different IHC stainings output by the HE to IHC network to obtain a complete virtual IHC stained tissue image of the required IHC staining.
Claims
1. A method for rapidly obtaining virtual immunohistochemical staining sections during surgery, characterized in that: Through deep learning and image processing technology, the frozen section HE staining images obtained during surgery are converted into virtual IHC staining images, which includes the following steps: Step 1, data preprocessing step, after obtaining the original digital image of the frozen section HE-stained pathological section of the surgical patient by conventional technology, the original digital image is gridded, and the original digital image is cut into square image blocks with a side length of 1024 pixels at the original resolution, and each image block is screened to obtain an image block containing effective tissue; Step 2, the frozen to room temperature conversion step, inputs the image block containing the effective tissue into the pre-trained neural network that converts the frozen section HE staining image into the paraffin section HE staining image, and outputs the corresponding virtual paraffin section HE staining image. Step 3, HE staining is converted into IHC staining step, the virtual paraffin section HE staining images are respectively input into the pre-trained HE staining to IHC staining image conversion neural network corresponding to the required IHC staining, and the required virtual IHC staining image blocks are output. Step 4, a data post-processing step, stitches the virtual IHC staining image blocks corresponding to different IHC stainings to obtain a complete virtual IHC staining tissue image of the required IHC staining.
2. A method for rapidly obtaining virtual immunohistochemical staining sections during surgery as claimed in claim 1, characterized in that: In step 1, the segmented original frozen section HE-stained pathological section image is screened, including calculating the grayscale entropy of each image block as shown in formula (1) and the image structure similarity (Structure Similarity, SSIM) value with the reference image block as shown in formula (2-5): SSIM(x,y)=[l(x,y)] α ·[c(x,y)] β ·[s(x,y)] γ #(2) The gray entropy threshold and the structural similarity threshold are set respectively, and the two thresholds are used for screening. The specific method is to manually set the threshold or select the image block set with the largest gray entropy value of the first 30% and the image block set with the largest structural similarity value of the last 30% after calculating the gray entropy and sorting all the image blocks, and take the intersection of the two to obtain the final screened effective tissue image block set. The purpose of screening is to remove the background and some non-ROI areas.
3. The method for rapidly obtaining virtual immunohistochemical staining sections during surgery according to claim 1, characterized in that: In step 2, the training of the neural network for converting the frozen section HE staining image into the paraffin section HE staining image comprises the following steps: (1) Obtaining paraffin section HE-stained tissue whole section images and frozen section HE-stained tissue whole section images, and using the above segmentation and screening method to obtain image blocks containing valid tissues. Thus, a data set consisting of paraffin section HE-stained image blocks and frozen section HE-stained image blocks is obtained; (2) Constructing neural network components, including a frozen-to-paraffin conversion network consisting of an encoding module E, a conversion module T, and a decoding module, and a paraffin section identification network, a paraffin section identification network Dis, and a pre-trained style feature extractor H s and the pre-trained content feature extractor H c , where: the structure of the encoding module E is the same as the Encoder part of the VGG-19 network, which is used to extract image features of the slice image, including style features and content features. The conversion module T adopts the U-net structure using skip-connection, which is used to align the style of the frozen section HE-stained tissue image block with the style of the paraffin section HE-stained tissue image block. The decoding module adopts the resnet-9blocks structure, which is used to finally output the transformed paraffin section HE-stained tissue image block. The entire conversion network is used to convert the input frozen section HE-stained image block into a virtual paraffin section HE-stained image block. The identification network is used to determine whether the input paraffin section HE-stained image block belongs to a real paraffin section HE-stained image block or a transformed paraffin section HE-stained image block. (3) Training phase: The paraffin section HE-stained image blocks in the above dataset are used as style images I s , the frozen section HE stained image block is used as the content image I c , each iteration round accepts a batch of equal number of style and content images as input, denoted as (s1,...s i , ..., c1, ...c i , ...), the frozen-paraffin converter accepts a pair of style-content images in different pairing modes and outputs a virtual paraffin section HE-stained image with the style image style converted from the content image, denoted as I sc , which can be abbreviated as s i c j , i, j are used to mark the style image and content image based on which the conversion image is based. The identification network Dis accepts real or virtual paraffin section HE staining images and outputs identification results. The loss functions used in training include: adversarial loss function calculated using the output of the discriminator network and the true label; The style difference loss function is calculated by using the style of the virtual paraffin section HE-stained image extracted by the pre-trained style feature extractor and the style of the corresponding style image; L s =||H s (I sc )-H s (I s )||2 The content difference loss function is calculated using the content of the virtual paraffin section HE-stained image extracted by the pre-trained content feature extractor and the content of the corresponding content image; L c =||H c (I sc )-H c (I c )||2 A style contrast loss function is calculated using style features extracted from the transformed image obtained by taking different style images / different content images as input; The content contrast loss function is calculated using content features extracted from the transformed image obtained by taking different style images / different content images as input; The above loss function is calculated and the network parameters are updated using the gradient descent algorithm. After multiple iterative training, the above loss function is minimized, and the neural network parameters of the frozen section HE staining image converted into the paraffin section HE staining image are saved.
4. The method for rapidly obtaining virtual immunohistochemical staining sections during surgery according to claim 1, characterized in that: In step 3, the training of the neural network for converting HE staining into IHC staining images comprises the following steps: (1) Obtain a HE-stained tissue section image and its corresponding IHC-stained tissue section image obtained by continuous sectioning of the same tissue sample, align the HE-IHC image pair, cut it into image blocks, and screen out image blocks containing valid tissues. Thus, a data set consisting of one-to-one corresponding HE-IHC image block pairs is obtained. The specific steps of image alignment are as follows: The original full-slice digital image was exported to tiff format and a multi-layer pyramid resolution structure was established; the lower-level images of different resolutions were converted into numpy arrays, and each level of image was processed in a single channel and the foreground area was segmented. Image features were detected and then matched between all HE images and IHC images. The low-resolution level images were gridded, and rigid alignment was used for each grid. Based on feature detection, the feature distance between the HE image and the IHC image was iteratively reduced by affine transformation of the image grid, and finally the transformation of each grid was combined and applied to the next resolution level image. On the basis of the previous level alignment, the resolution level was gradually increased to perform the above rigid alignment. On the basis of the above rigid alignment, the higher resolution level was gridded and non-rigid micro-alignment was used. The image deformation was iteratively reduced the feature distance between the HE image and the IHC image, and the final alignment parameters were obtained by combining the above rigid alignment. The final alignment parameters were applied to the original resolution image to obtain the aligned HE-IHC full-slice image pair. (2) Construct neural network components, including HE to IHC network, IHC to HE network, HE discrimination network, IHC discrimination network, and similarity calculation network, where: the HE to IHC network uses 9 Residual Blocks composed of convolution layer, normalization layer, and non-linear layer, which are connected through skip-connection to form a resnet-9blocks structure. Among the 9 Residual Blocks, the first 4 extract features from the input image through the convolution layer to reduce the dimension, and the last 4 gradually increase the dimension of the input features through the convolution layer to decode, and finally restore the original image size. Therefore, the total resnet-9blocks network shows an encoder-decoder structure. The HE to IHC network is responsible for converting the input HE-stained image block into a virtual IHC-stained image block. The IHC to HE network also uses the resnet-9blocks structure, which is responsible for converting the input real IHC-stained image block into a virtual HE-stained image block. The HE discrimination network is composed of 6 modules composed of normalization layer, convolution layer, and non-linear layer. Each module gradually reduces the dimension of the image, extracts image features, and finally outputs the classification value. The HE discrimination network is responsible for judging whether the input real HE-stained image block belongs to the real HE-stained image block or the virtual HE-stained image block. The IHC discrimination network has the same structure as the HE discrimination network and is responsible for judging whether the input IHC-stained image block belongs to the real IHC-stained image block or the virtual IHC-stained image block. The similarity calculation network adopts the same structure as the encoder part of the VGG-19 network, and connects a convolution layer to the output of each intermediate feature layer to reduce the feature to one dimension, and then weighted averages the outputs of all additional convolution layers to obtain the final output value. The similarity calculation network is responsible for judging whether a pair of input real IHC-stained images and virtual IHC-stained images are consistent in pathological semantics. (3) Perform the first stage of training, input the HE and IHC stained image blocks in the data set composed of the above HE-IHC image block pairs into the HE to IHC network and the IHC to HE network respectively, obtain the corresponding virtual IHC stained image blocks and virtual HE stained image blocks, input them into the HE discrimination network and the IHC discrimination network respectively to obtain the discrimination results, and then input the virtual IHC stained image blocks and the virtual HE stained image blocks into the IHC to HE network and the HE to IHC network respectively to obtain the restored HE stained image blocks and the restored IHC stained image blocks. The input true HE image block is denoted as x, the input true IHC image block is denoted as y, and the HE to IHC network function is denoted as G x (·), the IHC to HE network function is recorded as G y (·), HE identification network function is recorded as D x (·), the IHC identification network function is recorded as D y (·), the loss functions used in training include: The adversarial loss function calculated using the results of the HE discriminant network and the IHC discriminant network and the true label: The cyclic loss function is obtained by calculating the norm between the restored stained image block and the real stained image block: The above loss function is calculated and the network parameters are updated using the gradient descent algorithm. After multiple iterative training, the above loss function is minimized, and the HE to IHC network parameters, IHC to HE network parameters, and IHC discrimination network parameters are saved. In the second stage of training, all HE-stained image blocks in the data set are converted into virtual IHC-stained image blocks using the pre-trained HE-to-IHC network and saved. The virtual IHC-stained image blocks are compared with the corresponding real IHC-stained image blocks. Each pair of virtual IHC-stained image blocks and real IHC-stained image blocks are marked according to the consistency of pathological semantics. The virtual image blocks with consistent pathological semantics are marked as 0, and the inconsistencies are marked as 1. Thus, the virtual IHC-stained image blocks (denoted as IHC) are established. fake ), the real IHC staining image block (denoted as I true ), and the consistent label (denoted as t)) consist of a consistent network training set of ternary data tables. A consistency calculation network is constructed, whose input is an image pair (virtual IHC staining image block, real IHC staining image block), and whose output is pathological consistency (characterizing the consistency of two IHC staining images in pathological semantics). The loss function used in training is a binary loss function calculated by combining the pathology consistency output by the consistency network with the consistency label of the input image pair: The above loss function is calculated and the network parameters are updated using the gradient descent algorithm. After multiple iterative training, the above loss function is minimized and the obtained consistency calculation network parameters are saved. In the third stage of training, the real HE-stained image blocks in the data set composed of the above HE-IHC image block pairs are input into the HE-IHC conversion network to obtain the corresponding virtual IHC-stained image blocks, which are respectively input into the IHC discrimination network and the IHC-HE conversion network parameters to obtain the discrimination results and the restored HE-stained image blocks, and the virtual IHC-stained image blocks and the real IHC-stained image blocks corresponding to the real HE-stained image blocks in the data set are input into the consistency calculation network to obtain the pathological consistency results. The loss functions used in training include: adversarial loss function calculated using the results of the IHC discriminant network and the true label: The consistency loss function calculated using pathology consistency results: The norm loss function calculated using the restored HE-stained image block and the real HE-stained image block is: The above loss function is calculated and the network parameters are updated using the gradient descent algorithm. After multiple iterative training, the above loss function is minimized to obtain the final HE to IHC network parameters.
Citation Information
Cited By
HE image-to-IHC image dyeing generation method based on image block similarity
CN119006857A
