A gamma distribution map calculation method based on a diffusion model

By using a diffusion-based method to calculate gamma distribution maps, the problem of low efficiency in quality assurance of traditional radiotherapy is solved. A complete gamma distribution map is generated, dose errors are accurately located, and the efficiency and accuracy of quality assurance in radiotherapy are improved.

CN121011314BActive Publication Date: 2026-05-19TAIYUAN UNIVERSITY OF TECHNOLOGY +1
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TAIYUAN UNIVERSITY OF TECHNOLOGY
Filing Date
2025-08-08
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Traditional radiotherapy quality assurance methods rely on measurement, which is inefficient and difficult to adapt to scenarios with high real-time requirements, such as online adaptive radiotherapy. Furthermore, existing diffusion models lack spatial distribution information, making it impossible to locate failure points and affecting their clinical reference value.

Method used

A diffusion-based gamma distribution map calculation method is adopted. By obtaining the flux distribution map of the radiation field, a gamma distribution map generation model is constructed. Multi-scale fusion Unet and dual-path residual blocks are used, combined with dilated convolution and depthwise separable convolution, and a moving window skip connection and visual Transformer module are introduced to generate a complete gamma distribution map.

Benefits of technology

The generated gamma distribution map retains spatial distribution information, accurately locates dose errors or failure points, reduces measurement steps, enhances the clinical practical value of quality assurance, enables rapid QA, and improves the training stability and generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121011314B_ABST
    Figure CN121011314B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of medical image processing and radiotherapy quality control, and particularly relates to a gamma distribution map calculation method based on a diffusion model, aiming to solve the problem of low efficiency of traditional radiotherapy quality assurance. The method comprises exporting a field fluence distribution map image from a radiotherapy planning system. Based on a conditional diffusion model, a reverse process noise estimation network is improved, the field fluence distribution map image is taken as a conditional input, field fluence distribution map information is extracted layer by layer in the encoder part, information coded at different coding scales and noise paths is fused, a multi-scale fusion Unet is used to predict diffusion noise, and a gamma distribution map generation model is constructed. A double-path residual block is used as a basic module of the encoder and the decoder of the multi-scale fusion Unet, a moving window jump connection module is used to integrate global and local features at different stages, and the moving window jump connection module introduces spatial offset through a moving window mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of medical image processing and radiotherapy quality control, and in particular to a method for calculating gamma distribution maps based on a diffusion model. Background Technology

[0002] In modern radiotherapy, intensity-modulated radiotherapy (IMRT) is widely used in clinical practice due to its high dose conformity and treatment efficiency. However, this technique involves complex dynamic control of multi-leaf collimators, which carries a significant risk of implementation error. Therefore, patient-specific quality assurance before treatment is an important means to ensure treatment safety.

[0003] Traditional quality assurance methods are primarily measurement-based, typically involving gamma analysis of measured doses or images with the results calculated by the treatment planning system. While effective, this approach is inefficient, resource-intensive, and ill-suited for scenarios with high real-time requirements, such as online adaptive radiotherapy.

[0004] In recent years, artificial intelligence technology has been introduced into quality assurance prediction research. Among them, diffusion models, due to their powerful image generation capabilities, have become a powerful tool for virtual quality assurance. However, existing methods mostly only predict gamma pass rates, lacking spatial distribution information and failing to locate failure points, thus affecting their clinical reference value. Summary of the Invention

[0005] The purpose of this invention is to provide a method for calculating gamma distribution maps based on a diffusion model, which aims to solve the problems of traditional radiotherapy quality assurance relying on measurement and low efficiency.

[0006] To achieve the above objectives, the present invention adopts the following technical solution:

[0007] This invention provides a method for calculating gamma distribution maps based on a diffusion model, comprising: S1: obtaining a radiation field flux distribution map: exporting the radiation field flux distribution map image corresponding to the treatment plan from the radiotherapy planning system; S2: constructing a gamma distribution map generation model: based on the conditional diffusion model, improving the inverse process noise estimation network, using the radiation field flux distribution map image as a conditional input, extracting radiation field flux distribution map information layer by layer in the encoder part, and fusing information encoded with noise paths at different encoding scales, using a multi-scale fusion Unet to predict diffusion noise, and constructing a gamma distribution map generation model; S3: setting up basic network modules: using dual-path residual blocks as the basic modules of the encoder and decoder of the multi-scale fusion Unet, the dual-path residual blocks are a network structure combining dilated convolution and depthwise separable convolution, and have residual structures; S4: setting up a feature fusion module: using a moving window jump connection module to integrate global and local features at different stages, the moving window jump connection module introduces spatial offset through a moving window mechanism.

