Histopathological image fusion method with adaptive space consistency
Through the multi-focus histopathological microscopy image fusion method based on Swin Transformer, combined with global context information and self-guided filters, the problem of misclassification and artifacts caused by the neglect of local details is solved, and the spatial consistency and quality of the image are improved.
Patent Information
- Application Number
- CN202410682807.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-08-27
AI Technical Summary
Existing multi-focus fusion technology for histopathological microscopic images only focuses on local details and ignores global context information, resulting in misclassification of pixels in smooth and edge areas, and artifacts due to defocus diffusion effects.
A multi-focus histopathological microscopic image fusion method based on Swin Transformer is used to capture global contextual information and enhance feature representation through shallow feature extraction module, residual Swin Transformer module, feature fusion module, feature reconstruction module and self-guided filter. And optimize the spatial consistency of the fused image through self-guided filters.
It improves the spatial consistency between the fused image and the source image, reduces misclassification, enhances the quality of the fused image, and overcomes artifact problems.
Smart Images

Figure CN118552818A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of medical tissue pathology multi-focus image fusion, and in particular to a method for adaptive spatial consistency tissue pathology image fusion. Background Art
[0002] Optical imaging systems, especially optical microscopes, are limited in their ability to capture fully focused images due to their limited depth of field. In the field of biomedical imaging of tissue pathology sections, each image slice usually has only a small focused area, which greatly limits the possibility of clearly observing the details of human tissues or organs in a single image. Even relatively flat biological specimens are difficult to display in full focus from a single viewpoint due to their inherent three-dimensional structural characteristics. When diagnosing diseases and conducting biomedical research, it is often necessary to obtain high spatial resolution and sufficient depth of focus to ensure accurate observation and analysis of microscopic changes in tissue structure. To achieve this goal, a commonly used method is to use multi-focus image fusion (MFIF), which aims to combine multiple images with different focal lengths into a fully focused image to collect information.
[0003] The core goal of image fusion technology is to merge images from the same scene captured by different imaging devices into a high-quality image with superior visual effects. Since the 1980s, the theoretical basis of image fusion has attracted the attention of scholars. With the progress of sensor technology, image fusion has gradually become the focus of researchers.
[0004] Over the past nearly 40 years, image fusion technology has become a hot area of image processing research and has found wide applications in many fields such as medicine, military, and specific computer vision tasks. The multi-focus image fusion technology discussed in this article aims to produce a fully focused image, that is, to form a single clear image by integrating the clear areas of multiple source images of the same scene. Limited by the depth of field of the imaging device, only objects within the depth of field will appear in focus, while those outside this range will appear blurred. Multi-focus image fusion technology creates a fully focused and clear image by fusing the clear focus areas in multiple source images.
[0005] Traditional multi-focus image fusion techniques are mainly classified according to the domain of the processed image, and can be divided into fusion strategies based on the spatial domain and based on the transform domain. Although traditional image fusion techniques can effectively support subsequent image processing tasks in certain scenarios, their development is facing some key challenges. On the one hand, with the pursuit of better fusion effects, the transformations or representation methods they rely on become more and more complex, which makes it difficult for these algorithms to meet the needs of real-time processing in real applications. On the other hand, the manually designed fusion rules that these algorithms rely on are often relatively simple, which limits their performance when processing complex scenes.
[0006] Many existing deep learning-based multi-focus histopathology image fusion methods usually input a pair of multi-focus images and perform pixel-by-pixel or image block-by-image block classification tasks to classify each pixel or image block as focused or defocused. However, most methods still cannot produce accurate and robust classification results, especially in smooth areas and edges between focused and defocused areas. For smooth areas present in multi-focus images, the gradient or intensity of the texture changes very little, resulting in classification difficulties. For edge areas between focused and defocused areas, both focus information and defocus information are contained, which easily leads to misclassification of fusion methods. These methods widely use CNN to mine different representations. However, due to the inherent limitations of CNN in extracting features in local sliding windows, most methods only focus on local details and ignore global contextual information. Local features may lead to misclassification of pixels in smooth and edge areas.
[0007] The purpose of the present invention is to solve the problem that the existing multi-focus fusion of tissue pathology microscopic images only focuses on local details and ignores the global context information, which may lead to the misclassification of pixels in smooth and edge areas, overcome the artifact problem caused by the defocus diffusion effect, and propose a multi-focus tissue pathology microscopic image fusion method based on Swin Transformer to improve the spatial consistency of the fused image and the source image, and further improve the quality of the fused image. Summary of the invention
[0008] The main purpose of the present invention is to provide a method for adaptive spatial consistency of tissue pathology image fusion, so as to solve the problem that the existing multi-focus fusion of tissue pathology microscopic images only focuses on local details and ignores global context information, which may lead to misclassification of pixels in smooth and edge areas, and overcome the artifact problem caused by the defocus diffusion effect.
[0009] To solve the above technical problems, the technical solution adopted by the present invention is: a method for adaptive spatial consistency of tissue pathology image fusion, comprising a shallow feature extraction module, an RSTB module, a feature fusion module, a feature reconstruction module and a self-guided filter;
[0010] The multi-focus fusion method of tissue pathology images includes:
[0011] S1, shallow feature extraction module: The input multi-focus image is preprocessed through the shallow feature extraction module to extract basic feature information;
[0012] S2, deep feature extraction module: using residual Swin Transformer module, each module combines Swin Transformer layer and Squeeze-and-Excitation mechanism;
[0013] The module extracts features sequentially, captures global context information through a multi-layer self-attention mechanism, enhances feature representation, and uses the SE module to dynamically adjust the weights of different channels to strengthen important features.
[0014] S3, feature fusion module: splices the features of different input images in the channel dimension, fuses the feature information of the image to be fused, and provides a more comprehensive feature representation for subsequent processing;
[0015] S4, feature reconstruction module: restore the fused features to the size of the fused image to obtain a binary focus feature map of the aggregated information;
[0016] S5, Trainable Self-Guided Filter: At the end of the processing flow, a trainable self-guided filter is innovatively introduced to optimize the predicted focus map using the original focus map. Through 1×1 convolution, ReLU activation, CBAM attention mechanism and the final 1×1 convolution layer, the focus map is refined to improve the spatial consistency of the fused image.
[0017] S6. Model construction and testing: Integrate the above modules into a deep learning-based tissue pathology multi-focus image fusion framework. After training, test the multi-focus image set to obtain the fusion result.
[0018] In a preferred embodiment, the further method of steps S1-S6 is:
[0019] A1. A multi-focus image set G to be registered is a set of 5230 images of different focal lengths in the same field of view of pathological tissue sections taken with an optical microscope. The image set after registration is H and the two images with different focal lengths are I. A ∈RH×W×C and I B ∈RH×W×C;
[0020] Where H represents the height of the source image, W represents the width of the source image, and C represents the number of channels of the source image. The C of the color image is 3, and the C of the grayscale image is 1.
[0021] Input I A and IB Each has a different focus area, I A With a clear foreground against a defocused background, I B With a clear background in the case of blurred foreground, and considering I B Defocus diffusion effect on
[0022] A2. Align the multi-focus image to I A and I B As the network input, the shallow feature extraction module of the first part of the feature encoding network extracts the shallow features of the input image and
[0023] A3. Shallow features and Deep global semantic features through deep feature extraction module and
[0024] Among them, the deep feature extraction module consists of three residual Swin Transformer modules;
[0025] A4. Deep global semantic features and Through a tensor concatenation layer, concatenation is performed on the channel dimension to obtain the fusion feature F TC ;
[0026] A5. Fusion feature F TC The feature reconstruction module of the feature decoder network is input to obtain the binary focal feature map F∈RH×W×1 of aggregated information;
[0027] A6. Take the focus feature map F as input and guide map, and use the self-guided filter (SGF) process to refine the intermediate output focus map F to obtain the final focus map
[0028] A7. The focus map obtained With the original input image I A and I B Perform feature weighted calculation to obtain the final fused all-focus image I;
[0029] A8. Build the above modules into a deep learning-based histopathology multi-focus image fusion method and calculate the output fusion image I and the input image I A and I B The loss function Loss value between them is used to train the multi-focus image fusion network model by back-propagating the reduced Loss value and updating the model parameters using the Adam optimizer;
[0030] A9. Put the multi-focus image set H to be fused into the trained multi-focus image fusion framework, and test to obtain the fused image I.
[0031] In the preferred embodiment, the specific method of steps A1-A2 is:
[0032] Through a shallow feature extraction module H SE (·) From the source image I A and I B Extracting shallow features of tissue pathology images to be fused and
[0033] The module consists of a convolutional layer activated by ReLU, with a 7×7 kernel and a stride of 1, followed by two convolutional layers activated by ReLU, each using a 3×3 kernel and a stride of 1;
[0034] Convolutional layers excel in initial visual processing, helping to stabilize optimization and improve results;
[0035] Effectively capture local semantic details and project them into a high-dimensional feature space, where C SF It is set to 96 to match the embedding dimension of Swin Transformer, as shown in the following formula: (1);
[0036]
[0037] In the preferred embodiment, the specific method of steps A3-A4 is:
[0038] By combining the three residual Swin Transformer blocks of the excitation squeeze module, RSTB extracts and Extracting deep features and As shown in the following formula:
[0039]
[0040] Among them, H DE (·) is the deep feature extraction module, which contains K residual Swin Transformer blocks (RSTB) and a squeeze excitation module (SE), K is set to 6;
[0041] The input feature representation of the i-th residual Swin Transformer block is F0, and a sequence of L-layer Swin Transformer layers is used to gradually refine and enhance the intermediate feature representation;
[0042] The intermediate feature set F1, F2, ..., F L , through multi-level information distillation, it helps to capture the fine-grained and global features of the image content. The design of each Swin Transformer layer is to effectively utilize the global dependencies between image features through the self-attention mechanism, thereby achieving effective information exchange and integration between features:
[0043]
[0044] in is the i-th Swin Transformer layer in RSTB, and then a squeeze-excitation module is added before the residual connection. The output of RSTB is defined as:
[0045] F out =H SE (F L )+F0 (4);
[0046] Among them, H SE (·) is the final squeeze-excitation module SE, which is designed to enhance the representation capability of the network by enabling it to perform dynamic channel-level feature recalibration;
[0047] Next, through a tensor concatenation layer, the deep features and The output is represented as a tensor F TC :
[0048]
[0049] In the preferred embodiment, the specific method of steps A5-A6 is:
[0050] Feature reconstruction module H FR (·) It consists of three modules. The first two modules are Deconv-BN-ReLU, which are used to restore the size of the concatenated tensor to the same as the source image. The last module passes through a convolutional layer with a kernel size of 7×7 to give a binary focal feature map F∈RH×W×1 of aggregated information.
[0051] F=H FR (F TC ) (6);
[0052] A trainable self-guided filter is used to refine the predicted focus map F, thereby directly optimizing the output during the training phase:
[0053] First, the intermediate focus map F is processed by a convolutional layer with a kernel size of 1×1 and an activation function of ReLU to expand the channel dimension from 1 to 64;
[0054] Subsequently, a convolutional block attention module is applied;
[0055] Then the guide map F is generated through the last convolution layer, which also uses a 1×1 convolution kernel and a ReLU activation function to compress the channel dimension back to 1, thus completing the conversion process;
[0056] The original guided filtering uses the guidance image F i Apply the local linear model to obtain the output value F of the i-th pixel i for:
[0057]
[0058] Where W n represents the nth local square window with radius r, i represents the window W n A pixel position within ;
[0059] Linear coefficient a n and b n By minimizing the reconstruction error for each window W n Determine, that is,
[0060]
[0061] Among them, F i represents the input image, λ is the regularization parameter that controls the smoothness;
[0062] Use a linear regression solver to calculate a for each window n and b n After filtering the output Obtained as follows:
[0063]
[0064] in and is the W surrounding each pixel i i The average coefficient in ;
[0065] The self-guided filter process is used to refine the intermediate output focus map F to obtain the final focus map Input multi-focus image pair I A and I B Through the multi-focus image fusion network of the present invention;
[0066] To get the focus image The binary index F i =1 indicates focused pixel, while F i = 0 indicates out-of-focus pixels. Then the composite image of all focuses I∈RH×W×C is calculated, and the all-focus image is calculated as follows:
[0067]
[0068] In the preferred solution, the method for quantifying the loss function L is:
[0069] The multi-focus image generator network model G aims to predict the given multi-focus input image pair (I A ,I B ) is a focal map F, which is as close as possible to the real focal map F′;
[0070] The training model uses a combination of three losses: reconstruction loss, adversarial loss, and focal frequency loss; the reconstruction loss is defined as the difference between the true label focal map F′ and the predicted focal map F = G(I A ,I B ) is the L1 distance between:
[0071]
[0072] The GAN target uses the least squares generative adversarial network, and the specific expression is as follows:
[0073]
[0074]
[0075] L GAN =L GAN (D)+L GAN (G) (14);
[0076] Using the focal frequency loss L FFL Restore the lost frequency in the fused image. The specific expression is as follows:
[0077]
[0078] The final goal is a combination of three losses:
[0079] L=L rec + L GAN +L FFL (16).
[0080] The present invention provides a method for adaptive spatial consistency of tissue pathology image fusion. The present invention uses the residual Swin Transformer module as an encoder to extract global hierarchical context features. The residual connection can aggregate features at different levels. Considering the pixels that distinguish smooth and edge areas from the global view, the present invention enhances the representation of each pixel by aggregating the representation of the global context. The global context representation can be used to eliminate misclassification and achieve more robust classification of pixels. For smooth areas in multi-focus images, the present invention uses global cues combined with sufficient context information to obtain clearer pixel representations, enhance the spatial consistency of the fused image and the source image, and further improve the quality of the fused image.
[0081] Based on the residual Swin Transformer, the present invention introduces a squeeze-and-excitation block (SE) to further enhance the representation ability of the network. By capturing the dependencies between feature channels, the model's ability to adaptively adjust the importance of different features is significantly enhanced. The introduction of the SE module not only deepens the network's understanding of the input features, but also optimizes the global information flow of the features by effectively modeling the complex relationships between channels, and by learning the global information of each channel and assigning different importance weights to it, further improving the spatial consistency of the fused image and the source image.
[0082] The present invention introduces a self-guided filter module to enhance the spatial consistency of the predicted focus map and eliminate the need for post-processing. Specifically, the present invention adds a trained self-guided filter module at the end of the encoder-decoder network, which uses the output original focus map as a guide to adaptively optimize its own parameters, thereby improving the quality of the generated focus map and further improving the quality of the fused image. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:
[0084] Figure 1 This is the overall framework process of SCST of the present invention. DETAILED DESCRIPTION
[0085] Example 1
[0086] like Figure 1 As shown, a method for adaptive spatial consistency of tissue pathology image fusion includes a shallow feature extraction module, a RSTB module, a feature fusion module, a feature reconstruction module and a self-guided filter;
[0087] The multi-focus fusion method of tissue pathology images includes:
[0088] S1, shallow feature extraction module: The input multi-focus image is preprocessed through the shallow feature extraction module to extract basic feature information;
[0089] S2, deep feature extraction module: using residual Swin Transformer module, each module combines Swin Transformer layer and Squeeze-and-Excitation mechanism;
[0090] The module extracts features sequentially, captures global context information through a multi-layer self-attention mechanism, enhances feature representation, and uses the SE module to dynamically adjust the weights of different channels to strengthen important features.
[0091] S3, feature fusion module: splices the features of different input images in the channel dimension, fuses the feature information of the image to be fused, and provides a more comprehensive feature representation for subsequent processing;
[0092] S4, feature reconstruction module: restore the fused features to the size of the fused image to obtain a binary focus feature map of the aggregated information;
[0093] S5, Trainable Self-Guided Filter: At the end of the processing flow, a trainable self-guided filter is innovatively introduced to optimize the predicted focus map using the original focus map. Through 1×1 convolution, ReLU activation, CBAM attention mechanism and the final 1×1 convolution layer, the focus map is refined to improve the spatial consistency of the fused image.
[0094] S6. Model construction and testing: Integrate the above modules into a deep learning-based tissue pathology multi-focus image fusion framework. After training, test the multi-focus image set to obtain the fusion result.
[0095] In a preferred embodiment, the further method of steps S1-S6 is:
[0096] A1. A multi-focus image set G to be registered is a set of 5230 images of different focal lengths in the same field of view of pathological tissue sections taken with an optical microscope. The image set after registration is H and the two images with different focal lengths are I. A ∈RH×W×C and I B ∈RH×W×C;
[0097] Where H represents the height of the source image, W represents the width of the source image, and C represents the number of channels of the source image. The C of the color image is 3, and the C of the grayscale image is 1.
[0098] Input I A and I B Each has a different focus area, I AWith a clear foreground against a defocused background, I B With a clear background in the case of blurred foreground, and considering I B Defocus diffusion effect on
[0099] A2. Align the multi-focus image to I A and I B As the network input, the shallow feature extraction module of the first part of the feature encoding network extracts the shallow features of the input image and
[0100] A3. Shallow features and Deep global semantic features through deep feature extraction module and
[0101] Among them, the deep feature extraction module consists of three residual Swin Transformer modules;
[0102] A4. Deep global semantic features and Through a tensor concatenation layer, concatenation is performed on the channel dimension to obtain the fusion feature F TC ;
[0103] A5. Fusion feature F TC The feature reconstruction module of the feature decoder network is input to obtain the binary focal feature map F∈RH×W×1 of aggregated information;
[0104] A6. Take the focus feature map F as input and guide map, and use the self-guided filter (SGF) process to refine the intermediate output focus map F to obtain the final focus map
[0105] A7. The focus map obtained With the original input image I A and I B Perform feature weighted calculation to obtain the final fused all-focus image I;
[0106] A8. Build the above modules into a deep learning-based histopathology multi-focus image fusion method and calculate the output fusion image I and the input image I A and I B The loss function Loss value between them is used to train the multi-focus image fusion network model by back-propagating the reduced Loss value and updating the model parameters using the Adam optimizer;
[0107] A9. Put the multi-focus image set H to be fused into the trained multi-focus image fusion framework, and test to obtain the fused image I.
[0108] Example 2
[0109] Further illustrate with reference to Example 1, as shown in the attached Figure 1 The figure shows the multi-focus image fusion process proposed by the present invention, (b) is the RSTB structure combined with SE, (c) is the internal structure of Swin Transformer, (d) is the overall structure of SE module, and (e) represents the overall architecture of trainable self-guided filter. The network we proposed is mainly divided into shallow feature extraction module, RSTB module, feature fusion module, feature reconstruction module and self-guided filter.
[0110] According to the present invention, the multi-focus fusion method of tissue pathology images comprises:
[0111] (1) Shallow Feature Extraction Module;
[0112] (2) Deep feature extraction module (consisting of 3 residual Swin Transformer modules, corresponding to RSTBlock in the figure);
[0113] (3) Feature fusion module (joining two features in the channel dimension);
[0114] (4) Feature reconstruction module;
[0115] (5) Trainable self-guided filter.
[0116] in:
[0117] Shallow Feature Extraction Module: First, the present invention uses a shallow feature extraction module H SE (·) From the source image I A and I B Extracting shallow features of tissue pathology images to be fused and The module consists of a convolutional layer activated by ReLU, with a 7×7 kernel and a stride of 1, followed by two convolutional layers activated by ReLU, each using a 3×3 kernel and a stride of 1. Convolutional layers are excellent in initial visual processing and help stabilize optimization and improve results. They effectively capture local semantic details and project them into a high-dimensional feature space, where C SF It is set to 96 to match the embedding dimension of SwinTransformer, as shown in the following formula:
[0118]
[0119] Then, the present invention combines the three residual Swin Transformer blocks (RSTB) of the Squeeze-and-Excitation Block (SE) to extract the shallow features. and Extracting deep features and As shown in the following formula:
[0120]
[0121] Among them, H DE (·) is a deep feature extraction module, which includes K residual Swin Transformer blocks (RSTB) and a squeeze excitation module (SE). In order to balance performance and efficiency, the present invention sets K to 6.
[0122] As attached Figure 1 As shown in (b), RSTB is a residual block with a Swin Transformer Layer (STL) and a Squeeze-and-Excitation (SE) module. The structure of the Squeeze-and-Excitation module is shown in the figure. Figure 1 (d) as shown.
[0123] Considering that the input feature representation of the i-th residual Swin Transformer block (RSTB) is F0, the present invention uses a sequence of L Swin Transformer layers to gradually refine and enhance the intermediate feature representation. Specifically, each Swin Transformer layer in the sequence processes its input features to generate a series of enhanced intermediate feature sets F1, F2, ..., F L .
[0124] This process not only increases the depth and richness of features, but also helps capture the fine-grained and global characteristics of image content through multi-level information distillation. Each Swin Transformer layer is designed to effectively exploit the global dependencies between image features through the self-attention mechanism, thereby achieving effective information exchange and integration between features:
[0125]
[0126] in is the i-th Swin Transformer layer in RSTB. Then, a squeeze-excitation module is added before the residual connection. The output of RSTB is defined as:
[0127] F out =H SE (F L )+F0 (4);
[0128] Among them, H SE (·) is the final squeeze-excitation module (SE). SE is designed to enhance the representation capability of the network by enabling it to perform dynamic channel-level feature recalibration.
[0129] Next, the present invention uses a tensor concatenation layer to combine the deep features and The output is represented as a tensor F TC :
[0130]
[0131] Feature reconstruction module H FR (·) consists of three modules. The first two modules are Deconv-BN-ReLU, which are used to restore the size of the concatenated tensor to the same as the source image. The last module passes through a convolutional layer with a kernel size of 7×7 to give a binary focal feature map F∈RH×W×1 that aggregates information:
[0132] F=H FR (F TC ) (6);
[0133] Finally, the present invention proposes a trainable self-guided filter (SGF) to refine the predicted focus map F, thereby directly optimizing the output during the training phase. Figure 1 As shown in (e), first, the intermediate focus map F is processed by a convolutional layer with a kernel size of 1×1 and an activation function of ReLU to expand the channel dimension from 1 to 64.
[0134] Subsequently, a convolutional block attention module (CBAM) is applied, which dynamically refines the feature representation by systematically adopting channel and spatial attention mechanisms. The sequential application of this attention mechanism significantly enhances the model's emphasis on the most salient features. The guidance map F is then generated through the last convolutional layer, which also uses a 1×1 convolution kernel and a ReLU activation function to compress the channel dimension back to 1, thus completing the conversion process.
[0135] The original guided filtering uses the guidance image F i Apply the local linear model to obtain the output value F of the i-th pixeli for:
[0136]
[0137] Where W n represents the nth local square window with radius r, i represents the window W n A pixel position within .
[0138] Linear coefficient a n and b n By minimizing the reconstruction error for each window W n Determine, that is:
[0139]
[0140] Among them, F i represents the input image, and λ is the regularization parameter that controls the smoothness. A linear regression solver is used to calculate a for each window. n and b n After filtering the output Obtained as follows:
[0141]
[0142] in and is the W surrounding each pixel i i The average coefficient in .
[0143] Therefore, the present invention uses a self-guided filter (SGF) process to refine the intermediate output focus map F to obtain the final focus map
[0144] Input multi-focus image pair I A and I B Through the multi-focus image fusion network of the present invention, the focus image The binary index F i =1 indicates focused pixel, while F i = 0 indicates out-of-focus pixels. Then the composite image of all focuses is calculated I∈RH×W×C. The all-focus image is calculated as follows:
[0145]
[0146] Loss function L:
[0147] The multi-focus image generator network model G of the present invention aims to predict the given multi-focus input image pair (I A ,I B) is a focal map F, which is as close to the real focal map F′ as possible. In order to train the model proposed in the present invention, a combination of three losses is used: reconstruction loss, adversarial loss and focal frequency loss (FFL).
[0148] The present invention defines the reconstruction loss as the difference between the real label focus map F′ and the predicted focus map F=G(I A ,I B ) is the L1 distance between:
[0149]
[0150] For the GAN target of the present invention, the least squares generative adversarial network (Least Squares
[0151] Generative Adversarial Networks, LSGAN), the specific expression is as follows:
[0152]
[0153]
[0154] L GAN =L GAN (D)+L GAN (G) (14);
[0155] The present invention adopts the focal frequency loss L FFL Restore the lost frequency in the fused image. The specific expression is as follows:
[0156]
[0157] Therefore, the ultimate goal of the present invention is a combination of three losses:
[0158] L=L rec +L GAN +L FFL (16).
[0159] The above embodiments are only preferred technical solutions of the present invention and should not be regarded as limiting the present invention. The protection scope of the present invention shall be the technical solutions recorded in the claims, including equivalent replacement solutions of the technical features in the technical solutions recorded in the claims. That is, equivalent replacement improvements within this scope are also within the protection scope of the present invention.
Claims
1. A method for adaptive spatial consistency of tissue pathology image fusion, characterized by: It includes shallow feature extraction module, RSTB module, feature fusion module, feature reconstruction module and self-guided filter; The multi-focus fusion method of tissue pathology images includes: S1, shallow feature extraction module: The input multi-focus image is preprocessed through the shallow feature extraction module to extract basic feature information; S2, deep feature extraction module: using residual Swin Transformer module, each module combines Swin Transformer layer and Squeeze-and-Excitation mechanism; The module extracts features sequentially, captures global context information through a multi-layer self-attention mechanism, enhances feature representation, and uses the SE module to dynamically adjust the weights of different channels to strengthen important features. S3, feature fusion module: splices the features of different input images in the channel dimension, fuses the feature information of the image to be fused, and provides a more comprehensive feature representation for subsequent processing; S4, feature reconstruction module: restore the fused features to the size of the fused image to obtain a binary focus feature map of the aggregated information; S5, Trainable Self-Guided Filter: At the end of the processing flow, a trainable self-guided filter is innovatively introduced to optimize the predicted focus map using the original focus map. Through 1×1 convolution, ReLU activation, CBAM attention mechanism and the final 1×1 convolution layer, the focus map is refined to improve the spatial consistency of the fused image. S6. Model construction and testing: Integrate the above modules into a deep learning-based tissue pathology multi-focus image fusion framework. After training, test the multi-focus image set to obtain the fusion result.
2. The method for adaptive spatial consistency histopathological image fusion according to claim 1, characterized in that: A further method of steps S1-S6 is: A1. A multi-focus image set G to be registered is taken with an optical microscope to capture multiple pairs of tissue pathology sections at different focal lengths in the same field of view. The image set after registration is H and the two images with different focal lengths are I. A ∈RH×W×C and I B ∈RH×W×C; Where H represents the height of the source image, W represents the width of the source image, and C represents the number of channels of the source image; Input I A and I B Each has a different focus area, I A With a clear foreground against a defocused background, I B With a clear background in the case of blurred foreground, and considering I B Defocus diffusion effect on A2. Align the multi-focus image to I A and I B As the network input, the shallow feature extraction module of the first part of the feature encoding network extracts the shallow features of the input image and A3. Shallow features and Deep global semantic features through deep feature extraction module and Among them, the deep feature extraction module consists of three residual Swin Transformer modules; A4. Deep global semantic features and Through a tensor concatenation layer, concatenation is performed on the channel dimension to obtain the fusion feature F TC ; A5. Fusion feature F TC The feature reconstruction module of the feature decoder network is input to obtain the binary focal feature map F∈RH×W×1 of aggregated information; A6. Take the focus feature map F as input and guide map, and use the self-guided filter (SGF) process to refine the intermediate output focus map F to obtain the final focus map A7. The focus map obtained With the original input image I A and I B Perform feature weighted calculation to obtain the final fused all-focus image I; A8. Build the above modules into a deep learning-based histopathology multi-focus image fusion method and calculate the output fusion image I and the input image I A and I B The loss function Loss value between them is used to train the multi-focus image fusion network model by back-propagating the reduced Loss value and updating the model parameters using the Adam optimizer; A9. Put the multi-focus image set H to be fused into the trained multi-focus image fusion framework, and test to obtain the fused image I.
3. The method for adaptive spatial consistency histopathological image fusion according to claim 2, characterized in that: The specific method of steps A1-A2 is: Through a shallow feature extraction module H SE (·) From the source image I A and I B Extracting shallow features of tissue pathology images to be fused The module consists of a convolutional layer activated by ReLU, with a 7×7 kernel and a stride of 1, followed by two convolutional layers activated by ReLU, each using a 3×3 kernel and a stride of 1; Convolutional layers excel in initial visual processing, helping to stabilize optimization and improve results; Effectively capture local semantic details and project them into a high-dimensional feature space, where C SF It is set to 96 to match the embedding dimension of Swin Transformer, as shown in the following formula: (1); 4. The method for adaptive spatial consistency histopathological image fusion according to claim 2, characterized in that: The specific method of steps A3-A4 is: By combining the three residual Swin Transformer blocks of the excitation squeeze module, RSTB extracts and Extracting deep features and As shown in the following formula: Among them, H DE (·) is the deep feature extraction module, which contains K residual Swin Transformer blocks (RSTB) and a squeeze excitation module (SE), K is set to 6; The input feature representation of the i-th residual Swin Transformer block is F0, and a sequence of L-layer Swin Transformer layers is used to gradually refine and enhance the intermediate feature representation; The intermediate feature set F1, F2, ..., F L , through multi-level information distillation, it helps to capture the fine-grained and global features of the image content. The design of each Swin Transformer layer is to effectively utilize the global dependencies between image features through the self-attention mechanism, thereby achieving effective information exchange and integration between features: in is the i-th Swin Transformer layer in RSTB. Then, a squeeze-excitation module is added before the residual connection. The output of RSTB is defined as: F out =H SE (F L )+F0 (4); Among them, H SE (·) is the final squeeze-excitation module SE, which is designed to enhance the representation capability of the network by enabling it to perform dynamic channel-level feature recalibration; Next, through a tensor concatenation layer, the deep features and The output is represented as a tensor F TC :
5. The method for adaptive spatial consistency histopathological image fusion according to claim 2, characterized in that: The specific method of steps A5-A6 is: Feature reconstruction module H FR (·) It consists of three modules. The first two modules are Deconv-BN-ReLU, which are used to restore the size of the concatenated tensor to the same as the source image. The last module passes through a convolutional layer with a kernel size of 7×7 to give a binary focal feature map F∈RH×W×1 of aggregated information. F=H FR (F TC ) (6); A trainable self-guided filter is used to refine the predicted focus map F, so that the output is directly optimized during the training phase: first, the intermediate focus map F is processed by a convolutional layer with a kernel size of 1×1 and an activation function of ReLU to expand the channel dimension from 1 to 64; Subsequently, a convolutional block attention module is applied; Then the guide map F is generated through the last convolution layer, which also uses a 1×1 convolution kernel and a ReLU activation function to compress the channel dimension back to 1, thus completing the conversion process; The original guided filtering uses the guidance image F i Apply the local linear model to obtain the output value F of the i-th pixel i for: Where W n represents the nth local square window with radius r, i represents the window W n A pixel position within ; Linear coefficient a n and b n By minimizing the reconstruction error for each window W n Determine, that is, where F i represents the input image, λ is the regularization parameter that controls the smoothness; Use a linear regression solver to calculate a for each window n and b n After filtering the output Obtained as follows: in and is the W surrounding each pixel i i The average coefficient in ; The self-guided filter process is used to refine the intermediate output focus map F to obtain the final focus map Input multi-focus image pair I A and I B Through the multi-focus image fusion network of the present invention; To get the focus image The binary index F i =1 indicates focused pixel, while F i = 0 indicates out-of-focus pixels; using the derived focus map Then the composite image of all focuses is calculated I∈RH×W×C, and the all-focus image is calculated as follows:
6. The method for adaptive spatial consistency histopathological image fusion according to claim 2, characterized in that: The method to quantify the loss function L is: The multi-focus image generator network model G aims to predict the given multi-focus input image pair (I A ,I B ) is a focal map F, which is as close as possible to the real focal map F′; To train the model, a combination of three losses is used: reconstruction loss, adversarial loss, and focal frequency loss; The reconstruction loss is defined as the difference between the true label focus map F′ and the predicted focus map F = G(I A ,I B ) is the L1 distance between: The GAN target uses the least squares generative adversarial network, and the specific expression is as follows: L GAN =L GAN (D)+L GAN (G) (14); Using the focal frequency loss L FFL Restore the lost frequency in the fused image. The specific expression is as follows: The final goal is a combination of three losses: L=L rec +L GAN +L FFL (16)
Citation Information
Cited By
High-resolution large-view-field imaging system based on multi-image splicing and fusion
CN119941513A
High-resolution large field-of-view imaging system based on multi-image stitching and fusion
CN119941513B
Differential confocal microscopic imaging system and method based on customized aperture
CN121386163A
