3D MRI bias field correction method and system based on diffusion model
Through the 3D MRI bias field correction method based on the diffusion model, the trained model is used to perform multi-step correction, which solves the problems of low bias field correction efficiency and low accuracy in the prior art, and achieves more efficient and accurate bias field correction, and restores more uniform and real 3D MRI images.
Patent Information
- Application Number
- CN202510119074.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-23
AI Technical Summary
The existing 3D MRI bias field correction methods are inefficient, low in accuracy, and require a large amount of computing resources, making it difficult to effectively remove the bias field and affect image quality.
The 3D MRI bias field correction method based on the diffusion model is adopted, and the 3D MRI image data set and basis set of the unbiased field are obtained, and the bias field correction model is used for multi-step correction to achieve accurate correction of the bias field.
Improves the efficiency and accuracy of bias field correction, reduces the demand for computing resources, and can accurately correct the bias field under limited training data, restoring more uniform and real 3D MRI images.
Smart Images

Figure CN120032000A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of medical image analysis, and in particular relates to a 3D MRI bias field correction method and system based on a diffusion model. Background Art
[0002] 3D Magnetic Resonance Imaging (MRI) is one of the most important visualization methods in the medical field. It can accurately and clearly reflect the morphology, position and physiological state of human organs and tissues. Compared with other medical imaging methods, 3D MRI has a higher soft tissue contrast and can accurately show the early lesion areas of organs and tissues, providing important objective basis for doctors' diagnosis.
[0003] However, in clinical diagnosis based on 3D MRI, due to factors such as the inhomogeneity of the built-in RF coil distribution of the magnetic resonance imaging device, the heterogeneity of the static magnetic field, and the differences in the patient's own anatomical structure, bias fields will inevitably exist, reducing the image quality of 3D MRI. Bias field refers to the intensity inhomogeneity caused by patient-specific anatomical structure or magnetic field inhomogeneity in 3D MRI, which can be expressed as a smooth multiplication field. It affects the key steps of 3D MRI analysis, such as visualization and segmentation, and thus seriously affects subsequent diagnosis and prognosis. The goal of bias field correction is to eliminate intensity inhomogeneity and output a 3D MRI with uniform intra-tissue intensity and true inter-tissue intensity contrast. It is well known that the diffusion model performs better than other existing methods in removing Gaussian noise to generate images, and it is natural to assume that it also has great potential to remove bias fields that can be regarded as smooth noise. However, the diffusion model must use Gaussian noise (each pixel is independent of each other and follows a Gaussian distribution), which is very different from the smooth bias field (pixels are not independent of each other). Therefore, directly using the diffusion model to correct the 3D MRI bias field still has the following three limitations:
[0004] (1) The correction efficiency is low because the need to use additional Gaussian noise increases the difficulty of correction;
[0005] (2) The removed Gaussian noise is irrelevant to the correction task, which makes the process implicit and lacks explanation, making it difficult to ensure the accuracy of the correction;
[0006] (3) The large size of 3D MRI images requires huge computing resources for correction methods. Summary of the invention
[0007] The purpose of the present invention is to solve the problems of low efficiency, low precision and large computing resources required in the existing 3D MRI bias field correction method, and to propose a 3D MRI bias field correction method and system based on a diffusion model.
[0008] The technical solution adopted by the present invention to solve the above technical problems is:
[0009] According to one aspect of the present invention, a 3D MRI bias field correction method based on a diffusion model comprises the following steps:
[0010] Step S1, acquiring each 3D MRI medical image with uniform intensity, that is, acquiring each 3D MRI medical image without bias field, and obtaining a 3D MRI medical image data set according to the acquired 3D MRI medical images;
[0011] Step S2, obtaining a basis set for generating a 3D bias field label;
[0012] Step S3, training the bias field correction model using the 3D MRI medical image data set obtained in step S1 and the basis set obtained in step S2 to obtain a trained bias field correction model;
[0013] Step S4: uniformly extract voxels of the 3D MRI image X with the bias field, and use the uniformly extracted voxels to form the input image X' of the trained bias field correction model. T , use the trained bias field correction model to perform T-step bias field correction on the input image, and obtain the X' according to the output of the bias field correction model T Corrected 3D MRI image X' 0 ;
[0014] According to X' 0 , and obtain the 3D MRI image after the 3D MRI image X is corrected.
[0015] According to another aspect of the present invention, a 3D MRI bias field correction system based on a diffusion model is provided, the system comprising a 3D MRI medical image acquisition module without a bias field, a 3D MRI medical image preprocessing module, a basis set acquisition module, a bias field correction model and a 3D MRI image acquisition module to be corrected, wherein:
[0016] The 3D MRI medical image acquisition module without bias field is used to acquire each 3D MRI medical image without bias field;
[0017] The 3D MRI medical image preprocessing module is used to preprocess each acquired 3D MRI medical image without bias field;
[0018] The working process of the 3D MRI medical image preprocessing module is as follows:
[0019] For any acquired 3D MRI medical image, voxels in the 3D MRI medical image are uniformly extracted, and a size-reduced 3D MRI medical image is obtained according to the extracted voxels;
[0020] Similarly, after processing each acquired 3D MRI medical image respectively, the acquired 3D MRI medical images with reduced sizes are used to form a 3D MRI medical image data set;
[0021] The basis set acquisition module is used to acquire a basis set for generating a 3D bias field label;
[0022] The working process of the base set acquisition module is as follows:
[0023] Step S21, define the angle variable θ<180 and mod(θ,30)=0, the angle variable φ<180 and mod(φ,30)=0, the units of θ and φ are both degrees, and generate T by trigonometric function Ω (x,y,z):
[0024] T Ω (x,y,z)={S ω(x,y,z) |2≤ω≤Ω}
[0025] S ω (x,y,z)={cos(ωf(x,y,z,θ,φ)),sin(ωf(x,y,z,θ,φ))}
[0026] f(x,y,z,θ,φ)=(x cos(θ)+y sin(θ))sin(φ)+z cos(φ)
[0027] Where mod(θ,30) represents the remainder of θ divided by 30, mod(φ,30) represents the remainder of φ divided by 30, (x, y, z) represents the extracted voxel coordinates, and ω is an integer;
[0028] Traverse all combinations of θ, φ and ω values, and generate T according to each combination Ω (x,y,z), all the generated T Ω (x, y, z) are abbreviated as g 1 ,g 2 ,...,g C , using g 1 ,g 2 ,...,g C The initial basis set G = {g 1 ,g 2 ,...,g C}, C is the number of elements in the initial basis set G;
[0029] Step S22: Map each element in the initial basis set G to a set range, and map the i-th element g i The mapping result is recorded as i=1,2,...,C,using The final basis set
[0030]
[0031] Among them, min(g i ) represents g 1 ,g 2 ,...,g C The minimum value in the i ) represents g 1 ,g 2 ,...,g C The maximum value in ;
[0032] The bias field correction model is a 3D Unet network, and the bias field correction model is trained based on a 3D MRI medical image data set and a basis set to obtain a trained bias field correction model;
[0033] The training process of the bias field correction model is:
[0034] Step S31, converting the data type of each image in the 3D MRI medical image data set from unsigned integer data to floating point data, to obtain the 3D MRI medical image data set after data type conversion;
[0035] Step S32: Based on the base set Generate bias field label N:
[0036]
[0037] Among them, w i express The weight of i It obeys the standard Gaussian distribution, that is,
[0038] Step S33, performing batch division on the 3D MRI medical image dataset after data type conversion to obtain K batches of 3D MRI medical images;
[0039] Step S34, initializing batch number k=1;
[0040] Step S35, randomly sampling an integer from [0, T] as the time step t, and selecting the kth batch of images from the 3DMRI medical image dataset after data type conversion, and generating input data for bias field correction model training according to the selected images, time step t and bias field label N;
[0041] The specific process of step S35 is as follows:
[0042] For any image x in the selected k-th batch 0 , the image x 0 Transformed into the input data x of the bias field correction model t ;
[0043]
[0044] in, β j is the jth element in the linear sequence β of length T;
[0045] Similarly, each image in the selected k-th batch is processed separately;
[0046] Step S36, using the input data generated in step S35 and the sampled time step t as the input of the bias field correction model, using N as the bias field label, calculating the loss function value according to the bias field label N and the output of the bias field correction model, and fine-tuning the parameters of the bias field correction model according to the loss function value;
[0047] The loss function is the bias trend loss L BT , bias trend loss L BT Specifically:
[0048] L BT =L gradient +L mean +L MSE
[0049] Among them, L gradient is the bias gradient loss; L mean is the bias average loss; L MSE is the biased average loss;
[0050]
[0051] in, is the first-order difference operator; is the input x t After t, the bias field is corrected by the bias field output by the model; ||·|| 2 Indicates calculation of 2 norm;
[0052]
[0053] in, Indicates calculating the average value of the data in brackets;
[0054]
[0055] Step S37, determining whether the maximum number of training times has been reached;
[0056] If it is achieved, the trained bias field correction model is obtained;
[0057] If not reached, execute step S38;
[0058] Step S38, determine whether the batch number k satisfies k=K;
[0059] If not, set k=k+1 and return to step S35;
[0060] If satisfied, the 3D MRI medical image dataset after data type conversion is re-batch divided, that is, K batches of 3D MRI medical images are re-obtained, and then the process returns to step S34;
[0061] The 3D MRI image acquisition module to be corrected is used to acquire a 3D MRI image with a bias field. After preprocessing the 3D MRI image with a bias field using the 3D MRI medical image preprocessing module, the preprocessed image is input into a trained bias field correction model, and a corrected 3D MRI image is obtained according to the output of the trained bias field correction model.
[0062] The beneficial effects of the present invention are:
[0063] The method of the present invention obtains 3D MRI images through magnetic resonance imaging virtual scanning technology, and continuously uses 3D MRI images and generated bias fields to synthesize MRI images with different degrees of bias fields to train the parameters of the correction network during the training process. The method of the present invention is based on a powerful diffusion model framework, and the diffusion noise is changed from Gaussian noise to a 3D bias field with smooth characteristics, so that the network can accurately correct the bias field with smaller computing resources and memory even under limited training data. In the correction stage, multi-step correction is performed based on the diffusion model framework, so that the bias field correction network can accurately and reliably complete the bias field estimation, and realize the final bias field correction task, restore the 3D MRI image with uniform intensity and more realistic and clearer contrast, and complete the correction task of the bias field under magnetic resonance medical imaging. The 3D multivariate Gaussian bias diffusion model proposed by the present invention is a new bias field correction framework based on an unsupervised learning framework, which can solve the problem that the existing bias field correction method has limited accuracy and requires clinical labels, has the advantages of fast processing speed, high accuracy, and small required computing resources, and can be more widely used in clinical applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 is a flow chart of a 3D MRI bias field correction method based on a diffusion model of the present invention;
[0065] Figure 2 The comparison between the image correction process performed by the method of the present invention and other methods is shown in FIG. Figure 1 ;
[0066] Details represents local details, PredictedBias Field represents predicted bias field;
[0067] Figure 3 The comparison between the image correction process performed by the method of the present invention and other methods is shown in FIG. Figure 2 ;
[0068] Figure 4 The comparison between the image correction process performed by the method of the present invention and other methods is shown in FIG. Figure 3 ;
[0069] Figure 5 The comparison between the image correction process performed by the method of the present invention and other methods is shown in FIG. Figure 4 . DETAILED DESCRIPTION
[0070] Specific implementation method 1: Combination Figure 1 The present embodiment is described as follows. The present embodiment describes a 3D MRI bias field correction method based on a diffusion model, and the method specifically comprises the following steps:
[0071] Step S1, acquiring each 3D MRI medical image with uniform intensity, that is, acquiring each 3D MRI medical image without bias field (taken from a public data set or acquired by magnetic resonance imaging virtual scanning technology), and obtaining a 3D MRI medical image data set according to the acquired 3D MRI medical images;
[0072] Step S2, obtaining a basis set for generating a 3D bias field label;
[0073] Step S3, training the bias field correction model using the 3D MRI medical image data set obtained in step S1 and the basis set obtained in step S2 to obtain a trained bias field correction model;
[0074] Step S4: uniformly extract voxels of the 3D MRI image X with the bias field, and use the uniformly extracted voxels to form the input image X' of the trained bias field correction model. T , use the trained bias field correction model to perform T-step bias field correction on the input image, and obtain the X' according to the output of the bias field correction model T Corrected 3D MRI image X' 0 ;
[0075] According to X' 0 , and obtain the 3D MRI image after the 3D MRI image X is corrected.
[0076] Since existing bias field correction methods have limited correction accuracy and require a large number of clinical labels, and the diffusion model has shown strong performance in many tasks, the diffusion model has the potential to be applied in the field of bias field correction. However, directly applying the diffusion model to the 3D bias field correction task will have the challenges of slow sampling, unexplainable implicit correction, and the need for a large amount of computing resources and memory. From the perspective of the algorithm, the present invention solves the problem of uneven grayscale distribution of magnetic resonance images caused by the inherent radio frequency coil inhomogeneity and magnetic field distribution heterogeneity of the magnetic resonance equipment. The 3D bias field correction method based on the diffusion model proposed in the present invention is implemented through an unsupervised learning framework without the need for clinical labels, and based on the strong correlation between adjacent voxels of the bias field, a higher correction accuracy is achieved with smaller memory and computing resources. It has the characteristics of strong generalization ability, fast processing speed, good recovery effect, etc. It is more suitable for complex and changeable clinical applications, and can effectively improve the uniformity and quality of MRI images. It has broad application prospects and practical significance. Figures 2 to 5 As shown, the present invention corrects 3D MRI images through a bias field correction network, which can remove the uneven grayscale distribution of the image, improve the image clarity and the contrast between the tissues in the image, and is superior to other methods.
[0077] Specific implementation method 2: This implementation method is different from specific implementation method 1 in that, in step S1, a 3D MRI medical image data set is obtained according to the acquired 3D MRI medical image, specifically:
[0078] For any acquired 3D MRI medical image, voxels in the 3D MRI medical image are uniformly extracted, and a size-reduced 3D MRI medical image is obtained according to the extracted voxels;
[0079] Similarly, after processing each acquired 3D MRI medical image respectively, the acquired 3D MRI medical images with reduced sizes are used to form a 3D MRI medical image dataset.
[0080] The other steps and parameters are the same as those in the first embodiment.
[0081] The original size of the 3D MRI medical images acquired in the present invention may be uniformly 256×256×256, and the size of the reduced-size 3D MRI medical images may be 64×64×64, but is not limited to 64×64×64. Moreover, the original size of the acquired 3D MRI medical images may not be limited to 256×256×256.
[0082] The present invention can reduce the amount of calculation by uniformly extracting voxels in an image, thereby effectively improving the efficiency of bias field correction.
[0083] Specific implementation method three: This implementation method is different from specific implementation methods one or two in that the specific process of step S2 is as follows:
[0084] Step S21, define the angle variable θ<180 and mod(θ,30)=0, the angle variable φ<180 and mod(φ,30)=0, the units of θ and φ are both degrees, and generate T by trigonometric function Ω (x,y,z):
[0085] T Ω (x,y,z)={S ω(x,y,z) |2≤ω≤Ω}
[0086] S ω (x,y,z)={cos(ωf(x,y,z,θ,φ)),sin(ωf(x,y,z,θ,φ))}
[0087] f(x,y,z,θ,φ)=(x cos(θ)+y sin(θ))sin(φ)+z cos(φ)
[0088] Where mod(θ,30) represents the remainder of θ divided by 30, mod(φ,30) represents the remainder of φ divided by 30, (x, y, z) represents the extracted voxel coordinates, and ω is an integer;
[0089] According to the values of θ, φ and ω (Ω=5 in the present invention to control the smoothness of the elements in the basis set and the number of elements in the basis set, which can also be modified to other values), all combinations of θ, φ and ω are traversed, and T is generated according to each combination. Ω (x,y,z), all the generated T Ω (x, y, z) are abbreviated as g 1 ,g 2 ,...,g C , using g 1 ,g 2 ,...,g C The initial basis set G = {g 1 ,g 2 ,...,g C}, C is the number of elements in the initial basis set G;
[0090] Further explanation is as follows: the values of θ are 0, 30, 60, 90, 120, 150, the values of φ are 0, 30, 60, 90, 120, 150, and the values of ω are 2, 3, 4, 5; there are 6×6×4 parameter combinations in total, and for each parameter combination, cos(ωf(x, y, z,θ,φ)) and sin(ωf(x, y, z,θ,φ)) can be generated, that is, each parameter combination corresponds to two T Ω (x, y, z), then the value of the number of elements C in the initial basis set G is 6×6×4×2;
[0091] Step S22: Map each element in the initial basis set G to a set range, and map the i-th element g i The mapping result is recorded as i=1,2,...,C,using The final basis set
[0092] The other steps and parameters are the same as those in the first or second embodiment.
[0093] Each element in the basis set Save it to a local file in the form of a matrix for use in training.
[0094] Specific implementation mode 4: This implementation mode is different from any one of the specific implementation modes 1 to 3 in that, in step S22, each element in the initial basis set G is mapped to a set range (the value range set in the present invention is [0.9, 1.1]), specifically:
[0095]
[0096] Among them, min(g i ) means g 1 ,g 2 ,...,g C The minimum value in the i ) means g 1 ,g 2 ,...,g C The maximum value in .
[0097] The other steps and parameters are the same as those in Specific Embodiments 1 to 3.
[0098] Specific implementation mode 5: This implementation mode is different from any one of specific implementation modes 1 to 4 in that the bias field correction model is a 3D Unet network.
[0099] The other steps and parameters are the same as those in Specific Embodiments 1 to 4.
[0100] Specific implementation method 6: This implementation method is different from the specific implementation methods 1 to 5 in that the specific process of step S3 is as follows:
[0101] Step S31, converting the data type of each image in the 3D MRI medical image data set from unsigned integer data (unsigned int 8) to floating point data, to obtain a 3D MRI medical image data set after data type conversion;
[0102] Step S32: Based on the base set Generate bias field label N:
[0103]
[0104] Among them, w i express The weight of i It obeys the standard Gaussian distribution, that is,
[0105] The generated bias field is a floating point data with the same size as the 3D MRI image in the data set obtained in step S1, wherein the numerical value greater than 1 indicates that the pixel value of the point is greater than the real pixel value; the numerical value greater than 0 and less than 1 indicates that the pixel value of the point is less than the real pixel value. The inhomogeneity of the grayscale distribution in the 3D MRI image is described by the numerical change of the bias field.
[0106] Step S33, dividing the 3D MRI medical image dataset after data type conversion into batches to obtain K batches of 3D MRI medical images;
[0107] Step S34, initializing batch number k=1;
[0108] Step S35, randomly sampling an integer from [0, T] as the time step t (used to describe the degree to which the bias field affects MRI, in the present invention, the value of T is set to 100), and selecting the kth batch of images from the 3D MRI medical image dataset after data type conversion, and generating input data for bias field correction model training according to the selected images, time step t and bias field label N;
[0109] The specific process of step S35 is as follows:
[0110] For any image x in the selected k-th batch 0 , the image x 0 Transformed into the input data x of the bias field correction model t ;
[0111]
[0112] in, β j is the jth element in the linear sequence β of length T;
[0113] The elements in the linear sequence β are the left endpoint of the interval [0.0001, 0.02], the T-2 equal points in the interval [0.0001, 0.02], and the right endpoint of the interval [0.0001, 0.02]. The T-2 equal points in the interval divide the entire interval into T-1 equal parts, and the value of each equal point is accurate to ten decimal places.
[0114] Similarly, each image in the selected k-th batch is processed separately;
[0115] Step S36, using the input data generated in step S35 and the sampled time step t as the input of the bias field correction model, using N as the bias field label, calculating the loss function value according to the bias field label N and the output of the bias field correction model, and fine-tuning the parameters of the bias field correction model according to the loss function value. The present invention sets the optimizer used to optimize the parameters of the bias field correction model to be an Adam optimizer, and other optimizers may also be used instead;
[0116] Step S37, judging whether the maximum number of training times has been reached (set to 1000 times in the present invention, and treating the training process of each batch as one training session);
[0117] If it is achieved, the trained bias field correction model is obtained;
[0118] If not reached, execute step S38;
[0119] Step S38, determine whether the batch number k satisfies k=K;
[0120] If not, set k=k+1 and return to step S35;
[0121] If satisfied, the 3D MRI medical image dataset after data type conversion is re-batch-divided (i.e., the dataset is disrupted and re-divided to change the data contained in each batch), that is, K batches of 3D MRI medical images are obtained again, and then the execution returns to step S34.
[0122] The other steps and parameters are the same as those in Specific Implementation Methods 1 to 5.
[0123] The hyperparameters T, β sequence and maximum number of iterations can be modified to other values according to actual needs. The present invention models the 3D bias field as a multivariate Gaussian variable and proposes a new forward and reverse diffusion process based on the bias field. The proposed pre-processing and post-processing strategies can reduce the training and testing memory by dozens of times while ensuring high-fidelity results.
[0124] Specific implementation method 7: This implementation method is different from any one of the specific implementation methods 1 to 6 in that the loss function in step S36 is the bias trend loss L BT , bias trend loss L BT Specifically:
[0125] L BT =L gradient +L mean +L MSE
[0126] Among them, L gradient is the bias gradient loss, which is used to explicitly guide the network model to learn the strength trend of the bias field; L mean is the bias average loss, which is used to control the overall strength of the output bias field and fill the gap L gradient Only learn the relative strength of the vulnerability; L MSE is the biased average loss;
[0127]
[0128] in, is the first-order difference operator; is the input x t After t, the bias field is corrected by the bias field output by the model; ||·|| 2 Indicates calculation of 2 norm;
[0129]
[0130] in, Indicates calculating the average value of the data in brackets;
[0131]
[0132] The other steps and parameters are the same as those in Specific Embodiments 1 to 6.
[0133] The present invention utilizes the bias trend loss function to model the intensity trend of the bias field to improve the performance of the correction network.
[0134] Specific implementation eight: This implementation is different from any one of specific implementations one to seven in that the specific process of step S4 is as follows:
[0135] Step S41, uniformly extracting voxels of the 3D MRI image X with the bias field, using the uniformly extracted voxels to form a new 3D MRI image, and then converting the new 3D MRI image from unsigned integer data to floating point data to obtain a converted 3D MRI image;
[0136] Then the voxels in the converted 3D MRI image are normalized (i.e., the data of each voxel is divided by 255 to normalize to between 0 and 1), and the normalized 3D MRI image X' is obtained. T ;
[0137] Step S42, initializing t=T;
[0138] Step S43: X' t and t are used as the input of the trained bias field correction model, and the output of the bias field correction model is the bias field N θ (X' t ,t);
[0139] Step S44: According to N θ (X' t ,t) for X' t Correction is performed to obtain the 3D MRI image X' after the t-th step correction t-1 ;
[0140]
[0141] Step S45, determine whether t=1 is satisfied;
[0142] If t=1, then use the 3D MRI image X' 0 Continue to execute step S46;
[0143] If t=1 is not satisfied, set t=t-1 and return to step S43;
[0144] Step S46: 3D MRI image X' T With 3D MRI image X' 0 Divide, and use the result of the division as the predicted bias field B';
[0145] The predicted bias field B' is interpolated using the B-order spline interpolation method to obtain a bias field B with the same size as the 3D MRI image X. The 3D MRI image X is then divided by the bias field B, and the value of each voxel in the division result is multiplied by 255. The floating-point data of the multiplication result is converted into unsigned integer data, and the converted image is used as the final 3D MRI image after bias field correction.
[0146] The other steps and parameters are the same as those in Specific Embodiments 1 to 7.
[0147] Specific implementation method 9: A 3D MRI bias field correction system based on a diffusion model described in this implementation method includes a 3D MRI medical image acquisition module without a bias field, a 3D MRI medical image preprocessing module, a basis set acquisition module, a bias field correction model and a 3D MRI image acquisition module to be corrected, wherein:
[0148] The 3D MRI medical image acquisition module without bias field is used to acquire each 3D MRI medical image without bias field;
[0149] The 3D MRI medical image preprocessing module is used to preprocess each acquired 3D MRI medical image without bias field;
[0150] The working process of the 3D MRI medical image preprocessing module is as follows:
[0151] For any acquired 3D MRI medical image, voxels in the 3D MRI medical image are uniformly extracted, and a size-reduced 3D MRI medical image is obtained according to the extracted voxels;
[0152] Similarly, after processing each acquired 3D MRI medical image respectively, the acquired 3D MRI medical images with reduced sizes are used to form a 3D MRI medical image data set;
[0153] The basis set acquisition module is used to acquire a basis set for generating a 3D bias field label;
[0154] The working process of the base set acquisition module is as follows:
[0155] Step S21, define the angle variable θ<180 and mod(θ,30)=0, the angle variable φ<180 and mod(φ,30)=0, the units of θ and φ are both degrees, and generate T by trigonometric functionΩ (x,y,z):
[0156] T Ω (x,y,z)={S ω(x,y,z) |2≤ω≤Ω}
[0157] S ω (x,y,z)={cos(ωf(x,y,z,θ,φ)),sin(ωf(x,y,z,θ,φ))}
[0158] f(x,y,z,θ,φ)=(x cos(θ)+y sin(θ))sin(φ)+z cos(φ)
[0159] Where mod(θ,30) represents the remainder of θ divided by 30, mod(φ,30) represents the remainder of φ divided by 30, (x, y, z) represents the extracted voxel coordinates, and ω is an integer;
[0160] Traverse all combinations of θ, φ and ω values, and generate T according to each combination Ω (x,y,z), all the generated T Ω (x, y, z) are respectively denoted as g 1 ,g 2 ,...,g C , using g 1 ,g 2 ,...,g C The initial basis set G = {g 1 ,g 2 ,...,g C}, C is the number of elements in the initial basis set G;
[0161] Step S22: Map each element in the initial basis set G to a set range, and map the i-th element g i The mapping result is recorded as i=1,2,...,C,using The final basis set
[0162]
[0163] Among them, min(g i ) means g 1 ,g 2 ,...,g C The minimum value in the i ) means g 1 ,g 2 ,...,g C The maximum value in ;
[0164] The bias field correction model is a 3D Unet network, and the bias field correction model is trained based on a 3D MRI medical image data set and a basis set to obtain a trained bias field correction model;
[0165] The training process of the bias field correction model is:
[0166] Step S31, converting the data type of each image in the 3D MRI medical image data set from unsigned integer data (unsigned int 8) to floating point data, to obtain a 3D MRI medical image data set after data type conversion;
[0167] Step S32: Based on the base set Generate bias field label N:
[0168]
[0169] Among them, w i express The weight of i It obeys the standard Gaussian distribution, that is,
[0170] The generated bias field is a floating point data with the same size as the 3D MRI image in the data set obtained in step S1, wherein the numerical value greater than 1 indicates that the pixel value of the point is greater than the real pixel value; the numerical value greater than 0 and less than 1 indicates that the pixel value of the point is less than the real pixel value. The inhomogeneity of the grayscale distribution in the 3D MRI image is described by the numerical change of the bias field.
[0171] Step S33, dividing the 3D MRI medical image dataset after data type conversion into batches to obtain K batches of 3D MRI medical images;
[0172] Step S34, initializing batch number k=1;
[0173] Step S35, randomly sampling an integer from [0, T] as the time step t (used to describe the degree to which the bias field affects MRI, in the present invention, the value of T is set to 100), and selecting the kth batch of images from the 3D MRI medical image dataset after data type conversion, and generating input data for bias field correction model training according to the selected images, time step t and bias field label N;
[0174] The specific process of step S35 is as follows:
[0175] For any image x in the selected k-th batch 0 , the image x 0Transformed into the input data x of the bias field correction model t ;
[0176]
[0177] in, β j is the jth element in the linear sequence β of length T;
[0178] The elements in the linear sequence β are the left endpoint of the interval [0.0001, 0.02], the T-2 equal points in the interval [0.0001, 0.02], and the right endpoint of the interval [0.0001, 0.02]. The T-2 equal points in the interval divide the entire interval into T-1 equal parts, and the value of each equal point is accurate to ten decimal places.
[0179] Similarly, each image in the selected k-th batch is processed separately;
[0180] Step S36, using the input data generated in step S35 and the sampled time step t as the input of the bias field correction model, using N as the bias field label, calculating the loss function value according to the bias field label N and the output of the bias field correction model, and fine-tuning the parameters of the bias field correction model according to the loss function value. The present invention sets the optimizer used to optimize the parameters of the bias field correction model to be an Adam optimizer, and other optimizers may also be used instead;
[0181] The loss function is the bias trend loss L BT , bias trend loss L BT Specifically:
[0182] L BT =L gradient +L mean +L MSE
[0183] Among them, L gradient is the bias gradient loss, which is used to explicitly guide the network model to learn the strength trend of the bias field; L mean is the bias average loss, which is used to control the overall strength of the output bias field and fill the gap L gradient Only learn the relative strength of the vulnerability; L MSE is the biased average loss;
[0184]
[0185] in, is the first-order difference operator; is the input x t After t, the bias field is corrected by the bias field output by the model; ||·|| 2Indicates calculation of 2 norm;
[0186]
[0187] in, Indicates calculating the average value of the data in brackets;
[0188]
[0189] Step S37, judging whether the maximum number of training times has been reached (set to 1000 times in the present invention, and treating the training process of each batch as one training session);
[0190] If it is achieved, the trained bias field correction model is obtained;
[0191] If not reached, execute step S38;
[0192] Step S38, determine whether the batch number k satisfies k=K;
[0193] If not, set k=k+1 and return to step S35;
[0194] If satisfied, the 3D MRI medical image data set after data type conversion is re-batch-divided (i.e., the data set is disrupted and re-divided to change the data contained in each batch), that is, K batches of 3D MRI medical images are obtained again, and then the process returns to step S34;
[0195] The 3D MRI image acquisition module to be corrected is used to acquire a 3D MRI image with a bias field. After preprocessing the 3D MRI image with a bias field using the 3D MRI medical image preprocessing module, the preprocessed image is input into a trained bias field correction model, and a corrected 3D MRI image is obtained according to the output of the trained bias field correction model.
[0196] Specific embodiment ten: This embodiment differs from specific embodiment nine in that, after the 3D MRI medical image preprocessing module is used to preprocess the 3D MRI image with the bias field, the preprocessed image is input into the trained bias field correction model, and the corrected 3D MRI image is obtained according to the output of the trained bias field correction model; specifically:
[0197] Step S41, uniformly extracting voxels of the 3D MRI image X with the bias field, using the uniformly extracted voxels to form a new 3D MRI image, and then converting the new 3D MRI image from unsigned integer data to floating point data to obtain a converted 3D MRI image;
[0198] Then the voxels in the transformed 3D MRI image are normalized to obtain the normalized 3D MRI image X' T ;
[0199] Step S42, initializing t=T;
[0200] Step S43: X' t and t are used as the input of the trained bias field correction model, and the output of the bias field correction model is the bias field N θ (X' t ,t);
[0201] Step S44: According to N θ (X' t ,t) for X' t Correction is performed to obtain the 3D MRI image X' after the t-th step correction t-1 ;
[0202]
[0203] Step S45, determine whether t=1 is satisfied;
[0204] If t=1, then use the 3D MRI image X' 0 Continue to execute step S46;
[0205] If t=1 is not satisfied, set t=t-1 and return to step S43;
[0206] Step S46: 3D MRI image X' T With 3D MRI image X' 0 Divide, and use the result of the division as the predicted bias field B';
[0207] The predicted bias field B' is interpolated using the B-order spline interpolation method to obtain a bias field B with the same size as the 3D MRI image X. The 3D MRI image X is then divided by the bias field B, and the value of each voxel in the division result is multiplied by 255. The floating-point data of the multiplication result is converted into unsigned integer data, and the converted image is used as the final 3D MRI image after bias field correction.
[0208] The other steps and parameters are the same as those in the ninth embodiment.
[0209] The above calculation examples of the present invention are only used to explain the calculation model and calculation process of the present invention in detail, and are not intended to limit the implementation methods of the present invention. For ordinary technicians in the relevant field, other different forms of changes or modifications can be made based on the above description. It is impossible to list all the implementation methods here. All obvious changes or modifications derived from the technical solution of the present invention are still within the scope of protection of the present invention.
Claims
1. A 3D MRI bias field correction method based on a diffusion model, characterized in that: The method specifically comprises the following steps: Step S1, acquiring each 3D MRI medical image with uniform intensity, that is, acquiring each 3D MRI medical image without bias field, and obtaining a 3D MRI medical image data set according to the acquired 3D MRI medical images; Step S2, obtaining a basis set for generating a 3D bias field label; Step S3, training the bias field correction model using the 3D MRI medical image data set obtained in step S1 and the basis set obtained in step S2 to obtain a trained bias field correction model; Step S4: uniformly extract voxels of the 3D MRI image X with the bias field, and use the uniformly extracted voxels to form the input image X' of the trained bias field correction model. T , use the trained bias field correction model to perform T-step bias field correction on the input image, and obtain the X' according to the output of the bias field correction model T The corrected 3D MRI image X'0; Then, according to X'0, a 3D MRI image after the 3D MRI image X is corrected is obtained.
2. The 3D MRI bias field correction method based on diffusion model according to claim 1, characterized in that: In step S1, a 3D MRI medical image data set is obtained according to the acquired 3D MRI medical image, specifically: For any acquired 3D MRI medical image, voxels in the 3D MRI medical image are uniformly extracted, and a size-reduced 3D MRI medical image is obtained according to the extracted voxels; Similarly, after processing each acquired 3D MRI medical image respectively, the acquired 3D MRI medical images with reduced sizes are used to form a 3D MRI medical image dataset.
3. The 3D MRI bias field correction method based on diffusion model according to claim 2, characterized in that: The specific process of step S2 is: Step S21, define the angle variable θ<180 and mod(θ,30)=0, the angle variable φ<180 and mod(φ,30)=0, the units of θ and φ are both degrees, and generate T by trigonometric function Ω (x,y,z): T Ω (x,y,z)={S ω(x,y,z) |2≤ω≤Ω} S ω (x,y,z)={cos(ωf(x,y,z,θ,φ)),sin(ωf(x,y,z,θ,φ))} f(x,y,z,θ,φ)=(x cos(θ)+y sin(θ))sin(φ)+z cos(φ) Where mod(θ,30) represents the remainder of θ divided by 30, mod(φ,30) represents the remainder of φ divided by 30, (x, y, z) represents the extracted voxel coordinates, and ω is an integer; Traverse all combinations of θ, φ and ω values, and generate T according to each combination Ω (x,y,z), all the generated T Ω (x, y, z) are abbreviated as g1, g2, ..., g C , using g1,g2,...,g C The initial basis set G = {g1, g2, ..., g C }, C is the number of elements in the initial basis set G; Step S22: Map each element in the initial basis set G to a set range, and map the i-th element g i The mapping result is recorded as use The final basis set 4. The 3D MRI bias field correction method based on diffusion model according to claim 3, characterized in that: In step S22, each element in the initial basis set G is mapped to a set range, specifically: Among them, min(g i ) represents g1,g2,...,g C The minimum value in the i ) represents g1,g2,...,g C The maximum value in .
5. The 3D MRI bias field correction method based on diffusion model according to claim 4, characterized in that: The bias field correction model is a 3D Unet network.
6. The 3D MRI bias field correction method based on diffusion model according to claim 5, characterized in that: The specific process of step S3 is: Step S31, converting the data type of each image in the 3D MRI medical image data set from unsigned integer data to floating point data, to obtain the 3D MRI medical image data set after data type conversion; Step S32: Based on the base set Generate bias field label N: Among them, w i express The weight of i It obeys the standard Gaussian distribution, that is, Step S33, performing batch division on the 3D MRI medical image dataset after data type conversion to obtain K batches of 3D MRI medical images; Step S34, initializing batch number k=1; Step S35, randomly sampling an integer from [0, T] as the time step t, and selecting the kth batch of images from the 3D MRI medical image dataset after data type conversion, and generating input data for bias field correction model training according to the selected images, time step t and bias field label N; The specific process of step S35 is as follows: For any image x0 selected from the kth batch, convert the image x0 into the input data x of the bias field correction model t ; in, β j is the jth element in the linear sequence β of length T; Similarly, each image in the selected k-th batch is processed separately; Step S36, using the input data generated in step S35 and the sampled time step t as the input of the bias field correction model, using N as the bias field label, calculating the loss function value according to the bias field label N and the output of the bias field correction model, and fine-tuning the parameters of the bias field correction model according to the loss function value; Step S37, determining whether the maximum number of training times has been reached; If it is achieved, the trained bias field correction model is obtained; If not reached, execute step S38; Step S38, determine whether the batch number k satisfies k=K; If not, set k=k+1 and return to step S35; If the conditions are met, the 3D MRI medical image dataset after the data type conversion is re-batch-divided, that is, K batches of 3D MRI medical images are re-obtained, and then the process returns to step S34.
7. The 3D MRI bias field correction method based on diffusion model according to claim 6, characterized in that: The loss function in step S36 is the bias trend loss L BT , bias trend loss L BT Specifically: L BT =L gradient +L mean +L MSE Among them, L gradient is the bias gradient loss; L mean is the bias average loss; L MSE is the biased average loss; in, is the first-order difference operator; is the input x t After t, the bias field corrects the bias field output by the model; ||·||2 means calculating the 2-norm; in, Indicates calculating the average value of the data in brackets; 8. The 3D MRI bias field correction method based on diffusion model according to claim 7, characterized in that: The specific process of step S4 is as follows: Step S41, uniformly extracting voxels of the 3D MRI image X with the bias field, using the uniformly extracted voxels to form a new 3D MRI image, and then converting the new 3D MRI image from unsigned integer data to floating point data to obtain a converted 3D MRI image; Then the voxels in the transformed 3D MRI image are normalized to obtain the normalized 3D MRI image X' T ; Step S42, initializing t=T; Step S43: X' t and t are used as the input of the trained bias field correction model, and the output of the bias field correction model is the bias field N θ (X' t ,t); Step S44: According to N θ (X' t ,t) for X' t Correction is performed to obtain the 3D MRI image X' after the t-th step correction t-1 ; Step S45, determine whether t=1 is satisfied; If t=1 is satisfied, then the step S46 is continued using the 3D MRI image X'0; If t=1 is not satisfied, set t=t-1 and return to step S43; Step S46: 3D MRI image X' T Divide it by the 3D MRI image X'0, and use the result of the division as the predicted bias field B'; The predicted bias field B' is interpolated using the B-order spline interpolation method to obtain a bias field B with the same size as the 3D MRI image X. The 3D MRI image X is then divided by the bias field B, and the value of each voxel in the division result is multiplied by 255. The floating-point data of the multiplication result is converted into unsigned integer data, and the converted image is used as the final 3D MRI image after bias field correction.
9. A 3D MRI bias field correction system based on a diffusion model, characterized in that: The system includes a 3D MRI medical image acquisition module without bias field, a 3D MRI medical image preprocessing module, a basis set acquisition module, a bias field correction model and a 3D MRI image acquisition module to be corrected, wherein: The 3D MRI medical image acquisition module without bias field is used to acquire each 3D MRI medical image without bias field; The 3D MRI medical image preprocessing module is used to preprocess each acquired 3D MRI medical image without bias field; The working process of the 3D MRI medical image preprocessing module is as follows: For any acquired 3D MRI medical image, voxels in the 3D MRI medical image are uniformly extracted, and a size-reduced 3D MRI medical image is obtained according to the extracted voxels; Similarly, after processing each acquired 3D MRI medical image separately, the obtained 3D MRI medical images with reduced sizes are used to form a 3D MRI medical image data set; The basis set acquisition module is used to acquire a basis set for generating a 3D bias field label; The working process of the base set acquisition module is as follows: Step S21, define the angle variable θ<180 and mod(θ,30)=0, the angle variable φ<180 and mod(φ,30)=0, the units of θ and φ are both degrees, and generate T by trigonometric function Ω (x,y,z): T Ω (x,y,z)={S ω(x,y,z) |2≤ω≤Ω} S ω (x,y,z)={cos(ωf(x,y,z,θ,φ)),sin(ωf(x,y,z,θ,φ))} f(x,y,z,θ,φ)=(x cos(θ)+y sin(θ))sin(φ)+z cos(φ) Where mod(θ,30) represents the remainder of θ divided by 30, mod(φ,30) represents the remainder of φ divided by 30, (x, y, z) represents the extracted voxel coordinates, and ω is an integer; Traverse all combinations of θ, φ and ω values, and generate T according to each combination Ω (x,y,z), all the generated T Ω (x, y, z) are abbreviated as g1, g2, ..., g C , using g1,g2,...,g C The initial basis set G = {g1, g2, ..., g C }, C is the number of elements in the initial basis set G; Step S22: Map each element in the initial basis set G to a set range, and map the i-th element g i The mapping result is recorded as use The final basis set Among them, min(g i ) represents g1,g2,...,g C The minimum value in the i ) represents g1,g2,...,g C The maximum value in ; The bias field correction model is a 3D Unet network, and the bias field correction model is trained based on a 3D MRI medical image data set and a basis set to obtain a trained bias field correction model; The training process of the bias field correction model is: Step S31, converting the data type of each image in the 3D MRI medical image data set from unsigned integer data to floating point data, to obtain the 3D MRI medical image data set after data type conversion; Step S32: Based on the base set Generate bias field label N: Among them, w i express The weight of i It obeys the standard Gaussian distribution, that is, Step S33, performing batch division on the 3D MRI medical image dataset after data type conversion to obtain K batches of 3D MRI medical images; Step S34, initializing batch number k=1; Step S35, randomly sampling an integer from [0, T] as the time step t, and selecting the kth batch of images from the 3D MRI medical image dataset after data type conversion, and generating input data for bias field correction model training according to the selected images, time step t and bias field label N; The specific process of step S35 is as follows: For any image x0 selected from the kth batch, convert the image x0 into the input data x of the bias field correction model t ; in, β j is the jth element in the linear sequence β of length T; Similarly, each image in the selected k-th batch is processed separately; Step S36, using the input data generated in step S35 and the sampled time step t as the input of the bias field correction model, using N as the bias field label, calculating the loss function value according to the bias field label N and the output of the bias field correction model, and fine-tuning the parameters of the bias field correction model according to the loss function value; The loss function is the bias trend loss L BT , bias trend loss L BT Specifically: L BT =L gradient +L mean +L MSE Among them, L gradient is the bias gradient loss; L mean is the bias average loss; L MSE is the biased average loss; in, is the first-order difference operator; is the input x t After t, the bias field corrects the bias field output by the model; ||·||2 means calculating the 2-norm; in, Indicates calculating the average value of the data in brackets; Step S37, determining whether the maximum number of training times has been reached; If it is achieved, the trained bias field correction model is obtained; If not reached, execute step S38; Step S38, determine whether the batch number k satisfies k=K; If not, set k=k+1 and return to step S35; If satisfied, the 3D MRI medical image dataset after data type conversion is re-batch divided, that is, K batches of 3D MRI medical images are re-obtained, and then the process returns to step S34; The 3D MRI image acquisition module to be corrected is used to acquire a 3D MRI image with a bias field. After preprocessing the 3D MRI image with a bias field using the 3D MRI medical image preprocessing module, the preprocessed image is input into a trained bias field correction model, and a corrected 3D MRI image is obtained according to the output of the trained bias field correction model.
10. The 3D MRI bias field correction system based on diffusion model according to claim 9, characterized in that: After preprocessing the 3D MRI image with the bias field using the 3D MRI medical image preprocessing module, the preprocessed image is input into the trained bias field correction model, and the corrected 3D MRI image is obtained according to the output of the trained bias field correction model; specifically: Step S41, uniformly extracting voxels of the 3D MRI image X with the bias field, using the uniformly extracted voxels to form a new 3D MRI image, and then converting the new 3D MRI image from unsigned integer data to floating point data to obtain a converted 3D MRI image; Then the voxels in the transformed 3D MRI image are normalized to obtain the normalized 3D MRI image X' T ; Step S42, initializing t=T; Step S43: X' t and t are used as the input of the trained bias field correction model, and the output of the bias field correction model is the bias field N θ (X' t ,t); Step S44: According to N θ (X' t ,t) for X' t Correction is performed to obtain the 3D MRI image X' after the t-th step correction t-1 ; Step S45, determine whether t=1 is satisfied; If t=1 is satisfied, then the step S46 is continued using the 3D MRI image X'0; If t=1 is not satisfied, set t=t-1 and return to step S43; Step S46: 3D MRI image X' T Divide it by the 3D MRI image X'0, and use the result of the division as the predicted bias field B'; The predicted bias field B' is interpolated using the B-order spline interpolation method to obtain a bias field B with the same size as the 3D MRI image X. The 3D MRI image X is then divided by the bias field B, and the value of each voxel in the division result is multiplied by 255. The floating-point data of the multiplication result is converted into unsigned integer data, and the converted image is used as the final 3D MRI image after bias field correction.