[0008] In step S1, the radiation field flux distribution map is extracted from the radiotherapy planning system, and the dose or image corresponding to the radiation field is measured by the measurement tool. The images obtained from the radiotherapy planning system and the measurement tool are exported in DICOM format and transmitted to the gamma analysis platform for processing. For each group of images, a corresponding gamma distribution map is generated as a reference image under different gamma analysis standards.

[0009] In step S2, the conditional diffusion model achieves forward diffusion by gradually adding noise to the training data, and gradually denoises through reverse diffusion to restore the original data. In the reverse process, starting with Gaussian noise, Gaussian noise and the field flux distribution map image are input together into the multi-scale fusion Unet network model, and a clear gamma distribution map image is restored through the reverse denoising process.

[0010] In step S3, the input features of the dual-path residual block are divided into two paths after passing through the group normalization layer and the SiLU nonlinear activation layer. One path uses dilated convolution to introduce global context information, and the other path is depthwise separable convolution with channel attention. Depthwise separable convolution decomposes ordinary convolution into channel-wise convolution and pointwise convolution, and channel attention is used to guide the model to focus on important channel features.

[0011] The dual-path residual block employs an adaptive normalization layer based on conditional embedding, which combines time-step embeddings with residual connections for feature fusion.

[0012] In step S4, the moving window skip connection module collects and merges the feature maps generated by each encoder into a unified sequence. After processing with a moving window-based transformer, the processed feature sequence is mapped back to the original feature map at each scale.

[0013] In step S2, the encoder of the multi-scale fusion Unet is designed with two parallel channels, which are responsible for extracting noise and conditional field flux distribution map information respectively. At each resolution level, the feature maps of the two channels are added together to achieve the fusion of multi-scale information. Both the encoder and the decoder contain multiple downsampling or upsampling modules.

[0014] A visual Transformer module is introduced at the lowest level of the encoder of the multi-scale fusion Unet. The visual Transformer module is used to process low-resolution, high-semantic feature maps from the end of the encoder.

[0015] In the visual Transformer module, the input feature map is divided into non-overlapping image patches and flattened into one-dimensional vectors. A learnable positional code is added to each image patch. After linear transformation, a query, key, and value matrix is ​​generated. This matrix is ​​then input to the multi-head self-attention module for global dependency modeling. After nonlinear transformation through a feedforward neural network, the output is processed through residual connections and layer normalization. The output sequence is then reshaped into a feature map of the same size as the input.

[0016] A method for calculating gamma distribution maps based on a diffusion model also includes the following steps: Model training steps: The error is calculated using an L1 loss supervised model, and the model is trained by the maximum likelihood estimate of the network output. During the training process, the diffusion model takes real data and pure noise as input samples, outputs the noise estimated by the model, and then calculates the loss with the real noise at each time step, and iteratively updates the model parameters.

[0017] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0018] 1. This application provides a method for calculating gamma distribution maps based on a diffusion model. Compared to existing methods that only predict gamma throughput, the gamma distribution map generated by this invention fully retains spatial distribution information, accurately locating dose errors or failure points. This provides a specific spatial reference for clinical treatment plan correction, enhancing the clinical practical value of quality assurance (QA). Furthermore, this invention directly generates gamma distribution maps from the radiation field flux distribution map extracted from the treatment planning system, without relying on measured data from measurement tools. This significantly reduces the measurement steps in traditional OA processes, lowers resource consumption, and enables rapid QA.

[0019] 2. A dual-path residual block (DPRB) is employed as the basic network module, combining dilated convolution and depthwise separable convolution to efficiently enhance channel features while expanding the global receptive field. This, combined with the residual structure, mitigates gradient vanishing and improves the training stability and generalization ability of deep networks. The moving window skip connection (SWSC) module integrates multi-scale global and local features, balancing the global context and details of the image, alleviating the problem of discontinuous window boundaries, and improving the structural consistency and detail fidelity of the generated image.

