Brain lesion nuclear magnetic image Transform diffusion segmentation method and system based on symmetry prior
By introducing a symmetry prior and a modal prior to the magnetic image segmentation of brain lesions, the defects in the perception of details of brain lesions and regional locations are solved, and higher segmentation accuracy and stability are achieved.
Patent Information
- Application Number
- CN202411612605.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-11-13
AI Technical Summary
The existing medical imaging segmentation technology has defects in the perception of underlying details and accurate regional location of brain lesions, and the denoising diffusion model has field adaptation problems in introducing lesion-related condition information.
The Transformer diffusion segmentation method of brain lesions based on symmetry priors is adopted. The conditional encoding process is performed by combining the symmetric priors module, the modal priors module and the characteristic condition encoding module, and the features are fused by the cross attention method during denoising and denoising decoding to generate more stable segmentation results.
The segmentation accuracy of brain lesions is improved, the ability to accurately locate the lesion area is enhanced, and the performance of the model in noise and low contrast environments is improved by introducing medical prior knowledge.
Smart Images

Figure CN119723074A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a brain lesion magnetic resonance imaging Transformer diffusion segmentation method based on symmetry prior, which can be used for automatic segmentation of various brain lesions. Background Art
[0002] The spectrum of diseases in modern society has changed, and brain health has become an important part of scientific and technological innovation and medical frontiers. The brain has a complex structure, and different regions have different functions. Many brain diseases (such as dementia, brain tumors, stroke, etc.) affect specific brain regions, and brain diseases often cause lesions in the brain before clinical symptoms appear. Therefore, early diagnosis and precise positioning of lesion areas are crucial for effective treatment. Brain medical image segmentation highlights key tissue structures and lesions, and is a key intermediate link in computer-assisted diagnosis. It involves processing medical images (such as magnetic resonance imaging, MRI), highlighting key tissue structures and lesions, and is a key intermediate link in computer-assisted diagnosis. With the advancement of imaging technology, it has become possible to obtain high-resolution brain images, but the amount of image data in clinical practice is huge, and manual analysis is time-consuming and error-prone. Therefore, automated image segmentation technology has emerged. With the rapid development of artificial intelligence and deep learning, automatic segmentation technology based on deep learning has been gradually realized, becoming a research hotspot and an important direction for further development in medical image processing.
[0003] With the development of deep learning, neural networks have achieved dominant performance in medical image segmentation. U-Net, which evolved from a fully convolutional network, provides the idea of encoder-decoder network and skip connection. The superior performance shown in various medical segmentation tasks makes the U-net structure the most representative method in the field of medical image segmentation. In the U-net based on CNN, the convolution module in the U-net network is usually studied by referring to the module construction ideas of mature general network models. Although the convolution module has significant advantages in local feature extraction, the inherent limitations of convolution lead to the need to expand the receptive field by stacking convolutions of different kernel sizes, which undoubtedly leads to a waste of computing resources. In addition, the inductive bias introduced by pooling limits the CNN module's ability to perceive complex anatomical structures. Correspondingly, the visual Transformer divides the image into non-overlapping patches and calculates self-attention at this level to achieve long-distance dependency modeling and global-scale semantic information perception. This gives new inspiration to the task of medical image segmentation. In recent studies, the Transformer module is flexibly integrated into the encoder, decoder and skip connection parts in various forms, and has achieved competitive performance. However, these works often focus on improving model structure design and feature expression capabilities, but rarely pay attention to the nature of medical images themselves, and have defects in the perception of underlying details and accurate regional positioning.
[0004] In the field of image generation, denoising diffusion models have developed rapidly. Compared with previous generation models, denoising diffusion probability models can generate high-quality, clear and detailed data samples, and have advantages in training stability. The idea of recovering semantic distribution information from noise information has aroused interest in the field of medical segmentation. However, it is necessary to introduce lesion-related conditional information into the diffusion model to better recover the segmentation target from the noise. At the same time, there is a domain adaptation problem between the features of the denoising module and the conditional module, which needs to be solved. Summary of the invention
[0005] In view of the deficiencies in the prior art, the present invention provides a brain lesion magnetic resonance imaging Transformer diffusion segmentation method and system based on symmetry prior.
[0006] The technical solution of the present invention is a Transformer diffusion segmentation method for brain lesion nuclear magnetic resonance images based on symmetry prior, which comprises the following steps:
[0007] Step 1, input images related to lesion diagnosis and perform preprocessing;
[0008] Step 2, performing conditional coding processing on the processed image to generate conditional coding features;
[0009] Step 3: During the training phase, the label image is gradually subjected to forward denoising using a diffusion model to obtain a noisy image;
[0010] Step 4, combining the generated conditional coding features, performing denoising coding processing on the noisy image to generate denoising coding features;
[0011] Step 5, combining the generated conditional coding features, performing denoising decoding processing on the generated denoising coding features to generate various types of segmentation label images;
[0012] Step 6, use the loss function to train the segmentation network constructed in steps 2 to 5;
[0013] Step 7: Test the trained segmentation network to generate the most stable segmentation result.
[0014] Further, the conditional coding process includes a symmetric prior module, a modal prior module and a characteristic conditional coding module;
[0015] The processing of the symmetric prior module is as follows:
[0016] First, the original image and the inverted image are split into non-overlapping regions of fixed size in the same way, that is, image patches. The similarity matrix corresponding to the symmetric patch region is calculated by cosine similarity, and the similarity matrix is flattened into a one-dimensional vector and a value vector v is generated by linear layer projection. s , key vector k s and the query vector q s , d is the vector dimension, and the weight is calculated by the softmax function to calculate the symmetric similarity attention. for:
[0017]
[0018] The calculated attention weights are copied so that the same attention weights are present in a patch, and then restored to their original size through geometric transformation and multiplied with the input image to obtain the image features weighted by symmetry priors;
[0019] The modality prior module is modeled according to the imaging performance of the lesion substance under a specific modality. For white matter lesions, the white matter lesion substance image in the T2FLAIR image is high signal, while it is low signal in the T1 image. By calculating the difference between the original images of the two modalities, the modality prior of the i-th layer is defined as The first modality prior is the difference between T2FLAIR modality and T1 modality images:
[0020]
[0021] x t1 The T1 modality image is, xt2 It is T2FLAIR modality image;
[0022] The subsequent three layers of modality prior features are obtained through the downsampling convolution layer ConvBlock:
[0023]
[0024] The processing process of the feature condition encoding module is as follows:
[0025] The symmetrical prior weighted image features are input into the feature conditional coding module to obtain conditional coding features. The feature conditional coding module consists of four consecutive Transformer layers, each layer contains two Transformer modules, and the input multimodal image generates downsampled features layer by layer. The features of each resolution and the modal prior features of the same resolution Multiply them to get the multi-level features weighted by the modal prior. Finally, the weighted conditional features after multiplication of each layer, namely the conditional coding features, are input into the denoising encoding and denoising decoding processes and fused with the corresponding scale features. In the denoising encoding process, the conditional coding features and the denoising coding features are fused by addition. In the denoising decoding process, the conditional coding features, the denoising coding features and the denoising decoding features are fused by cross attention.
[0026] Furthermore, the process of adding noise to the label image is as follows:
[0027] For single-class lesion label images, the noise processing is directly applied. For multi-class labels, the segmentation labels are converted into multi-channel labels using onehot encoding, and t-step noise ε is applied in the forward process. t , the label image at time step t is y t , then the image x at time step t t The relationship can be expressed as:
[0028]
[0029]
[0030] where ε t ~N(0,1),α t With β t represents the noise factor, which controls the amount of noise added to the data points at each time step, and α t =1-β t , q(·) represents the probability distribution, represents the normal distribution, and I is the unit matrix. 1:T represents the final state of diffusion and noise addition, T is the final time step;
[0031] Depend on It can be deduced that:
[0032]
[0033] in y0 is the initial state of the diffusion noise process, which is the label image during training and the noise image during testing; ∈ represents the error term or random disturbance, which reflects the noise from time point to time point.
[0034] Furthermore, the denoising coding process is performed by a denoising coding module, which consists of a time coding embedding module and four consecutive Transformer downsampling modules. In the downsampling module, the denoising coding features are combined with the time coding embedding step by step to fuse the current time step information; at the same time, the conditional encoder features downsampled step by step through the four-layer Transformer are added and fused with the denoising encoder of the same resolution at the corresponding level, so that the denoising coding features contain event information.
[0035] Furthermore, the denoising encoding process specifically includes the following sub-steps:
[0036] Step 4.1, first perform time coding embedding on the time step, which concatenates the sine / cosine components after exponential decay of the time step information. The concatenated time feature embedding passes through the linear layer and the Sigmoid layer to form the final time coding embedding t emb ;
[0037] Step 4.2, Patch embedding operation, for the noisy label image x at time step t t Fill in x t Perform linear projection to embed the time code generated in step 4.1 into emb Perform nonlinear transformation and linear projection and add to x t In the process, the added vector is subjected to secondary projection transformation and normalization operation;
[0038] In step 4.3, the four-layer Transformer layer in the denoising coding module processes the input features layer by layer to generate denoising coding features, and the four-layer Transformer coding features in the denoising coding module are added to the conditional coding of the corresponding scale to supplement the denoising features with the prior conditional information.
[0039] Furthermore, the denoising decoding process is performed by the denoising decoding module, which consists of a temporal coding embedding module and four consecutive upsampling modules, where the first three layers of the upsampling module are Transformer upsampling and the last layer is convolution upsampling. The features after denoising decoding are restored to the original resolution step by step, and various types of segmentation label images are generated through the final convolution operation; in the decoding process, the encoding features of the same resolution at the corresponding levels of the denoising coding and conditional coding are fused with the decoding features of the same resolution through cross-attention, and the spectral components are screened through frequency domain processing to filter out unnecessary noise components and make up for the differences in the field distribution of the three types of features.
[0040] Furthermore, the denoising decoding process is specifically implemented including the following sub-steps:
[0041] Step 5.1, first perform time coding embedding on the time step, which concatenates the sine / cosine components after exponential decay of the time step information. The concatenated time feature embedding passes through the linear layer and the Sigmoid layer to form the final time coding embedding t emb ;
[0042] Step 5.2: The three upsampling Transformer layers in the denoising decoder process the denoising coding input features, and use the wavelet-based self-attention mechanism to calculate and improve the frequency domain component screening capability. The lower-layer decoding features are combined with the conditional coding features and denoising coding features after dimensionality increase.
[0043] The upsampling Transformer layer of each scale layer consists of two transformer blocks. The first transformer block is a three-branch attention fusion decoding, which calculates the linear projection of the denoised decoded upsampled features, the denoised encoded jump features, and the conditional encoded jump features as the query q b , key k b With the value vector v b , where the denoising decoding upsampling feature is the feature generated by the upsampling Transformer layer, the denoising coding jump feature is the feature generated by the denoising coding module of the same scale, and the conditional coding jump feature is the feature generated by the conditional coding module of the same scale. Both jump features are features connected to the denoising decoding module through jump connections; then relative position encoding and three-branch multi-head self-attention MSA calculation are performed, assuming d b is the dimension of the input feature, B b To encode relative positions:
[0044]
[0045] Subsequently, the second transformer module performs wavelet transform on the three-branch attention fusion features. The three-dimensional features are decomposed into eight-channel feature vectors in turn, representing different frequency domain signals. The signal features after frequency domain separation are further processed by the convolution layer and encoded into key and value embeddings. The self-attention is calculated together with the query embedding calculated by the three-branch attention fusion features, and finally added to the overall inverse transformed signal. Let It is the three-branch attention fusion feature:
[0046]
[0047]
[0048] DWT stands for Discrete Wavelet Transform, and IDWT stands for Inverse Discrete Wavelet Transform;
[0049] Wave-MSA stands for wavelet self-attention transformation, which performs projection transformation on the three-branch attention fusion features to obtain the query q f , key k f With the value vector v f , let d f is the dimension of the input feature, B f To encode relative positions:
[0050]
[0051] After filtering the frequency domain components using wavelet transform, the features after layer normalization are input into the feedforward network FF and added to the original features:
[0052]
[0053] In step 5.3, the decoder effectively uses cross-attention to integrate multi-scale features from multiple branches and flexibly captures sparse multi-scale detail features through wavelet attention. The decoded features are gradually upsampled after three-branch cross-attention fusion and spectral component filtering, and then restored to the original resolution through the final convolutional layer.
[0054] Furthermore, the loss function includes Dice loss function, BCE loss function and MSE loss function. Let y0 be the label image, To predict the image, the final loss function calculation formula is as follows:
[0055]
[0056] Furthermore, in step 7, during the test process, a completely noisy image is used to replace the noisy label image, and the implicit denoising diffusion model method is used to generate labels. The test process is regarded as a reverse denoising process, and a segmentation result is generated in each iteration. After multiple iterations, the most stable segmentation result is generated.
[0057] The present invention also provides a brain lesion nuclear magnetic resonance image Transformer diffusion segmentation system based on symmetry prior, comprising:
[0058] A processor and a memory, the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute a Transformer diffusion segmentation method for brain lesion nuclear magnetic resonance images based on symmetry prior as described in the above technical solution.
[0059] The present invention utilizes the diffusion denoising model and combines relevant medical prior knowledge of brain lesions to construct a Transformer-based brain lesion medical image segmentation model. It uses the deep features and prior features of the original image for long-distance conditional dependency encoding, gradually recovers the label distribution from the noise distribution, and fully integrates the features through cross-frequency domain attention, filters the spectral components, forms a more stable segmentation result, and improves the lesion segmentation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 4 is a flow chart of the training process of an embodiment of the present invention.
[0061] Figure 2 It is a flow chart of the testing process of an embodiment of the present invention.
[0062] Figure 3 4 is a flow chart of a symmetric priori module according to an embodiment of the present invention.
[0063] Figure 4 Schematic diagram of a modal prior module according to an embodiment of the present invention.
[0064] Figure 5 Schematic diagram of a diffusion coding and decoding module according to an embodiment of the present invention. DETAILED DESCRIPTION
[0065] The present invention is based on the medical priors related to brain lesions, as shown in the attached Figure 1, a novel prior-guided diffusion denoising brain lesion segmentation Transformer model is proposed, which extracts long-range coding features from images, supplemented by local information related to the prior characteristics of medical images, and further introduces frequency domain screening fusion coding components. A U-shaped denoising model is designed based on the transformer network structure. In order to maintain accurate lesion-related semantic details, a prior feature encoding branch is introduced. The prior feature encoding branch explicitly considers the modality-related voxel distribution characteristics and the spatial symmetry within the modality through a multi-level modality difference module and a symmetric similarity attention module, so as to learn the prior-guided attention mask and dynamically adjust the attention weights at the pixel level and patch level. In order to eliminate image noise and low-contrast effects, in the decoding part, a three-branch wavelet spectral hybrid attention module is designed to fuse the screened spectral feature embedding and further generate stable segmentation results.
[0066] The method provided by the present invention can be implemented using computer software technology. Figure 1 The embodiment takes dual-modality MRI (T1, T2FLAIR) input white matter high signal segmentation as an example to specifically illustrate the process of the present invention, as follows:
[0067] Step 1: Input image preprocessing. Input images related to lesion diagnosis. Clinical diagnosis of white matter hyperintensity mainly relies on T1 modality and T2FLAIR modality images. Define T1 modality image as x t1 , define the T2FLAIR modality image as x t2 Since clinical white matter hyperintensities are mainly determined using T2FLAIR modality images, the T1 modality is first registered to the T2FLAIR modality image using a registration algorithm, and the voxel spacing of the T1 modality, T2FLAIR modality, and label images is aligned, and the voxel spacing is uniformly resampled to (1.0, 1.0, 1.0). The data is divided into a training set, a validation set, and a test set in a ratio of 7:1:2.
[0068] Step 2: Input the original image {x 0 ,…,x m} to perform conditional encoding (in this case {x t1 ,x t2}), generate conditional coding features, the conditional encoder is composed of a symmetric prior module, a modal prior module and a feature conditional coding part.
[0069] Step 2.1, use the symmetric prior module to model the symmetry prior condition. The symmetric prior module queries the abnormal lesion area according to the symmetrical distribution of the brain anatomical structure and the asymmetrical distribution of the lesion substance, and calculates the significant lesion area at the plaque level with the attention mechanism. Specifically, the original image and the inverted image are first split into non-overlapping areas of fixed size, that is, image patches, in the same way. The similarity matrix corresponding to the symmetrical patch area is calculated by cosine similarity, the similarity matrix is flattened into a one-dimensional vector, and the value vector v is generated through linear layer projection. s , key vector k s and the query vector q s , d is the vector dimension, and the weight is calculated by the softmax function to calculate the symmetric similarity attention. for:
[0070]
[0071] The calculated attention weights are copied so that the same attention weights are present in a patch, and then restored to their original size through geometric transformation and multiplied with the input image to obtain the symmetry prior weighted image features.
[0072] Step 2.2, the modality prior module constructs the modality prior condition. The modality prior module builds a model based on the imaging performance of the lesion substance under a specific modality. Taking white matter lesions as an example, the white matter lesion substance image in the T2FLAIR image is high signal, while it is usually low signal in the T1 image. By calculating the difference between the original images of the two modalities, the i-th layer modality prior is defined as The first modality prior is the difference between T2FLAIR modality and T1 modality images:
[0073]
[0074] The subsequent three layers of modality prior features are obtained through the downsampling convolution layer ConvBlock:
[0075]
[0076] Step 2.3, feature conditional coding part. The image features after symmetrical prior weighting are input into the feature conditional coding part to obtain conditional coding features. The feature conditional coding part consists of four consecutive Transformer layers, each layer contains two Transformer modules. The input multimodal image generates downsampled features layer by layer. The features of each resolution and the modal prior features of the same resolution are Multiply them together to obtain multi-level features weighted by modality prior. Finally, the weighted conditional features after multiplication of each layer (i.e., the conditional coding features generated in the end) are input into the denoising encoder and denoising decoder, and fused with the corresponding scale features. In the denoising encoder, the conditional features and denoising coding features are fused by addition; in the denoising decoder, the conditional features, denoising coding features, and denoising decoding features are fused by cross attention.
[0077] Step 3: During the training phase, the label image is gradually subjected to the diffusion model forward noise process. The single-class lesion label image can be directly subjected to noise processing. For multi-class labels, the segmentation labels are converted into multi-channel labels using onehot encoding, and t-step noise ε is applied in the forward process. t , the label image at time step t is y t , then the image x at time step t t The relationship can be expressed as:
[0078]
[0079]
[0080] where ε t ~N(0,1),α t With β t represents the noise factor, which controls the amount of noise added to the data points at each time step, and α t =1-β t , q(·) represents the probability distribution, represents the normal distribution, and I is the unit matrix. 1:T represents the final state of diffusion and noise addition, T is the final time step.
[0081] Depend on
[0082] It can be deduced that:
[0083]
[0084] in y0 is the initial state of the diffusion noise process, which is the label image during training and the noise image during testing. ∈ represents the error term or random disturbance, which reflects the noise from time point to time point.
[0085] Step 4, denoising and encoding processing is performed on the noisy image. The denoising and encoding processing is performed by the denoising encoding module, which is used to construct deep features about the noisy labels, which is conducive to the model learning the distribution of lesion labels from the noise distribution. The label image after denoising in step 3 is input into the denoising encoding module, which consists of a time code embedding module and four consecutive Transformer downsampling modules. In the downsampling module, the denoising coding features are combined with the time code embedding step by step to fuse the current time step information. At the same time, the conditional encoder features that are downsampled step by step through the four-layer Transformer are added and fused with the denoising encoder of the same resolution at the corresponding level, so that the denoising coding features contain event information.
[0086] Step 4.1, first perform time coding embedding on the time step, which concatenates the sine / cosine components after exponential decay of the time step information. The concatenated time feature embedding passes through the linear layer and the Sigmoid layer to form the final time coding embedding t emb .
[0087] Step 4.2, Patch embedding operation, for the noisy label image x at time step t t Fill in x t Perform linear projection to embed the time code generated in step 4.1 into emb Perform nonlinear transformation and linear projection and add to x t In the above example, the added vector is reprojected and normalized.
[0088] In step 4.3, the four-layer Transformer layer in the denoising encoder processes the input features layer by layer to generate denoising coding features, and the four-layer Transformer coding features in the denoising encoder are added to the conditional coding of the corresponding scale to supplement the denoising features with the prior conditional information.
[0089] Step 5, the generated denoising coding features are subjected to denoising decoding processing, and the denoising decoding processing is performed by the denoising decoding module. The denoising decoding module consists of a temporal coding embedding module and four consecutive upsampling modules, of which the first three layers are Transformer upsampling and the last layer is convolution upsampling. The features after the denoising decoder are restored to the original resolution step by step, and various types of segmentation label images are generated through the final convolution operation. During the decoding process, the coded features of the same resolution at the corresponding levels of the denoising encoder and the conditional encoder are fused with the decoding features of the same resolution through cross-attention, and the spectral components are screened through frequency domain processing to filter out unnecessary noise components and make up for the differences in the field distribution of the three types of features.
[0090] Step 5.1, similar to step 4.1, firstly, the time step is time-coded and embedded. The time-coded embedding concatenates the sine / cosine components after exponential decay of the time step information. The concatenated time feature embedding passes through the linear layer and the Sigmoid layer to form the final time coding embedding t emb .
[0091] In step 5.2, the three upsampling Transformer layers in the denoising decoder process the denoising coding input features, and use the self-attention mechanism based on wavelet transformation to calculate and improve the frequency domain component screening ability. The lower-layer decoding features are combined with the conditional coding features and denoising coding features after dimensionality increase.
[0092] The upsampling Transformer layer of each scale layer consists of two transformer blocks. The first transformer block is a three-branch attention fusion decoding, which calculates the linear projection of the denoised decoded upsampled features, the denoised encoded jump features, and the conditional encoded jump features as the query q b , key k b With the value vector v b , the denoising decoding upsampled feature is the feature generated by the upsampled Transformer layer, the denoising coding jump feature is the feature generated by the denoising coding module of the same scale, and the conditional coding jump feature is the feature generated by the conditional coding module of the same scale. Both jump features are features connected to the denoising decoder through jump connections. Then perform relative position encoding and three-branch multi-head self-attention MSA calculation, assuming d b is the dimension of the input feature, B b To encode relative positions:
[0093]
[0094] Subsequently, the second transformer module performs wavelet transform on the three-branch attention fusion features. The three-dimensional features are decomposed into eight-channel feature vectors in turn, representing different frequency domain signals. The signal features after frequency domain separation are further processed by the convolution layer and encoded into key and value embeddings. The self-attention is calculated together with the query embedding calculated by the three-branch attention fusion features, and finally added to the overall inverse transformed signal. Let It is the three-branch attention fusion feature:
[0095]
[0096]
[0097] DWT stands for Discrete Wavelet Transform and IDWT stands for Inverse Discrete Wavelet Transform.
[0098] Wave-MSA stands for wavelet self-attention transformation, which performs projection transformation on the three-branch attention fusion features to obtain the query q f , key k f With the value vector v f , let d f is the dimension of the input feature, B f To encode relative positions:
[0099]
[0100] After filtering the frequency domain components using wavelet transform, the features after layer normalization are input into the feedforward network FF and added to the original features:
[0101]
[0102] In step 5.3, the decoder effectively integrates multi-scale features from multiple branches using cross attention and flexibly captures sparse multi-scale detail features through wavelet attention. The decoded features are gradually upsampled after three-branch cross attention fusion and spectral component filtering, and then restored to the original resolution through the final convolution layer.
[0103] Step 6: Forward propagate the data, use the loss function to supervise the network output, and update the network parameters through back propagation. The network parameters are verified by the validation set to obtain the optimized network parameters. During the training process, the number of execution cycles of model training is 300. In particular, the AdamW optimizer is used and the initial value of the learning rate is set to 1.0×e -4 , weight decay is 0.001, and other parameters are default values. Here, in order to make the network converge faster, the learning rate will decay at a rate of gamma = 0.5 every 20 cycles. The model obtained after training can save computing resources while ensuring network performance.
[0104] The loss functions include Dice loss function, BCE loss function and MSE loss function. Let y0 be the label image. To predict the image:
[0105]
[0106] Step 7, test the trained segmentation network. In the test step, a completely noisy image is used to replace the noisy label image, and the implicit denoising diffusion model (DDIM) method is used to generate labels. The test process is regarded as a reverse denoising process. Each iteration generates a segmentation result. After multiple iterations, the most stable segmentation result is generated.
[0107] In order to verify the effect of the present invention, the comparative experimental data of the white matter high signal segmentation dataset WMH is shown in Table 1. The Dice index and HD index are used as evaluation criteria. The higher the Dice index, the better the segmentation performance, and the lower the HD index value, the better the segmentation performance:
[0108] Table 1 Performance comparison of white matter high signal segmentation algorithms
[0109]
[0110] It can be seen that for the task of segmenting brain white matter high-signal lesions, among the three most commonly used methods (CNN-based methods, Transformer-based methods, and diffusion-based methods), the method of the present invention has advantages over other advanced methods in terms of Dice index and HD index, which verifies the effectiveness of the algorithm.
[0111] The present invention utilizes the diffusion denoising model and combines relevant medical prior knowledge of brain lesions to construct a Transformer-based brain lesion medical image segmentation model. It uses the deep features and prior features of the original image for long-distance conditional dependency encoding, gradually recovers the label distribution from the noise distribution, and fully integrates the features through cross-frequency domain attention, filters the spectral components, forms a more stable segmentation result, and improves the lesion segmentation accuracy.
[0112] The method provided by the present invention can be implemented by computer software technology. The system device implementing the method of the present invention should also be within the protection scope of the present invention.
[0113] The present invention also provides a brain lesion nuclear magnetic resonance image Transformer diffusion segmentation system based on symmetry prior, comprising:
[0114] A processor and a memory, the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute a Transformer diffusion segmentation method for brain lesion nuclear magnetic resonance images based on symmetry prior as described in the above technical solution.
[0115] The specific embodiments described herein are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the appended claims.
Claims
1. A Transformer diffusion segmentation method for brain lesion nuclear magnetic resonance images based on symmetry prior, characterized in that: The steps include: Step 1, input images related to lesion diagnosis and perform preprocessing; Step 2, performing conditional coding processing on the processed image to generate conditional coding features; Step 3: During the training phase, the label image is gradually subjected to forward denoising using a diffusion model to obtain a noisy image; Step 4, combining the generated conditional coding features, performing denoising coding processing on the noisy image to generate denoising coding features; Step 5, combining the generated conditional coding features, performing denoising decoding processing on the generated denoising coding features to generate various types of segmentation label images; Step 6, use the loss function to train the segmentation network constructed in steps 2 to 5; Step 7: Test the trained segmentation network to generate the most stable segmentation result.
2. The method for brain lesion nuclear magnetic resonance imaging Transformer diffusion segmentation based on symmetry prior according to claim 1, characterized in that: The conditional coding process includes a symmetric prior module, a modal prior module and a characteristic conditional coding module; The processing of the symmetric prior module is as follows: First, the original image and the inverted image are split into non-overlapping regions of fixed size in the same way, that is, image patches. The similarity matrix corresponding to the symmetric patch region is calculated by cosine similarity, and the similarity matrix is flattened into a one-dimensional vector and a value vector v is generated by linear layer projection. s , key vector k s and the query vector q s , d is the vector dimension, and the weight is calculated by the softmax function to calculate the symmetric similarity attention. for: The calculated attention weights are copied so that the same attention weights are present in a patch, and then restored to their original size through geometric transformation and multiplied with the input image to obtain the image features weighted by symmetry priors; The modality prior module is modeled according to the imaging performance of the lesion substance under a specific modality. For white matter lesions, the white matter lesion substance image in the T2FLAIR image is high signal, while it is low signal in the T1 image. By calculating the difference between the original images of the two modalities, the modality prior of the i-th layer is defined as The first modality prior is the difference between T2FLAIR modality and T1 modality images: x t1 The T1 modality image is, x t2 It is T2FLAIR modality image; The subsequent three layers of modality prior features are obtained through the downsampling convolution layer ConvBlock: The processing process of the feature condition encoding module is as follows: The symmetrical prior weighted image features are input into the feature conditional coding module to obtain conditional coding features. The feature conditional coding module consists of four consecutive Transformer layers, each layer contains two Transformer modules, and the input multimodal image generates downsampled features layer by layer. The features of each resolution and the modal prior features of the same resolution Multiply them to get the multi-level features weighted by the modal prior. Finally, the weighted conditional features after multiplication of each layer, namely the conditional coding features, are input into the denoising encoding and denoising decoding processes and fused with the corresponding scale features. In the denoising encoding process, the conditional coding features and the denoising coding features are fused by addition. In the denoising decoding process, the conditional coding features, the denoising coding features and the denoising decoding features are fused by cross attention.
3. The method for brain lesion nuclear magnetic resonance imaging Transformer diffusion segmentation based on symmetry prior as claimed in claim 1, characterized in that: The process of adding noise to the label image is as follows: For single-class lesion label images, the noise processing is directly applied. For multi-class labels, the segmentation labels are converted into multi-channel labels using onehot encoding, and t-step noise ε is applied in the forward process. t , the label image at time step t is y t , then the image x at time step t t The relationship can be expressed as: where ε t ~N(0,1),α t With β t represents the noise factor, which controls the amount of noise added to the data points at each time step, and α t =1-β t , q(·) represents the probability distribution, represents the normal distribution, and I is the unit matrix. 1:T represents the final state of diffusion and noise addition, T is the final time step; Depend on It can be deduced that: in y0 is the initial state of the diffusion noise process, which is the label image during training and the noise image during testing; ∈ represents the error term or random disturbance, which reflects the noise from time point to time point.
4. The method for brain lesion nuclear magnetic resonance imaging Transformer diffusion segmentation based on symmetry prior as claimed in claim 1, characterized in that: The denoising coding process is performed by the denoising coding module, which consists of a time coding embedding module and four consecutive Transformer downsampling modules. In the downsampling module, the denoising coding features are combined with the time coding embedding step by step to fuse the current time step information; at the same time, the conditional encoder features downsampled step by step through the four-layer Transformer are added and fused with the denoising encoder of the same resolution at the corresponding level, so that the denoising coding features contain event information.
5. The method for brain lesion nuclear magnetic resonance imaging Transformer diffusion segmentation based on symmetry prior as claimed in claim 4, characterized in that: The denoising coding process specifically includes the following sub-steps: Step 4.1, first perform time coding embedding on the time step, which concatenates the sine / cosine components after exponential decay of the time step information. The concatenated time feature embedding passes through the linear layer and the Sigmoid layer to form the final time coding embedding t emb ; Step 4.2, Patch embedding operation, for the noisy label image x at time step t t Fill in x t Perform linear projection to embed the time code generated in step 4.1 into emb Perform nonlinear transformation and linear projection and add to x t In the process, the added vector is subjected to secondary projection transformation and normalization operation; In step 4.3, the four-layer Transformer layer in the denoising coding module processes the input features layer by layer to generate denoising coding features, and the four-layer Transformer coding features in the denoising coding module are added to the conditional coding of the corresponding scale to supplement the denoising features with the prior conditional information.
6. The method of Transformer diffusion segmentation of brain lesion MRI images based on symmetry prior as claimed in claim 1, characterized in that: The denoising decoding process is performed by the denoising decoding module, which consists of a time coding embedding module and four consecutive upsampling modules. The first three layers of the upsampling module are Transformer upsampling, and the last layer is convolution upsampling. The features after denoising decoding are restored to the original resolution step by step, and various types of segmentation label images are generated through the final convolution operation. In the decoding process, the encoding features of the same resolution at the corresponding levels of the denoising coding and conditional coding are fused with the decoding features of the same resolution through cross-attention, and the spectral components are screened through frequency domain processing to filter out unnecessary noise components and make up for the differences in the field distribution of the three types of features.
7. The method of Transformer diffusion segmentation of brain lesion MRI images based on symmetry prior as claimed in claim 6, characterized in that: The specific implementation of the denoising decoding process includes the following sub-steps: Step 5.1, first perform time coding embedding on the time step, which concatenates the sine / cosine components after exponential decay of the time step information. The concatenated time feature embedding passes through the linear layer and the Sigmoid layer to form the final time coding embedding t emb ; Step 5.2: The three upsampling Transformer layers in the denoising decoder process the denoising coding input features, and use the wavelet-based self-attention mechanism to calculate and improve the frequency domain component screening capability. The lower-layer decoding features are combined with the conditional coding features and denoising coding features after dimensionality increase. The upsampling Transformer layer of each scale layer consists of two transformer blocks. The first transformer block is a three-branch attention fusion decoding, which calculates the linear projection of the denoised decoded upsampled features, the denoised encoded jump features, and the conditional encoded jump features as the query q b , key k b With the value vector v b , where the denoising decoding upsampling feature is the feature generated by the upsampling Transformer layer, the denoising coding jump feature is the feature generated by the denoising coding module of the same scale, and the conditional coding jump feature is the feature generated by the conditional coding module of the same scale. Both jump features are features connected to the denoising decoding module through jump connections; then relative position encoding and three-branch multi-head self-attention MSA calculation are performed, assuming d b is the dimension of the input feature, B b To encode relative positions: Subsequently, the second transformer module performs wavelet transform on the three-branch attention fusion features. The three-dimensional features are decomposed into eight-channel feature vectors in turn, representing different frequency domain signals. The signal features after frequency domain separation are further processed by the convolution layer and encoded into key and value embeddings. The self-attention is calculated together with the query embedding calculated by the three-branch attention fusion features, and finally added to the overall inverse transformed signal. Let It is the three-branch attention fusion feature: DWT stands for Discrete Wavelet Transform, and IDWT stands for Inverse Discrete Wavelet Transform; Wave-MSA stands for wavelet self-attention transformation, which performs projection transformation on the three-branch attention fusion features to obtain the query q f , key k f With the value vector v f , let d f is the dimension of the input feature, B f To encode relative positions: After filtering the frequency domain components using wavelet transform, the features after layer normalization are input into the feedforward network FF and added to the original features: In step 5.3, the decoder effectively uses cross-attention to integrate multi-scale features from multiple branches and flexibly captures sparse multi-scale detail features through wavelet attention. The decoded features are gradually upsampled after three-branch cross-attention fusion and spectral component filtering, and then restored to the original resolution through the final convolutional layer.
8. The method for brain lesion nuclear magnetic resonance imaging Transformer diffusion segmentation based on symmetry prior as claimed in claim 1, characterized in that: The loss functions include Dice loss function, BCE loss function and MSE loss function. Let y0 be the label image. To predict the image, the final loss function calculation formula is as follows:
9. The method of Transformer diffusion segmentation of brain lesion MRI images based on symmetry prior as claimed in claim 1, characterized in that: Step 7: During the test, a completely noisy image is used to replace the noisy label image, and the implicit denoising diffusion model method is used to generate labels. The test process is regarded as a reverse denoising process. Each iteration generates a segmentation result. After multiple iterations, the most stable segmentation result is generated.
10. A Transformer diffusion segmentation system for brain lesion MRI images based on symmetry prior, characterized in that: include: A processor and a memory, the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute a Transformer diffusion segmentation method for magnetic resonance imaging of brain lesions based on symmetry prior as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Three-dimensional multi-modal medical image lesion segmentation method
CN115187616A
Image segmentation method based on residual diffusion model
CN116993770A
Breast cancer image segmentation method and system based on parameter sharing and prior guidance
CN117593313A
MRI (Magnetic Resonance Imaging) brain tumor segmentation method based on multi-scale feature fusion of improved U-Net
CN117876399A
Mammary gland ultrasound image segmentation method based on denoising diffusion probability model
CN118196121A
Cited By
Chip defect detection method and device and medium
CN120495650A
A chip defect detection method, device and medium
CN120495650B
Glioma segmentation method of multimodal fusion network based on anatomical symmetry guidance
CN120807558A
Brain tumor segmentation-oriented symmetric sensing Transform method
CN121767722A
A symmetric perception transformer method for brain tumor segmentation
CN121767722B