[0020] 3. Multi-scale fusion Unet fuses noise and radiation field flux information through parallel channels and introduces a visual Transformer module to enhance global dependency modeling, enabling the model to effectively handle complex dose distribution scenarios in intensity-modulated radiotherapy and improve its ability to express complex image semantics. Attached Figure Description

[0021] Figure 1 This is a flowchart of a method for calculating gamma distribution maps based on a diffusion model, provided in an embodiment of this application.

[0022] Figure 2 This is a schematic diagram of a partial structure of a multi-scale fusion Unet network model provided in an embodiment of this application;

[0023] Figure 3 This is a schematic diagram of a mobile window jump connection module provided in an embodiment of this application;

[0024] Figure 4 This is a schematic diagram of a dual-path residual block provided in an embodiment of this application;

[0025] Figure 5 This is a schematic diagram of a visual Transformer module provided in an embodiment of this application;

[0026] Figure 6 This is a schematic diagram illustrating the overall process of a gamma distribution map generation model provided in an embodiment of this application;

[0027] Figure 7 This is a schematic diagram of gamma distribution provided in an embodiment of this application;

[0028] Figure 8 This is a performance evaluation experiment result diagram provided in an embodiment of this application;

[0029] Figure 9 This is another performance evaluation experiment result diagram provided in the embodiments of this application;

[0030] Figure 10 This is another performance evaluation experiment result diagram provided in the embodiments of this application;

[0031] Figure 11 This is another performance evaluation experiment result diagram provided in the embodiments of this application. Detailed Implementation

[0032] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0033] This application provides a method for calculating gamma distribution maps based on a diffusion model, implemented within the PyTorch deep learning framework. For example, ... Figure 1 As shown. The method includes:

[0034] S1: Obtain the radiation field flux distribution map: Export the radiation field flux distribution map image corresponding to the treatment plan from the radiotherapy planning system.

[0035] In step S1, the radiation field flux distribution map is extracted from the radiotherapy planning system. At the same time, the dose or image corresponding to the radiation field is measured using a measurement tool, such as EPD. The images obtained from the radiotherapy planning system and the measurement tool are exported in DICOM format and transmitted to the gamma analysis platform for processing. For each group of images, a corresponding gamma distribution map is generated as a reference image under different gamma analysis standards.

[0036] For example, in this embodiment of the application, the corresponding treatment plan is exported from the radiotherapy planning system, and 195 flux distribution maps of the radiation fields are generated. Dosimetry of the radiation field images is performed using a Varian aS1200 amorphous silicon electronic field imaging device (EPID), with an effective irradiation area of ​​43 × 43 cm. 2 The resolution was 1280×1280 pixels with a pixel pitch of 0.336 mm. To ensure geometric accuracy, dark-field and floodlight maps were used to calibrate the pixel sensitivity of the EPD, eliminating the influence of inconsistencies in the detector's internal response. Dose maps acquired from TPS and EPD were exported in DICO format and transferred to the gamma analysis platform developed in this study for processing. To eliminate interference from irrelevant regions, all images were cropped to 512×512 pixels at the center and pixel normalization was performed, standardizing pixel values ​​to the [0, 1] range. For each set of images, analysis was performed under four gamma analysis standards: 3% / 2mm, 2% / 1mm, 1% / 1mm, and 1% / 0.5mm, generating a total of 195 gamma distribution maps.

[0037] S2: Constructing a Gamma Distribution Map Generation Model: Based on the conditional diffusion model, an improved reverse process noise estimation network is used. The field flux distribution map image is used as the conditional input. The field flux distribution map information is extracted layer by layer in the encoder part. The information of the noise path encoding at different encoding scales is fused. Multi-scale fusion Unet (MFUnet) is used to predict the diffusion noise, and the gamma distribution map generation model GammaDiff is constructed.

[0038] The diffusion model belongs to the deep generative model category. Its working mechanism is as follows: first, noise is added to the available training data (this is the forward diffusion process), and then this process is reversed (i.e., denoising or reverse diffusion) to restore the data. The model gradually learns the ability to eliminate noise during this process. During diffusion, a clear flux map is gradually added with Gaussian noise until it becomes a purely noisy image. The reverse process is the opposite of the forward process. First, random Gaussian noise is generated, and then this Gaussian noise, along with the flux distribution map image, is input into a multilayer fusion Unet network model. Through the reverse denoising process, a clear image is restored. Using the flux distribution map image as a conditional input to the diffusion model results in a conditional diffusion model, which enhances the image generation effect.

[0039] In step S2, the conditional diffusion model achieves forward diffusion by gradually adding noise to the training data, and gradually denoises through reverse diffusion to restore the original data. In the reverse process, starting with Gaussian noise, Gaussian noise and the field flux distribution map image are input together into the multi-scale fusion Unet network model, and a clear gamma distribution map image is restored through the reverse denoising process.

[0040] For example, refer to Figures 2-5 , Figures 2 to 5 The overall structure of the multi-scale fusion Unet network model is shown. In step S2, the encoder of the multi-scale fusion Unet (MFUnet) is designed with two parallel channels, which are responsible for extracting noise and conditional field flux distribution map information, respectively. At each resolution level, the feature maps of the two channels are added together to achieve multi-scale information fusion. Both the encoder and decoder contain multiple downsampling or upsampling modules. Specifically, both the encoder and decoder contain four downsampling or upsampling modules.

[0041] MFUnet is a network architecture for generating gamma distribution maps. Figure 2 It can be seen that MFUnet has two input paths, one of which is y. t (The shape is (128,128,1)), the other is x fluencemap (Fire field flux distribution map, shape (128, 128, C)). The two inputs are processed by multiple feature extraction modules of different sizes. Figure 2 The diagram illustrates the variation in feature map size at different resolutions, such as from (128, 128, C) to (64, 64, C). In the encoder section, downsampling gradually reduces the feature map size to increase the receptive field and extract higher-level semantic information. In the decoder section, upsampling restores the feature map size, and skip connections are used to fuse features from corresponding encoder layers to retain more detail. The final output is a (128, 128, 1) shape, used to generate the gamma distribution map.

[0042] A visual Transformer module is introduced at the lowest level of the encoder of the multi-scale fusion Unet. The visual Transformer module is used to process low-resolution, high-semantic feature maps from the end of the encoder.

[0043] In the visual Transformer module, the input feature map is divided into non-overlapping image patches and flattened into one-dimensional vectors. A learnable positional code is added to each image patch. After linear transformation, a query, key, and value matrix is ​​generated. This matrix is ​​then input to the multi-head self-attention module for global dependency modeling. After nonlinear transformation through a feedforward neural network, the output is processed through residual connections and layer normalization. The output sequence is then reshaped into a feature map of the same size as the input.

[0044] For example, patch embedding embeds the input image patch, transforming it into a feature vector and adding positional encoding to preserve the image's spatial location information. Normalization (Nrom) normalizes the embedded features to stabilize the training process. Multi-head attention captures dependencies between different locations through a multi-head self-attention mechanism, performing global modeling. After further normalization, a multi-layer perceptron (MLP) performs a non-linear transformation on the features to further extract features, reshaping the processed feature vector into a suitable shape, and outputting it for subsequent network layers.

[0045] S3: Setting up basic network modules: Dual-Path Residual Block (DPRB) is used as the basic module for the encoder and decoder of the multi-scale fusion Unet. The dual-path residual block is a network structure that combines dilated convolution and depthwise separable convolution, and has a residual structure.

[0046] One path of DPRB uses dilation convolution to expand the receptive field and introduce global contextual information. Another path of DPRB uses depthwise convolution to decompose ordinary convolution into channel-wise convolution and pointwise convolution, reducing computational cost. Then, through a channel attention module, it guides the model to focus on important channel features.

[0047] The Channel Attention module first performs global pooling (either average or max pooling) on ​​the input feature map, compressing the features of each channel into a scalar value to obtain global information about the channel. Then, it passes through a first fully connected layer to transform the channel information and reduce dimensionality. After introducing non-linearity through the ReLU activation function, it passes through another fully connected layer to restore the original number of channels. Next, the Simoid activation function compresses the output values ​​to between 0 and 1, obtaining the weight coefficients for each channel, which are then weighted. These weight coefficients are multiplied by the corresponding channels of the original input feature map to weight the features of different channels, allowing the model to focus more on the information of important channels.

[0048] Using dual-path residual blocks as the basic modules of the MFUnet encoder and decoder, and combining a network structure that integrates dilated convolution and depthwise separable convolution, this approach balances global receptive field expansion with efficient channel feature enhancement. This effectively improves the model's ability to express complex image semantics while maintaining low computational overhead. The residual structure also mitigates gradient vanishing, which helps improve the training stability and generalization ability of deep networks.

[0049] In step S3, the input features of the dual-path residual block, after passing through a group normalization layer and a SiLU nonlinear activation layer, are divided into two paths. One path uses dilated convolution to introduce global contextual information, which is beneficial for capturing long-range dependencies and can better extract edges, textures, and large-scale target contours in the image. The other path is depthwise separable convolution with channel attention, focusing on capturing detailed features while maintaining the continuity of local information, thus achieving the best balance between global and local information processing. Depthwise separable convolution decomposes ordinary convolution into channel-wise convolution and pointwise convolution, and channel attention guides the model to focus on important channel features, greatly improving efficiency. For example, by guiding the model to focus on important channel features through the channel attention mechanism and adaptively adjusting the channel response, effective features can be enhanced and redundant information suppressed.

[0050] An example expression for a depthwise separable convolution is shown below:

[0051]

[0052]

[0053]

[0054] DepthwiseConv represents channel-wise convolution, PointwiseConv represents point-wise convolution, and Attention represents channel attention.

[0055] As one possible implementation, the dual-path residual block employs an adaptive normalization layer based on conditional embedding. This layer combines time-step embeddings with residual connections used for feature fusion. The adaptive normalization layer achieves conditional modulation by applying scaling and translation generated by conditional encoding to the normalized features. Specifically, the input feature is x, and the condition variable is time step t. First, standard group normalization is applied to x. Then, the scaling factor is obtained from the embedding through two conditional linear transformations. and offset terms The final normalization result is:

[0056]

[0057] As mentioned above, to enhance the model's ability to model global context, this embodiment introduces a Vision Transformer (ViT) module at the lowest level of the MFUnet encoder. Since Convolutional Neural Networks (CNNs) excel at extracting local features but struggle to model long-range dependencies, combining CNNs with Transformers significantly improves the understanding of image semantic structure. The ViT module processes low-resolution, high-semantic feature maps from the encoder's end, avoiding the memory and computational burden caused by introducing Transformers at high resolution.

[0058] In the ViT module, the input feature map is first divided into non-overlapping 2×2 patches and flattened into one-dimensional vectors. To preserve spatial location information, learnable positional encodings are added to each patch. After three linear transformations, query (Q), key (K), and value (V) matrices are generated and input to the Multi-head Self-Attention (MHSA) module for global dependency modeling. This mechanism helps the model more effectively identify structural boundaries and semantic consistency of images, improving the coordination and coherence of generated images. The multi-head sub-attention calculation formula is as follows:

[0059]

[0060] in is the dimension of the K vector (used for scaling); h is the number of attention heads. , , The linear transformation matrix of the i-th head; Output projection matrix.

[0061] Then, a nonlinear transformation is performed using a feedforward neural network (MLP):

[0062]

[0063] in , For a dimension matrix, , This is a bias term.

[0064] Finally, residual connections and layer normalization are performed on the output, and the output sequence is reshaped into a feature map of the same size as the input.

[0065] S4: Feature Fusion Module: The Shift Window SkipConnection (SWSC) module is used to integrate global and local features from different stages. The Shift Window SkipConnection module introduces spatial offset through the Shift Window mechanism.

[0066] The moving window skip connection module meticulously extracts multi-scale features and integrates global and local features from different stages, thereby enabling the correlation between image complexities at different stages, ensuring consistent information fusion, and achieving a balance between global context and fine-grained details. Simultaneously, the moving window mechanism introduces spatial offset, effectively mitigating boundary discontinuities caused by window partitioning. Then, the processed feature sequence is carefully mapped back to the original feature map at each scale, preserving its original connection order.

[0067]

[0068]

[0069] in This represents the s-th jump connection information of the encoder input SWSC module, flatten represents the flattening operation of the feature map, and concat represents concatenating multiple tensors together. This indicates a transformer operation based on a moving window. This means restoring the flattened feature map to its original dimensions. This represents the information output to the s-th decoder after passing through the SWSC module.

[0070] In step S4, the moving window skip connection module collects and merges the feature maps generated by each encoder into a unified sequence. After processing with a moving window-based transformer, the processed feature sequence is mapped back to the original feature map at each scale.

[0071] For example, Reshape & Window Partition reshapes the input feature map and divides it into multiple windows. Cyclic Shift performs a cyclic shift operation on the partitioned windows, and Masked Multi-Head Sub-Attention (MSA) is performed on the shifted windows to capture local and global feature information. Reverse Cyclic Shift restores the windows to their original positions and then uses Patch Flattening & Concat to flatten and concatenate the features within the windows. Finally, Reshape & Patch Unflattening restores the processed features to the dimensions of the original feature map for use as input to the subsequent decoder.

[0072] A method for calculating gamma distribution maps based on a diffusion model also includes the following steps: Model training steps: The error is calculated using an L1 loss supervised model, and the model is trained by the maximum likelihood estimate of the network output. During the training process, the diffusion model takes real data and pure noise as input samples, outputs the noise estimated by the model, and then calculates the loss with the real noise at each time step, and iteratively updates the model parameters.

[0073] For example, the loss formula is defined as follows:

[0074] Where n is the total number of samples in the training set, f(x) is the generated noisy image, and y i For the estimated noisy image, the L1 loss function is used by detecting f(x) and y. i The absolute value of the difference is used to optimize the model.

[0075] During training, the diffusion model takes real data and pure noise as input samples, outputs the model estimate of the added noise, and then calculates the loss with the real noise at each time step, iteratively updating the model parameters.

[0076] For example, such as Figure 6 and Figure 7 As shown, Figure 6 This illustrates the overall process of the gamma distribution map generation model provided in the embodiments of this application. Figure 7 This is an example gamma distribution diagram synthesized according to the gamma distribution diagram generation model provided in the embodiments of this application. Figure 6By fusing the structural features of the flux map with the generative capabilities of the diffusion model, high-precision radiotherapy quality assessment is achieved. During forward diffusion, the system adds T-step progressive Gaussian noise to the initial gamma distribution map y0, gradually transforming the structured distribution into isotropic Gaussian noise. In the reverse denoising process, the flux map and the previous time-state noise are used as conditional inputs to the DPRB to extract structural features. Finally, the same decoder structure is used to predict the noise at each time point, thereby generating an accurate gamma distribution map.

[0077] Figure 7 It includes the input flux map, the measured gamma distribution, the synthesized gamma distribution, and the residuals of both. Meanwhile, Figure 7 The left side indicates different gamma analysis standards (3% / 2mm, 2% / 1mm, 1% / 1mm, 1% / 0.5mm), and is analyzed using... Figure 4 The gamma value scale (0.00-2.00) on the right shows the distribution differences.

[0078] By comparing the measured and synthesized gamma distribution maps, as well as the distribution of values ​​in the residual map, the consistency between the gamma distribution map generated by the model and the measured results under different standards can be intuitively demonstrated, verifying the effectiveness of the method provided in this application in preserving the spatial information of the gamma distribution and reproducing the true distribution characteristics.

[0079] To verify the effectiveness of the method, the method provided in this application embodiment is based on PyTorch code and is run on a server equipped with eight RTX 4090s. The total number of diffusion steps (T) is set to 1000, and the variance of the forward process is... Set as from =0.9999 linearly decreases to = A constant of 0.08. The model was trained using the AdamW optimizer, undergoing a total of 4000 iterations. The initial learning rate was set to 0.00005, and the batch size was set to 8. To improve training stability and generalization ability, a cosine annealing learning rate scheduling strategy was adopted, performing annealing every 50 rounds to gradually reduce the learning rate to 1e-7. To improve the model's generalization ability, this embodiment also applied some data augmentation techniques, such as random flipping, to the training set. To shorten inference time, the number of generation steps S in DDIM was set to 8.

[0080] Peak signal-to-noise ratio (PSNR) and structural similarity (SSIM), as well as sensitivity, specificity, and accuracy metrics for failure point detection, are calculated using the reconstructed results and real images to evaluate the model's performance. For example, combining... Figure 8 and Figure 9 . Figure 8 The PSNR and SSIM of the gamma distribution for tolerance synthesis are shown, based on Figure 8 It can be seen that PSNR and SSIM reach their highest values ​​at a tolerance of 3% / 2mm, which are 26.4213 and 0.8995 respectively.

[0081] Figure 9 The results show the sensitivity, specificity, and accuracy of failure point detection at each tolerance in the generated gamma distribution. Sensitivity is higher when the tolerance is smaller, reaching a maximum of 0.5910 for a tolerance of 1% / 0.5 mm. Specificity is highest at a tolerance of 3% / 2 mm, at 0.9999. Accuracy is also highest at a tolerance of 3% / 2 mm, at 0.9970. The tolerance typically occurs when the dataset is highly imbalanced, with far more negative samples than positive samples. Since the model provided in this application can predict negative samples very accurately (high specificity), even with lower positive class identification capability, the overall accuracy remains high.

[0082] To further verify the effectiveness of the method provided in this application for gamma distribution map calculation, a comprehensive comparative evaluation was conducted with current mainstream methods (P2PGAN, VGG16, SwinT, and Unet) under different gamma analysis tolerance settings (3% / 2mm, 2% / 1mm, 1% / 1mm, and 1% / 0.5mm). The experimental results are as follows: Figure 10 As shown.

[0083] Overall, GammaDiff demonstrates significant advantages across all evaluation metrics, particularly exhibiting stronger stability and superior performance in image quality metrics such as PSNR and SSIM. For instance, under the 3% / 2mm condition, GammaDiff achieves the highest PSNR (26.4213) and SSIM (0.8995), although its RMSE (0.0032) is slightly higher than Unet (0.0028), but it exhibits the best performance in image structure fidelity and overall reconstruction quality.

[0084] Under the more stringent 2% / 1mm setting, GammaDiff still leads, achieving a PSNR of 22.1152, an SSIM of 0.8995, and the lowest RMSE (0.0103). Under the extreme conditions of 1% / 1mm and 1% / 0.5mm, GammaDiff still maintains good robustness, achieving PSNRs of 19.7597 and 18.3581, and SSIMs of 0.8886 and 0.8976, respectively, while also leading in RMSE (e.g., RMSE of only 0.0147 at 1% / 0.5mm).

[0085] Meanwhile, GammaDiff focuses more on structural fidelity and detail reconstruction. In contrast, other methods such as VGG16 and SwinT, while achieving higher PSNR under certain conditions, exhibit greater overall performance fluctuations, particularly under stricter tolerances where SSIM and RMSE tend to degrade significantly, revealing their shortcomings in generalization ability and robustness. In summary, GammaDiff performs excellently across multiple tolerance assessments, achieving not only high-quality image reconstruction but also demonstrating good cross-standard generalization and structural understanding capabilities. This further validates its practicality and reliability in medical image dose prediction, laying a solid technical foundation for the intelligent evaluation and optimization of radiotherapy planning systems.

[0086] For example, such as Figure 11 As shown, to comprehensively evaluate the specific impact of each key module on model performance, embodiments of this application also provide... Four sets of ablation experiments were conducted under the standard. The base model adopted the standard Unet architecture as a baseline; the second set of models introduced the DPRB module to enhance global context modeling capabilities; the third set integrated the SWSC module to further strengthen multi-scale spatial feature fusion; the final complete model included both DPRB and SWSC modules, constructed as MFUnet. All experiments were conducted under the same training strategy and hyperparameter settings to ensure the fairness and comparability of the results.

[0087] Experimental results show that the gradual introduction of each module has a positive impact on the image reconstruction quality of the model, especially in terms of SSIM and RMSE. The basic Unet model has a PSNR of 24.3618 and an SSIM of 0.8544. After introducing DPRB, the PSNR increases to 25.6185, the SSIM reaches 0.8778, and the RMSE decreases to 0.0033, indicating that global contextual information helps to enhance the ability to preserve image details. After integrating SWSC, the PSNR reaches 26.5355 and the SSIM increases to 0.8992, meaning that multi-scale feature fusion is crucial for structural restoration. Although the complete model has a slightly lower PSNR than the SWSC-enhanced model alone (26.4213 vs. 26.5355), it shows a more balanced performance in SSIM (0.8995) and RMSE (0.0032), resulting in better overall quality. This slight fluctuation may stem from the adjustment of weight allocation for different regional features during the multi-module collaborative fusion process. Although there is a slight fluctuation in pixel-level error (PSNR), the structural similarity and error control capabilities are stronger, indicating that the overall model performance is more robust.

[0088] In the description of this specification, specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples.

[0089] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for calculating gamma distribution maps based on a diffusion model, characterized in that, include: S1: Obtain the radiation field flux distribution map: Export the radiation field flux distribution map image corresponding to the treatment plan from the radiotherapy planning system; S2 : Constructing a gamma distribution map generation model: Based on the conditional diffusion model, an improved inverse process noise estimation network is used. The field flux distribution map image is used as the conditional input. Field flux distribution map information is extracted layer by layer in the encoder part. Information encoded with noise paths at different encoding scales is added and fused layer by layer at each resolution. A multi-scale fusion Unet is used to predict the diffusion noise, thus constructing the gamma distribution map generation model. The encoder of the multi-scale fusion Unet includes two parallel channels, responsible for extracting noise and conditional field flux distribution map information respectively. A visual Transformer module is introduced at the bottom layer of the encoder to process low-resolution, high-semantic feature maps. S3: Setting up the basic network modules: A dual-path residual block is used as... The dual-path residual block is a network structure that combines dilated convolution and depthwise separable convolution, forming the basic modules of the encoder and decoder of the multi-scale fusion Unet. It also incorporates a residual structure and employs an adaptive normalization layer based on conditional embedding. This adaptive normalization layer combines time-step embedding with residual connections used for feature fusion. After the input features of the dual-path residual block pass through a group normalization layer and a SiLU nonlinear activation layer, they are divided into two paths. One path uses dilated convolution to introduce global context information, while the other path applies channel attention using depthwise separable convolution. The depthwise separable convolution decomposes ordinary convolution into channel-wise convolution and pointwise convolution. The channel attention is used to guide the model to focus on important channel features related to radiotherapy. S4: The feature fusion module is set up: a moving window jump connection module is used to integrate global and local features from different stages. The moving window jump connection module introduces spatial offset through the moving window mechanism, collects and merges the feature maps generated by each encoder into a unified sequence, processes them using a moving window-based transformer, and then maps the processed feature sequence back to the original feature map at each scale to balance the global context and detail information of radiotherapy-related images.

2. The method for calculating gamma distribution maps based on a diffusion model according to claim 1, characterized in that: In step S1, the radiation field flux distribution map is extracted from the radiotherapy planning system, and the dose or image corresponding to the radiation field is measured by the measurement tool. The images obtained from the radiotherapy planning system and the measurement tool are exported in DICOM format and transmitted to the gamma analysis platform for processing. For each group of images, a corresponding gamma distribution map is generated as a reference image under different gamma analysis standards.

3. The method for calculating gamma distribution maps based on a diffusion model according to claim 1, characterized in that: In step S2, the conditional diffusion model achieves forward diffusion by gradually adding noise to the training data, and gradually denoises to restore the original data through reverse diffusion. In the reverse process, starting with Gaussian noise, Gaussian noise and the field flux distribution map image are input into the multi-scale fusion Unet network model, and a clear gamma distribution map image is restored through the reverse denoising process.

4. The method for calculating gamma distribution maps based on a diffusion model according to claim 1, characterized in that, In the visual Transformer module, the input feature map is divided into non-overlapping image blocks and flattened into a one-dimensional vector. A learnable positional code is added to each image block. After linear transformation, a query, key, and value matrix is ​​generated. The matrix is ​​then input to a multi-head self-attention module for global dependency modeling. After nonlinear transformation through a feedforward neural network, the output is processed through residual connections and layer normalization. The output sequence is then reshaped into a feature map of the same size as the input.

5. The method for calculating gamma distribution maps based on a diffusion model according to claim 1, characterized in that: The encoder and decoder of the multi-scale fusion Unet both contain multiple downsampling or upsampling modules. The encoder reduces the size of the feature map and increases the receptive field to extract higher-order semantic features through the downsampling module, and the decoder restores the size of the feature map through the upsampling module.

6. The method for calculating gamma distribution maps based on a diffusion model according to claim 1, characterized in that: The channel attention obtains global channel information through global pooling, transforms the global channel information through the first fully connected layer to reduce dimensionality, and then restores the original number of channels through the second fully connected layer after introducing nonlinearity through the ReLU activation function.

7. The method for calculating gamma distribution maps based on a diffusion model according to claim 1, characterized in that, The method for calculating gamma distribution maps based on diffusion models further includes: model training steps: using an L1 loss supervised model to calculate the error, training through the maximum likelihood estimation output by the network, during the training process, the diffusion model takes real gamma distribution map data and pure noise as input samples, outputs the model estimate of the added noise, calculates the loss with the real noise at each time step, and iteratively updates the model parameters.