Method and system for MR image missing modality completion based on diffusion model
Patent Information
- Application Number
- CN202611104094.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-24
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2046-07-24
AI Technical Summary
[0002]在药物难治性局灶性癫痫的术前评估中,立体定向脑电图(SEEG)深部电极植入后,患者往往需要在高场强磁共振成像(MRI)设备下完成扫描;由于植入的金属电极在射频场中可能产生天线效应并导致局部能量沉积,临床扫描方案大多会限制特定吸收率(SAR)及射频能量;在此约束下,高组织对比度的T2液体衰减反转恢复(T2-FLAIR)序列往往因其高能量反转脉冲和长回波链而被排除在可执行序列之外,造成T2-FLAIR模态的缺失
[0025]通过区域几何中心与三个参考点位完成目标区域网格化拆分,将闭合标记区域划分为多个子区域网格单元,结合各子区域面积分布情况计算得到区域均匀性调整参数,可根据伪影区域的局部结构形态自适应适配体素强度调整幅度,适配电极伪影区域差异化的灰度分布特点,提升参数调整的适配性与合理性;针对不同模态的局部体素分别采用圆膨胀、圆腐蚀的形态学处理方式,能够平缓电极伪影造成的局部灰度异常波动,弱化伪影带来的体素灰度突变问题;同时结合区域均匀性调整参数完成体素强度修正与归一化融合,优化双通道特征图的信息表达效果,降低电极磁化率伪影对条件特征提取的不利影响。
Smart Images

Figure CN122617654B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method and system for completing missing modalities in MR images based on a diffusion model. Background Technology
[0002] In the preoperative evaluation of drug-resistant focal epilepsy, after the implantation of stereotactic electroencephalography (SEEG) deep electrodes, patients often need to complete the scan under high field magnetic resonance imaging (MRI) equipment. Since the implanted metal electrodes may generate antenna effects in the radiofrequency field and cause local energy deposition, most clinical scanning protocols limit specific absorption rate (SAR) and radiofrequency energy. Under this constraint, high tissue contrast T2 fluid attenuated inversion recovery (T2-FLAIR) sequences are often excluded from the executable sequences due to their high-energy inversion pulses and long echo chains, resulting in the absence of T2-FLAIR modes.
[0003] Existing image completion methods for missing MRI modalities include those based on generative adversarial networks or diffusion probability models, attempting to generate corresponding T2-FLAIR images using T1-weighted and T2-weighted images. However, these methods often suffer from a common drawback in imaging data after deep electrode implantation: local magnetic susceptibility artifacts caused by implanted electrodes can significantly alter the grayscale distribution and local geometry of image voxels. Most existing methods use simple stitching or channel overlay of the original multimodal images as conditional feature maps, without performing adaptive weighting adjustments for electrode artifact regions. This can lead to distortion of texture contrast in the generated T2-FLAIR images at the gray-white matter boundary and in the region adjacent to the electrode trajectory, and the restoration effect often fails to meet the needs of subsequent anatomical structure recognition. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method and system for completing missing modalities of MR images based on a diffusion model, which helps to more accurately complete missing modalities of MR images and improves the quality and structural consistency of the generated images to a certain extent.
[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:
[0006] Firstly, a method for completing missing modalities in MR images based on a diffusion model, the method comprising:
[0007] Step 1: Acquire the first modal magnetic resonance image and the second modal magnetic resonance image; perform rigid body registration and resampling on the second modal magnetic resonance image to obtain the registered second modal image.
[0008] Step 2: In the first modal magnetic resonance image, determine the first reference position, the second reference position, and the third reference position, and connect the three reference positions to form a closed marked region;
[0009] Step 3: Using the first reference position, the second reference position, the third reference position, and the geometric center of the closed marked region as nodes, divide the closed marked region into multiple sub-region grid units to obtain the region gridded structure;
[0010] Step 4: Based on the regional gridding structure, calculate the ratio of the area dispersion of all sub-region grid cells to the total area of the closed marked region to obtain the regional uniformity adjustment parameter;
[0011] Step 5: Based on the regional uniformity adjustment parameters, the voxel intensity values located within the closed marked regions in the first modal magnetic resonance image and the registered second modal image are weighted, adjusted, normalized, and stitched together to obtain a dual-channel conditional feature map.
[0012] Step 6: Generate an initial state image by generating a random noise image based on the dual-channel conditional feature map. Repeatedly concatenate the initial state image with the dual-channel conditional feature map and input it into the pre-trained conditional diffusion model for iterative denoising. After reaching the preset number of reverse diffusion steps, output the missing modal of the completed MR image.
[0013] Secondly, a diffusion-based MR image missing modality completion system includes:
[0014] The acquisition module is used to acquire first-mode magnetic resonance images and second-mode magnetic resonance images, and to perform rigid body registration and resampling on the second-mode magnetic resonance images to obtain the registered second-mode image.
[0015] The selection module is used to determine the first reference position, the second reference position, and the third reference position in the first modal magnetic resonance image, and connect the three reference positions to form a closed marked region;
[0016] The segmentation module is used to divide the closed marked region into multiple sub-region grid cells with the first reference position, the second reference position, the third reference position and the geometric center of the closed marked region as nodes, so as to obtain a regional gridded structure;
[0017] The calculation module is used to calculate the ratio of the area dispersion of all sub-region grid cells to the total area of the closed marked region based on the regional grid structure, and obtain the regional uniformity adjustment parameters.
[0018] The adjustment module is used to adjust parameters according to regional uniformity, and to perform weighted adjustment and normalization stitching on the voxel intensity values located in the closed marked area in the first modal magnetic resonance image and the registered second modal image to obtain a dual-channel conditional feature map.
[0019] The output module is used to generate a random noise image based on the dual-channel conditional feature map to obtain the initial state image. The initial state image is repeatedly concatenated with the dual-channel conditional feature map and input into the pre-trained conditional diffusion model for iterative denoising. After reaching the preset number of reverse diffusion steps, the missing modal of the completed MR image is output.
[0020] Thirdly, a computing device, comprising:
[0021] One or more processors;
[0022] A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the method.
[0023] Fourthly, a computer-readable storage medium storing a program that, when executed by a processor, implements the method.
[0024] The above-described solution of the present invention has at least the following beneficial effects:
[0025] The target region is meshed using the region's geometric center and three reference points, dividing the closed marked region into multiple sub-region mesh units. Regional uniformity adjustment parameters are calculated based on the area distribution of each sub-region. This allows for adaptive adjustment of voxel intensity based on the local structural morphology of the artifact region, adapting to the differentiated grayscale distribution characteristics of the electrode artifact region and improving the adaptability and rationality of parameter adjustment. Morphological processing methods such as circular expansion and circular erosion are applied to local voxels of different modes, which can smooth out local grayscale anomalies caused by electrode artifacts and weaken the voxel grayscale abrupt changes caused by artifacts. Simultaneously, voxel intensity correction and normalization fusion are performed using the regional uniformity adjustment parameters, optimizing the information expression effect of the dual-channel feature map and reducing the adverse effects of electrode magnetic susceptibility artifacts on conditional feature extraction. Attached Figure Description
[0026] Figure 1 This is a schematic diagram of the process of a diffusion model-based method for completing missing modalities in MR images, provided by an embodiment of the present invention.
[0027] Figure 2 This is a schematic diagram of a diffusion-based MR image missing modality completion system provided in an embodiment of the present invention. Detailed Implementation
[0028] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0029] like Figure 1 As shown, embodiments of the present invention propose a method for completing missing modalities in MR images based on a diffusion model. The method includes the following steps:
[0030] Step 1: Acquire the first modal magnetic resonance image and the second modal magnetic resonance image; perform rigid body registration and resampling on the second modal magnetic resonance image to obtain the registered second modal image.
[0031] Step 2: In the first modal magnetic resonance image, determine the first reference position, the second reference position, and the third reference position, and connect the three reference positions to form a closed marked region;
[0032] Step 3: Using the first reference position, the second reference position, the third reference position, and the geometric center of the closed marked region as nodes, divide the closed marked region into multiple sub-region grid units to obtain the region gridded structure;
[0033] Step 4: Based on the regional gridding structure, calculate the ratio of the area dispersion of all sub-region grid cells to the total area of the closed marked region to obtain the regional uniformity adjustment parameter;
[0034] Step 5: Based on the regional uniformity adjustment parameters, the voxel intensity values located within the closed marked regions in the first modal magnetic resonance image and the registered second modal image are weighted, adjusted, normalized, and stitched together to obtain a dual-channel conditional feature map.
[0035] Step 6: Generate an initial state image by generating a random noise image based on the dual-channel conditional feature map. Repeatedly concatenate the initial state image with the dual-channel conditional feature map and input it into the pre-trained conditional diffusion model for iterative denoising. After reaching the preset number of reverse diffusion steps, output the missing modal of the completed MR image.
[0036] In this embodiment of the invention, the target region is meshed and divided using the region's geometric center and three reference points. The closed marked region is divided into multiple sub-region mesh units. The region uniformity adjustment parameters are calculated based on the area distribution of each sub-region. This allows for adaptive adjustment of voxel intensity based on the local structural morphology of the artifact region, adapting to the differentiated grayscale distribution characteristics of the electrode artifact region, and improving the adaptability and rationality of the parameter adjustment. Morphological processing methods such as circular expansion and circular erosion are applied to local voxels of different modes, which can smooth out local grayscale anomalies caused by electrode artifacts and weaken the voxel grayscale abrupt change problem caused by artifacts. At the same time, the voxel intensity correction and normalization fusion are completed in conjunction with the region uniformity adjustment parameters, optimizing the information expression effect of the dual-channel feature map and reducing the adverse effects of electrode magnetic susceptibility artifacts on conditional feature extraction.
[0037] In a preferred embodiment of the present invention, step 1, acquiring a first-mode magnetic resonance image and a second-mode magnetic resonance image, and performing rigid body registration and resampling on the second-mode magnetic resonance image to obtain a registered second-mode image, may include:
[0038] Step 101: Acquire the first modal magnetic resonance imaging (MRI) image and the second modal MRI image, and extract the voxel space coordinate set of the first modal MRI image and the voxel space coordinate set of the second modal MRI image. Specifically, this includes: acquiring multimodal MRI raw image data obtained by compliant scanning after implantation of SEEG deep electrodes in patients with drug-resistant focal epilepsy; selecting T1-weighted MRI images that are not limited by radio frequency energy, can be scanned completely, have no modal loss, and have lower interference from electrode magnetic susceptibility artifacts as the first modal MRI image, which can completely preserve the basic anatomical structure information of the brain; selecting T2-FLAIR corresponding images that are constrained by clinical SAR energy, cannot be normally acquired in complete sequences, and have structural loss and artifact grayscale distortion as the second modal MRI image; reading the DICOM raw files of the two sets of modal images, and batch parsing the imaging matrix parameters, voxel physical dimensions, three-dimensional spatial coordinate system, slice thickness parameters, and other basic imaging information contained in the images. The two sets of images were standardized in terms of basic imaging parameter reading. For the first modality magnetic resonance image, all slices of the image were traversed layer by layer according to the inherent arrangement order of the three-dimensional spatial layers, rows, and columns of the image. All pixel positions within a single slice were traversed row by row and column by column to complete the full coverage traversal of the three-dimensional voxels of the entire image. During the traversal, the three-dimensional horizontal axis physical coordinates, three-dimensional vertical axis physical coordinates, and three-dimensional vertical axis physical coordinates corresponding to the current voxel were accurately extracted for each voxel. The spatial position information of each voxel was completely recorded. The three-dimensional coordinate data of all voxels were orderly collected and integrated according to the spatial arrangement order to generate a set of first modality voxel spatial coordinates that is dimensionally regular, sequentially corresponding, and without data omissions. Using the same traversal rules, coordinate extraction methods, and data integration format as the first modality image, the second modality magnetic resonance image was processed to perform a full voxel traversal. The three-dimensional physical coordinates of each voxel in the second modality image were extracted one by one. The units and storage structures were unified, and the set of second modality voxel spatial coordinates was generated.
[0039] Step 102: Based on the voxel space coordinate set of the first modal magnetic resonance image and the voxel space coordinate set of the second modal magnetic resonance image, calculate the normalized mutual information value. Calculate the rigid body space transformation parameters with the goal of maximizing the normalized mutual information value. Specifically, this includes: performing conventional preprocessing and filtering on the two sets of magnetic resonance images; eliminating random noise and high-frequency noise during image acquisition through Gaussian smoothing filtering; slightly reducing electrode artifact noise interference; using the three-dimensional spatial coordinate system of the first modal magnetic resonance image as the global fixed reference coordinate system; and based on the voxel space coordinate set of the two sets of images, completing the preliminary matching and correspondence of the voxel spatial positions of the two sets of images one by one. For voxel units at the same 3D spatial coordinate positions in two sets of images, batch extraction of grayscale intensity values of all corresponding voxels is performed to complete the extraction and organization of global voxel grayscale data. After grayscale data extraction, refined statistical and computational processing is carried out on the global voxel grayscale values of the first and second modal images respectively. The calculation method for the grayscale distribution probability density of a single image is as follows: count the total number of voxels corresponding to each grayscale value within a single image, divide the number of voxels corresponding to a single grayscale value by the total number of effective voxels in the entire image, and the result is the probability density value corresponding to the current grayscale value. By traversing all grayscale values, the probability density value of a single image can be obtained. The complete grayscale probability density distribution of the image is obtained. Based on the grayscale probability density distribution of a single image, grayscale entropy is calculated. Specifically, the probability density value corresponding to each grayscale value is extracted one by one. The natural logarithm of the probability density value is taken. The probability density value of the corresponding grayscale value is multiplied by the logarithmic result. The results of all multiplication operations corresponding to all grayscale values are accumulated, and the accumulated result is negative to obtain the grayscale entropy of the image. Following this calculation logic, the grayscale entropy of the first modality and the grayscale entropy of the second modality are calculated respectively. Grayscale entropy is used to characterize the richness of grayscale information and the degree of disorder in the grayscale distribution of a single image. After completing the single-image information entropy calculation, a joint probability distribution matrix corresponding to the grayscale data of the two images is constructed. The row dimension of the matrix corresponds to the grayscale value level of the first modality image, and the column dimension of the matrix corresponds to the grayscale value level of the second modality image. The value at the intersection of each row and column in the matrix represents the joint probability that the grayscale values corresponding to the first modality and the grayscale values corresponding to the second modality appear synchronously at the same voxel position in the same space. The specific calculation method of the joint probability is to count the frequency of voxels that the two grayscale values match synchronously, divide the synchronous occurrence frequency by the total number of effective matching voxels in the entire image domain, and traverse all grayscale combinations to complete the matrix filling to obtain the complete joint probability distribution matrix.Based on the gray-level information entropy of the first modality image, the gray-level information entropy of the second modality image, and the joint probability distribution of gray levels in the two sets of images, the original mutual information is calculated by substituting them into the standard mutual information mathematical expression. The specific calculation logic is as follows: Iterate through the joint probability values corresponding to all gray-level combinations, divide the joint probability value by the product of the gray-level probability values corresponding to the first modality and the second modality, take the natural logarithm of the division result, multiply the logarithm by the current joint probability value, and sum the results of all gray-level combinations. The summed value is the original mutual information value of the two sets of images. Divide the original mutual information value by the sum of the information entropies of the two images to complete the normalization process, obtaining the standard normalized mutual information value. This value can accurately quantify the spatial matching degree and gray-level correlation degree of multimodal images.
[0040] After completing the mutual information quantization rule construction, all parameters of the 3D rigid body transformation model are initialized, including three axial rotation parameters and three axial translation parameters. All initial parameters are uniformly set to zero, and a fixed parameter iteration fine-tuning step size is set to construct a complete iterative optimization solution rule. The three-axis rotation parameters and three-axis translation parameters are successively fine-tuned in small steps. After each parameter fine-tuning, the rigid body transformation matrix is updated immediately. The updated transformation matrix is used to spatially remap the voxel coordinates of the second mode, and the voxel correspondence between the two sets of images is rematched. The grayscale distribution is then statistically analyzed across the entire domain again. The probability distribution, single-image information entropy, and joint probability distribution of the two images are used to recalculate the normalized mutual information value corresponding to the current parameter combination. The iterative process of parameter fine-tuning, spatial remapping, grayscale statistics, and mutual information calculation is continuously executed to continuously update the rigid body transformation parameter combination. The convergence criterion is that the normalized mutual information value approaches the global maximum value. When the mutual information value no longer produces an effective improvement after multiple iterations, the iterative operation is terminated. The parameter combination after iterative convergence is retained as the final rigid body spatial transformation parameters adapted to the spatial matching characteristics of the two sets of modal images.
[0041] Step 103: Based on the rigid body space transformation parameters, perform coordinate mapping on the voxel space coordinate set of the second modality magnetic resonance image to obtain the coordinate-mapped second modality magnetic resonance image. Specifically, this includes: constructing a three-dimensional rigid body transformation mapping matrix adapted to brain MR images using the rigid body space transformation parameters, which include rotation angle parameters and translation offset parameters in the X, Y, and Z axes, as the sole constraint standard for spatial correction of the second modality image; the three-dimensional rigid body transformation follows the linear transformation rules of spatial coordinates, and the overall transformation process is divided into two continuous operations: three-dimensional rotation transformation and three-dimensional translation transformation. In this stage, a complete coordinate correction and mapping operation is performed on each set of three-dimensional coordinate data within the voxel space coordinate set of the second modality magnetic resonance image. For any original voxel three-dimensional coordinate of the second modality image, the original coordinates are defined as X0, Y0, Z0. The three-dimensional angle deflection correction operation is performed, and the three-axis rotation correction process is completed in sequence. First, the original coordinates are rotated in the horizontal plane based on the Z-axis rotation parameter to calculate the intermediate coordinates after rotation, and the image horizontal plane acquisition angle deviation is corrected. Then, the intermediate coordinates are rotated in the coronal plane based on the Y-axis rotation parameter to obtain the updated intermediate coordinates and correct the forward and backward angle offset error of the image.
[0042] Sagittal plane rotation transformation is performed based on the X-axis rotation parameters to obtain the transition coordinates X1, Y1, and Z1 after three-axis rotation correction. After completing all three-dimensional rotation correction calculations, coordinate offset compensation calculations are performed. The three-axis translation offset parameters are retrieved, corresponding to the spatial offset compensation amounts for the X, Y, and Z axes, respectively. The values of each dimension of the rotation-corrected transition coordinates are added one by one with the corresponding axial translation compensation amounts: X2 = X1 + ΔX, Y2 = Y1 + ΔY, Z2 = Z1 + ΔZ, where ΔX, ΔY, and ΔZ are the translation offset parameters for the three axes, respectively. This calculation compensates for the overall spatial translation deviation during image acquisition, ensuring that the corrected coordinates are optimized. The voxel coordinates are aligned one by one with the standard spatial position of the first modality reference coordinate system; rotation correction and translation compensation operations are performed sequentially for each voxel, thus completing the complete coordinate mapping correction process for each voxel; the above step-by-step transformation operations are repeated for all voxel coordinates in the second modality image to obtain the new three-dimensional coordinates after all voxel corrections; after all voxel coordinates have completed the mapping correction operation, the inherent arrangement rules and spatial topological relationships of the original image's three-dimensional spatial layers, rows, and columns are strictly followed to orderly recombine and integrate all updated voxel spatial coordinates, completely reconstructing the three-dimensional spatial structure of the image and generating the second modality magnetic resonance image after coordinate mapping.
[0043] Step 104 involves trilinear interpolation resampling of the voxel intensity values of the coordinate-mapped second-modality magnetic resonance image to obtain the registered second-modality image. Specifically, this includes acquiring the second-modality magnetic resonance image after coordinate mapping correction in step 103. The linear spatial transformation of coordinate mapping disrupts the regular voxel grid arrangement of the original image, resulting in voxel gaps, uneven spacing between adjacent voxels, and abrupt gray-level discontinuities at the edges of electrode artifacts in the transformed image. Three-dimensional trilinear interpolation resampling is needed to fill these gaps and correct local gray-level smoothing. All coordinate points of the three-dimensional regular grid corresponding to the corrected image are traversed, and gaps without the original voxel intensity mapping and abnormal points with local gray-level abrupt changes exceeding the normal gray-level fluctuation range of brain tissue are screened and uniformly marked as points to be resampled and corrected. For each sub-pixel spatial point to be corrected, which is located inside a cube cell enclosed by a 3D regular voxel grid, the actual effective voxels at the eight vertices of the cube cell are locked. The eight effective voxels are all the vertex voxels of the 3D grid cell, specifically including the vertex voxels with minimum values on the X-axis, Y-axis, and Z-axis, the vertex voxels with minimum values on the X-axis, Y-axis, and Z-axis, the vertex voxels with minimum values on the X-axis, Y-axis, and Z-axis, the vertex voxels with minimum values on the X-axis, Y-axis, and Z-axis, the vertex voxels with maximum values on the X-axis, Y-axis, and Z-axis, the vertex voxels with maximum values on the X-axis, Y-axis, and Z-axis, the vertex voxels with maximum values on the X-axis, Y-axis, and Z-axis, and the vertex voxels with maximum values on the X-axis, Y-axis, and Z-axis.
[0044] The eight voxels completely surround the sub-pixel point to be corrected, and are the only effective voxels in the 3D mesh neighborhood corresponding to that point. The 3D spatial coordinates and original grayscale intensity values of the eight effective voxels in the neighborhood are collected one by one. Taking the sub-pixel point to be corrected as the calculation center, the normalized offset weights of the point relative to the standard mesh unit in the three orthogonal directions of the X-axis, Y-axis and Z-axis are calculated respectively. The offset weights in each dimension are uniformly taken from 0 to 1. The closer the weight value is to 0, the closer the point to be corrected is to the minimum value endpoint voxel of the corresponding dimension of the mesh. The closer the weight value is to 1, the closer the point to be corrected is to the maximum value endpoint voxel of the corresponding dimension of the mesh. A progressive one-dimensional linear fitting operation is performed sequentially across three dimensions. First, linear fitting is performed along the X-axis, extracting the gray intensity and grid spacing of adjacent voxels on both sides of the point to be corrected along the X-axis. Weights are assigned according to the inverse spatial distance principle, and combined with the X-axis offset weights within the 0-1 interval to complete the weighted calculation, obtaining the fitted gray-scale result along the X-axis and eliminating gray-scale discontinuity differences along the X-axis. Based on the gray-scale result obtained from the X-axis fitting, combined with the normalized offset weights within the 0-1 interval of the Y-axis, a second linear fitting operation is performed along the Y-axis to complete the fusion of two-dimensional planar gray-scale information, obtaining a two-dimensional fitted gray-scale result that conforms to the planar gray-scale distribution law. Based on the two-dimensional planar fitting result, combined with the normalized offset weights within the 0-1 interval of the Z-axis, a third linear fitting operation is performed along the Z-axis to complete the layer-by-layer fusion of multi-neighborhood gray-scale features in three-dimensional space. The three-dimensional progressive fitting is then complete. After completion, by combining the normalized weights of all dimensions corresponding to the eight neighboring voxels with the original grayscale values, a global weighted summation operation is performed to accurately solve for new voxel intensity values that adapt to local anatomical features and conform to the continuous grayscale distribution pattern of the surrounding brain tissue. Using the newly solved voxel intensity values, the blank values at the missing positions of the image grid and the abnormal grayscale values at the abrupt change positions of artifact edges are replaced one by one. The above complete process of weight calculation, dimensional progressive fitting, and grayscale update is repeated for all points to be corrected in the entire image, filling in the local image gaps caused by coordinate mapping, smoothing the grayscale abrupt transition band around the SEEG electrode artifacts, and unifying the voxel grid spacing and grayscale distribution density of the entire image. After all resampling correction operations are completed, a registered second modality image with accurate spatial alignment, continuous and uniform voxel grayscale distribution, and unified and standardized grid resolution is generated.
[0045] In this embodiment, Gaussian filtering preprocessing can effectively filter out random noise in the image, preserve key anatomical edge features, and improve the stability of subsequent data statistics and parameter calculation.
[0046] In a preferred embodiment of the present invention, step 2, determining a first reference position, a second reference position, and a third reference position in the first modal magnetic resonance image, and connecting the three reference positions to form a closed marked region, may include:
[0047] Step 201: Acquire the first modality magnetic resonance image, extract the three-dimensional spatial coordinates and voxel intensity values of each voxel in the first modality magnetic resonance image to obtain the first modality voxel intensity distribution data. Specifically, this includes: retrieving the first modality magnetic resonance image after full-domain registration preprocessing. This image is least affected by SEEG electrode magnetic susceptibility artifacts, and the brain gray and white matter, ventricles, gray matter nuclei, and brain tissue structures around the electrodes are complete and clear, without modal loss or significant gray-level distortion, serving as the reference image for anatomical boundary extraction and artifact region localization; according to the fixed arrangement order of layers, rows, and columns in the three-dimensional image storage, perform a full-coverage traversal of all effective voxels within the three-dimensional space of the image, with the traversal range strictly limited to the effective space of the image imaging matrix, and remove blank background voxels without anatomical information at the image edges; during the traversal, for each effective central voxel, precisely... The three-dimensional physical space coordinates corresponding to the voxel are read, namely the horizontal axis coordinate, the vertical axis coordinate, and the vertical axis coordinate, and the original gray intensity value of the voxel is collected simultaneously. The three sets of spatial coordinate parameters of a single voxel are bound and stored with the unique corresponding gray intensity value to establish a one-to-one correspondence between spatial position and gray feature, ensuring that the source of each set of data is traceable, the spatial position does not overlap, and the gray value is not missing. The coordinate reading, intensity acquisition, and data binding operations of all valid voxels in the whole domain are continuously completed, fully covering all voxel features in the uniform area of normal brain tissue, the abrupt change area of anatomical structure edge, and the SEEG electrode artifact distortion area. The storage dimension and arrangement order of all data are unified, and all bound data are integrated in sequence according to the three-dimensional spatial arrangement order of voxels to generate the first modality voxel intensity distribution data with complete structure, unified dimension, and accurate spatial correspondence.
[0048] Step 202: Based on the first modality voxel intensity distribution data, calculate the intensity difference between adjacent voxels in the first direction, the intensity difference between adjacent voxels in the second direction, and the intensity difference between adjacent voxels in the third direction for each voxel to obtain three gradient components. Calculate the sum of squares of the three gradient components and then calculate the arithmetic square root to obtain the gradient magnitude. Mark voxels with gradient magnitudes greater than a preset gradient threshold as boundary voxels. The anatomical structure boundary feature map is constructed from all boundary voxels. Specifically, this includes: calling the first modality voxel intensity distribution data, performing global three-dimensional gradient quantization calculations on each effective center voxel within the image, and solving for the gradient components and overall gradient magnitude in the three orthogonal directions for each voxel; setting the horizontal, vertical, and axial axes of the image's three-dimensional space as three mutually orthogonal reference calculation directions, and for any center voxel... For the central voxel, adjacent effective voxels on one side are selected in three directions, with the interval between adjacent voxels and the central voxel being a single voxel unit. The gradient components in the three directions are calculated by subtracting the gray intensity values of adjacent voxels from the gray intensity values of the central voxel. The difference between the gray intensity of the central voxel and the gray intensity of adjacent voxels on the horizontal axis is the horizontal axis gradient component, the difference between the gray intensity of the central voxel and the gray intensity of adjacent voxels on the vertical axis is the vertical axis gradient component, and the difference between the gray intensity of the central voxel and the gray intensity of adjacent voxels on the vertical axis is the vertical axis gradient component. After solving for the three gradient components, the horizontal axis gradient component, the vertical axis gradient component, and the vertical axis gradient component are squared sequentially to obtain three sets of unsigned gradient squared values. The three sets of gradient squared values are summed to obtain the total value of the gradient squared sum.
[0049] The arithmetic square root operation is performed on the total sum of squared gradients, and the result is the gradient amplitude of the current central voxel. The magnitude of the gradient amplitude directly corresponds to the intensity of gray-level abrupt changes at the voxel location. The gradient amplitude is smaller in uniform brain tissue regions and larger in anatomical and artifact edge regions. A fixed gradient threshold is preset, and the gradient threshold range is set from 15 to 35, which is combined with the gray-level fluctuation characteristics of normal brain tissue and the gray-level abrupt changes of SEEG electrode artifacts. This range can effectively filter out invalid gradient responses caused by small gray-level fluctuations within brain tissue, while completely preserving the gradient characteristics of real anatomical boundaries and artifact distortion boundaries. The threshold parameter remains fixed throughout the entire range and is not adjusted with changes in spatial location and voxel characteristics. For each voxel, the calculated gradient amplitude is compared with a preset gradient threshold. If the voxel gradient amplitude is significantly greater than the preset threshold, the voxel is identified as having a significant gray-level abrupt change, belonging to the edge of an anatomical structure or the edge of an artifact distortion, and is marked as a boundary voxel. If the voxel gradient amplitude is less than or equal to the preset threshold, the voxel is identified as having a uniform gray-level distribution, belonging to ordinary brain tissue voxels, and is not included in the boundary voxel range. After completing the gradient calculation and threshold determination for all voxels in the entire image, all marked boundary voxels are summarized and rearranged and integrated according to their original three-dimensional spatial distribution positions to completely restore the outer contour of brain anatomy, the gray-white matter boundary contour, and the SEEG electrode artifact distortion contour, generating an anatomical structure boundary feature map with continuous contours, accurate boundaries, and no redundant noise interference.
[0050] Step 203: Based on the anatomical structure boundary feature map, determine the boundary voxel with the largest coordinate value in the first direction as the first reference position, the boundary voxel with the largest coordinate value in the second direction as the second reference position, and the boundary voxel with the largest coordinate value in the third direction as the third reference position. Specifically, this includes: importing the anatomical structure boundary feature map generated in step 202, batch extracting the complete three-dimensional spatial coordinate data of all labeled boundary voxels in the feature map, and summarizing them to form a global boundary voxel coordinate dataset. The dataset contains the horizontal, vertical, and axial coordinate parameters of all anatomical edge and artifact edge voxels, with no data omissions or duplications. A global comparison is performed on the x-axis coordinates of all boundary voxels in the dataset. The x-axis coordinates of each boundary voxel are read one by one, and the values are compared sequentially. The unique boundary voxel with the largest x-axis coordinate is selected, and its corresponding 3D spatial point is fixed as the first reference position. Maintaining the same selection logic, a global comparison is performed on the y-axis coordinates of all boundary voxels in the dataset. All y-axis coordinates are sorted and compared sequentially, and the unique boundary voxel with the largest y-axis coordinate is selected. The corresponding 3D spatial point is fixed as the second reference position. Continuing with the same selection rules, a global comparison is performed on the vertical coordinates of all boundary voxels in the dataset. The unique boundary voxel with the largest vertical coordinate is selected, and its corresponding 3D spatial point is fixed as the third reference position.
[0051] Step 204: Connect the first reference position, second reference position, and third reference position sequentially with straight line segments to form a closed marked region, obtaining the vertex coordinate set of the closed marked region. Specifically, this includes: reading the precise three-dimensional spatial coordinates corresponding to the first, second, and third reference positions determined in step 203. Each of the three reference points is an independent spatial vertex. Following the fixed connection logic of a closed loop, sequentially complete the straight line connection operation of the three points; using the first reference position as the starting endpoint and the second reference position as the ending endpoint, complete the connection between two points using spatial straight line segments; then using the second reference position as the starting endpoint... Starting from the first reference position and ending at the third reference position, two points are connected by a spatial straight line segment; starting from the third reference position and ending at the first reference position, the two points are connected by a spatial straight line segment. These three spatial straight line segments are connected sequentially without breaks or intersections, forming a closed triangular planar region, which is the complete closed marking region. This closed marking region can completely cover all core artifact interference areas, such as the SEEG electrode trajectory area, the gray-white matter boundary artifact distortion area, and the local gray-scale distortion area, accurately locating the key area where image artifact distortion is most concentrated. The complete three-dimensional spatial coordinates corresponding to the three vertices constituting the closed triangular region are extracted and systematically integrated according to the fixed order of the first reference position, second reference position, and third reference position, generating a set of vertex coordinates of the closed marking region that is dimensionally complete, sequentially fixed, and precisely positioned.
[0052] Step 205: Based on the vertex coordinate set, calculate the first edge vector formed by the first and second reference positions, calculate the second edge vector formed by the second and third reference positions, calculate the cross product modulus of the first and second edge vectors, and multiply the cross product modulus by half to obtain the area value of the closed marked region. Specifically, this includes: retrieving the vertex coordinate set of the closed marked region obtained in step 204, uniformly using the physical spatial dimensions of magnetic resonance imaging for all quantization calculations to ensure accurate and reproducible results; setting the three-dimensional spatial coordinates of the first reference position as... The three-dimensional spatial coordinates of the second reference position are: The three-dimensional spatial coordinates of the third reference position are: In the formula, x, y, and z correspond to the physical spatial coordinates of the horizontal, vertical, and 3D image axes, respectively, and the subscript numbers correspond to different reference vertex indices. Spatial edge vectors are calculated using vertex coordinate difference operations. These edge vectors represent the orientation and distance information between two points in 3D space. The first edge vector is... point to The spatial vector is calculated using the formula: In the formula Represents the first side vector. This represents the difference in the horizontal axis coordinates. The difference in the vertical axis coordinates. The vertical axis coordinate difference; the second side vector is point to The spatial vector is calculated using the formula: In the formula Represents the second side vector. This represents the difference in the horizontal axis coordinates. The difference in the vertical axis coordinates. The difference in vertical axis coordinates; the first side vector obtained from the solution. With the second side vector Substituting the formula for the cross product of three-dimensional vectors, we can solve for the cross product vector V. The specific calculation formula is as follows: In the formula The cross product vector is a three-dimensional vector obtained by operating on two edge vectors. The three-axis components of the cross product vector are perpendicular to the x-axis. and The plane formed is used to characterize the spatial normal features and the equivalent magnitude of the plane area; after solving the cross product vector, the spatial magnitude of the cross product vector is calculated. The magnitude represents the equivalent area of the parallelogram formed by the two edge vectors. The formula for calculating the magnitude is: In the formula The magnitude of the cross product vector. These represent the x-axis, y-axis, and vertical-axis components of the cross product vector V, respectively. The overall operation is an arithmetic square root operation. Based on the principle of solving the area vector of a triangle in three-dimensional space, the area of a closed triangle region is half the area of the corresponding parallelogram. Therefore, the final formula for calculating the area of the closed marked region is S = In the formula, S is the physical area value of the artifact region obtained in the final solution.
[0053] In this embodiment, the outer boundary vertices are selected based on the extreme values of three-dimensional coordinates to construct a closed-loop marked region. Combined with vector operations, the area of the artifact region is accurately quantified, which can stably lock the core region where the magnetic susceptibility artifact interference is most obvious.
[0054] In a preferred embodiment of the present invention, step 3, dividing the closed-mark region into multiple sub-region grid units using the first reference position, the second reference position, the third reference position, and the geometric center of the closed-mark region as nodes to obtain a regional gridded structure, may include:
[0055] Step 301: Obtain the spatial coordinates of the first reference position, the second reference position, and the third reference position. Calculate the average of these three spatial coordinates to obtain the spatial coordinates of the geometric center. Specifically, this includes: retrieving the three-dimensional spatial coordinates of the first, second, and third reference positions. All three sets of coordinate data are taken from the extreme positions of the brain anatomical boundary and the SEEG artifact boundary, precisely corresponding to the three vertices of the triangular closed-mark region constructed in step 204. The physical spatial dimensions of the magnetic resonance imaging are consistently used throughout to ensure data consistency. Completely extract the horizontal, vertical, and axial coordinate values corresponding to the first, second, and third reference positions. Finally, add the horizontal coordinate values of the first, second, and third reference positions to obtain the total horizontal coordinate value of the three vertices. The vertical coordinates of the three vertices are summed by adding the values of the first, second, and third reference positions. The total vertical coordinates of the three vertices are then summed by adding the values of the first, second, and third reference positions. The total horizontal coordinates are then divided by a constant three to obtain the horizontal coordinate of the geometric center of the closed marked region. Similarly, the total vertical coordinates are divided by a constant three to obtain the vertical coordinate of the geometric center of the closed marked region. Finally, the obtained horizontal, vertical, and axial coordinates of the geometric center are combined to form the complete three-dimensional spatial coordinates of the geometric center.
[0056] Step 302: Based on the spatial coordinates of the geometric center and the spatial coordinates of the first, second, and third reference positions, connect the geometric center to the first reference position, the geometric center to the second reference position, and the geometric center to the third reference position to obtain a first sub-region enclosed by the first reference position, the second reference position, and the geometric center; a second sub-region enclosed by the second reference position, the third reference position, and the geometric center; and a third sub-region enclosed by the third reference position, the first reference position, and the geometric center. The first, second, and third sub-regions constitute a regional mesh structure. Specifically, this includes: obtaining the three-dimensional spatial coordinates of the geometric center and simultaneously matching... The spatial coordinates of the vertices at the first, second, and third reference positions are retrieved. The geometric center is used as the sole central dividing node, and the three boundary reference positions are used as peripheral vertex nodes to perform meshing of the closed marked region. A spatial straight-line connection operation is performed to connect the spatial points of the geometric center with the spatial points of the first reference position, the geometric center with the spatial points of the second reference position, and the geometric center with the spatial points of the third reference position. The three straight-line segments extending from the center outwards do not intersect or overlap, thus uniformly dividing the overall triangular closed marked region into three independent sub-regions. The first sub-region is formed by the first reference position, the second reference position, and the geometric center. The second sub-region is formed by the second reference position, the third reference position, and the geometric center. The third sub-region is formed by the third reference position, the first reference position, and the geometric center. Each of the three sub-regions is an independent triangular spatial structure, completely covering the entire range of the original closed marked area, without any gaps or overlaps. The first, second, and third sub-regions are integrated and incorporated to form a complete regional grid structure.
[0057] This embodiment achieves a refined quantitative assessment of the SEEG electrode magnetic susceptibility artifact distortion region through a complete and refined process, including solving for the geometric center of the artifact core region, precise segmentation of the region by meshing, quantification of the area of the sub-region, and solving for the discreteness and uniformity parameters.
[0058] In a preferred embodiment of the present invention, step 4, calculating the ratio of the area dispersion of all sub-region grid cells to the total area of the closed marked region based on the regional gridding structure, to obtain the regional uniformity adjustment parameter, may include:
[0059] Step 401: Obtain the vertex coordinates of the first, second, and third sub-regions in the regional mesh structure. Specifically, this includes: retrieving the complete regional mesh structure; according to the enclosing logic of each sub-region, performing a complete vertex coordinate extraction operation on each independent sub-region to ensure that the vertex coordinates of each sub-region are complete and the correspondence is accurate; for the first sub-region within the mesh structure, accurately extract the three sets of vertex coordinates that participate in enclosing the sub-region, namely the three-dimensional spatial coordinates of the first reference position, the three-dimensional spatial coordinates of the second reference position, and the three-dimensional spatial coordinates of the geometric center, and save them as the vertex coordinates of the first sub-region. For the second sub-region within the mesh structure, accurately extract the three sets of vertex coordinates that participate in enclosing the sub-region, namely the three-dimensional spatial coordinates of the second reference position, the three-dimensional spatial coordinates of the third reference position, and the three-dimensional spatial coordinates of the geometric center, and save them as the vertex coordinates of the second sub-region; for the third sub-region within the mesh structure, accurately extract the three sets of vertex coordinates that participate in enclosing the sub-region, namely the three-dimensional spatial coordinates of the third reference position, the three-dimensional spatial coordinates of the first reference position, and the three-dimensional spatial coordinates of the geometric center, and save them as the vertex coordinates of the third sub-region.
[0060] Step 402: Calculate the area of the first sub-region based on the vertex coordinates of the first sub-region, calculate the area of the second sub-region based on the vertex coordinates of the second sub-region, and calculate the area of the third sub-region based on the vertex coordinates of the third sub-region. Specifically, this includes: retrieving all vertex coordinates corresponding to the first, second, and third sub-regions extracted in step 401; uniformly employing standardized three-dimensional space triangle vector area calculation logic to complete the area calculation of the entire sub-region; ensuring complete uniformity in the dimensions, formulas, and steps of the entire calculation process, without any simplification or approximation; and setting the three sets of spatial vertex coordinates of any triangular sub-region as follows: , , Based on the spatial coordinates of three points, two sets of spatial edge vectors sharing a common starting point are constructed. The physical area of the triangle is accurately calculated through vector operations. For the first sub-region, the coordinates of its corresponding first reference position, second reference position, and geometric center are retrieved and assigned to vertex A, vertex B, and vertex C, respectively. The first edge vector is then constructed. The vector expression is Construct the second side vector The vector expression is Perform a three-dimensional vector cross product operation on two sets of edge vectors, and the cross product vector is... The complete expression is Solve for the spatial modulus of the cross product result vector. The formula for calculating the modulus is as follows: The modulus corresponds to the equivalent area of the parallelogram formed by the two sets of side vectors.
[0061] Based on the principle of three-dimensional triangle area calculation, the area of a triangle is half the area of its corresponding parallelogram. The formula for calculating the area of the first sub-region is: The precise physical area of the first sub-region is obtained by substituting the calculated data. For the second sub-region, the coordinates of its corresponding second reference position, third reference position, and geometric center are retrieved, and the coordinate parameters of vertices A, B, and C are updated sequentially. The complete formula process of vector construction, cross product operation, modulus calculation, and area conversion is completely replicated, and the area of the second sub-region is calculated by substituting the corresponding coordinate data. For the third sub-region, the coordinates of its corresponding third reference position, first reference position, and geometric center are retrieved, and the vertex coordinate parameters are updated synchronously. Using a unified three-dimensional vector operation formula and calculation steps, the area of the third sub-region is accurately calculated. .
[0062] Step 403: Calculate the average area values of the first, second, and third sub-regions to obtain the average area of each sub-region. Calculate the differences between the area values of the first, second, and third sub-regions and their respective average areas. Square each of these three differences and sum them. Multiply the sum by one-third to obtain the area dispersion. Specifically, this involves: retrieving the area values of the first, second, and third sub-regions; performing a total area accumulation operation on the sub-regions; adding the area values of the first, second, and third sub-regions to obtain the total area of the three sub-regions; dividing the total area by a constant three to obtain the average area of the three sub-regions. This average area represents the standard equilibrium area level of the sub-regions after gridding and can be used as a benchmark value for evaluating the area deviation of each sub-region. Perform area difference calculations on each sub-region sequentially, subtracting the average area of the first sub-region from its area value to obtain the area difference corresponding to the first sub-region.
[0063] Subtract the average area of the second sub-region from the area value of the second sub-region to obtain the area difference corresponding to the second sub-region; subtract the average area of the third sub-region from the area value of the third sub-region to obtain the area difference corresponding to the third sub-region; perform a squaring operation on each obtained area difference individually: squaring the first area difference to obtain the first squared result value, squaring the second area difference to obtain the second squared result value, and squaring the third area difference to obtain the third squared result value. The squaring operation completely eliminates the calculation interference caused by the positive and negative signs of the difference, retaining only the absolute degree information of the area deviation; add the first squared result value, the second squared result value, and the third squared result value to obtain the cumulative total value of the three sets of squared values; multiply the cumulative total value of the squares by one-third of a constant to finally obtain the area dispersion value of the artifact region.
[0064] Step 404: Obtain the area value of the closed marked region. Multiply the area dispersion by the reciprocal of the area value of the closed marked region to obtain the region uniformity adjustment parameter. Specifically, this includes: retrieving the overall physical area value of the closed marked region obtained from the complete calculation in step 205, and simultaneously retrieving the area dispersion value obtained from the final solution in step 403. Based on these two sets of precise quantitative indicators, complete the complete solution calculation of the region uniformity adjustment parameter. Perform a reciprocal operation on the overall area value of the closed marked region, dividing it by a constant to obtain the reciprocal value corresponding to the overall area. This reciprocal operation can normalize the dispersion index and eliminate parameter interference caused by differences in brain anatomical size and overall artifact coverage of different patients. Multiply the area dispersion value by the reciprocal value of the closed region area. The final result after multiplying the two sets of values is the region uniformity adjustment parameter.
[0065] In this embodiment, the precise solution of the quantization parameters in this part can provide an adaptive adjustment basis for the subsequent diffusion model completion algorithm. This allows the model to autonomously adjust the feature repair weights according to the degree of artifact distortion in different regions, and specifically correct the grayscale shift and texture distortion in artifact regions, effectively improving the restoration accuracy of the anatomical structure of the missing modality image.
[0066] In a preferred embodiment of the present invention, step 5, which involves weighting and normalizing the voxel intensity values located within the closed marked regions in the first modal magnetic resonance image and the registered second modal image according to the regional uniformity adjustment parameter to obtain a dual-channel conditional feature map, may include:
[0067] Step 501: Obtain the region homogeneity adjustment parameters, the first modal magnetic resonance image, the registered second modal image, and the vertex coordinate set of the closed marker region; based on the vertex coordinate set of the closed marker region, extract the voxel intensity values located within the closed marker region in the first modal magnetic resonance image to obtain the local voxel intensity set of the first mode, and extract the voxel intensity values located within the closed marker region in the registered second modal image to obtain the local voxel intensity set of the second mode. Specifically, this includes: acquiring the required basic parameters and image data through the aforementioned quantization calculation process. The specific content acquired includes the region homogeneity adjustment parameters finally solved in step 404, the preprocessed complete first modal magnetic resonance image, and the registered second modal image obtained in step 104. The set of vertex coordinates of the closed marked region obtained in step 204 is used as the boundary judgment benchmark. The complete spatial range of the core correction area for artifact distortion is defined. The unified physical spatial coordinate system of the magnetic resonance image is used to ensure that the spatial range of the region judgment is completely consistent with the spatial range of the aforementioned grid segmentation and area calculation. All effective voxels inside the first modality magnetic resonance image are traversed, and the spatial position relationship between the three-dimensional spatial coordinates of each voxel and the boundary coordinates of the closed marked region is compared one by one. All effective voxels whose spatial positions are completely inside the closed marked region are selected, and the original intensity values of the corresponding voxels are collected one by one. All the selected voxel intensity values are integrated and stored in an orderly manner to form the local voxel intensity set of the first modality. Using completely consistent spatial judgment rules and data extraction methods, all effective voxels inside the registered second modality image are traversed, and all effective voxels whose spatial positions are completely inside the closed marked region are selected. The original intensity values of the corresponding voxels are collected one by one, and the unified integration and storage are used to form the local voxel intensity set of the second modality.
[0068] Step 502: Perform a circular expansion operation on the first modal local voxel intensity set, covering each voxel with a circular structuring element of a preset radius, and replacing the intensity value of each voxel with the maximum value of the voxel intensity value within the coverage area to obtain the expanded first modal local voxel intensity set; perform a circular erosion operation on the second modal local voxel intensity set, covering each voxel with a circular structuring element of a preset radius, and replacing the intensity value of each voxel with the minimum value of the voxel intensity value within the coverage area to obtain the eroded second modal local voxel intensity set. Specifically, this includes: performing a circular expansion preprocessing operation on the first modal local voxel intensity set, pre-setting a fixed value for the radius of the circular structuring element, which is determined based on the standard voxel size of the magnetic resonance image and the edge diffusion range of the SEEG artifact, and keeping the value constant throughout the process. Lock all voxels belonging to the local voxel intensity set of the first mode within the closed marked area, and treat each voxel as the center voxel in turn; delineate a circular neighborhood area with the three-dimensional spatial coordinates of the current center voxel as the center and a preset radius as the coverage area, completely encompassing all spatially valid neighboring voxels within the circular area, and accurately locking the original intensity values corresponding to all neighboring voxels. The intensity values of all valid voxels within the circular neighborhood are read one by one. A global intensity value comparison is performed, and the voxel with the largest intensity value within the neighborhood is selected. This largest intensity value is used as the updated intensity value of the current central voxel, completing the dilation update process for a single voxel. All voxels within the first modality local voxel intensity set are traversed, and the standardized processing flow of center location, circular neighborhood delineation, global intensity comparison, and maximum value replacement is repeatedly executed. After all voxels are processed, the dilated first modality local voxel intensity set is obtained. This dilation process can fill the small gray-level holes in the artifact area of the first modality image, smooth out scattered dark noise interference, continue the gray-level continuity of the anatomical structure edges, and stably preserve the feature information of the real anatomical contour of the brain. A circular erosion preprocessing operation is performed on the second modality local voxel intensity set. A circular structural element is constructed using a preset radius that is completely consistent with the circular dilation operation to ensure that the neighborhood coverage range of the two morphological operations is consistent with the standard.
[0069] Each voxel belonging to the second-mode local voxel intensity set within the closed marked region is sequentially taken as the central processing voxel. A circular neighborhood is delineated with the spatial coordinates of the central voxel as the center and a preset radius as the boundary. The original intensity values of all valid voxels within the neighborhood are completely collected. The intensity values of all collected neighborhood voxels are compared, and the voxel intensity value with the smallest value within the neighborhood is selected. This minimum intensity value is used to replace the original intensity value of the current central voxel, completing the erosion update process for a single voxel. This process is repeated iteratively through all voxels in the second-mode local voxel intensity set, performing the complete operation of circular neighborhood delineation, global intensity selection, and minimum value replacement. After all processing is completed, the eroded second-mode local voxel intensity set is obtained.
[0070] Step 503: Multiply the intensity value of each voxel in the dilated first-mode local voxel intensity set with the region uniformity adjustment parameter to obtain the adjusted first-mode local voxel intensity set; multiply the intensity value of each voxel in the eroded second-mode local voxel intensity set with the region uniformity adjustment parameter to obtain the adjusted second-mode local voxel intensity set. Specifically, this includes: retrieving the dilated first-mode local voxel intensity set and the eroded second-mode local voxel intensity set preprocessed in step 502, and simultaneously retrieving the region uniformity adjustment parameter obtained in step 404. Using this fixed parameter as the globally unified weighted correction coefficient for the artifact distortion region, perform precise weighted correction calculations for the local voxel intensities of all local voxels in both modes; for the dilated first-mode local voxel intensity set, traverse each voxel in the set... For each independent voxel, the original intensity value after preprocessing is extracted. This voxel intensity value is then multiplied with the region uniformity adjustment parameter. The result of the multiplication is used as the new corrected intensity value for the current voxel. This process is repeated for all voxels in the set, and after all voxel operations are completed, the results are integrated to generate the adjusted first-mode local voxel intensity set. For the eroded second-mode local voxel intensity set, the same voxel-by-voxel weighted calculation logic is used. All valid voxels in the set are traversed, and the preprocessed intensity value of each voxel is extracted one by one. The intensity value corresponding to each voxel is then multiplied with the same region uniformity adjustment parameter, replacing the original preprocessed intensity value of each voxel. This process is repeated for all voxels, and the final adjusted second-mode local voxel intensity set is obtained.
[0071] Step 504: Normalize the intensity of the adjusted first modality local voxel intensity set to a preset standard interval to obtain a normalized first modality local voxel intensity set; normalize the intensity of the adjusted second modality local voxel intensity set to a preset standard interval to obtain a normalized second modality local voxel intensity set. Specifically, this includes: setting a fixed standard intensity interval as a unified mapping range for the dual-modality image features; combining the gray-scale distribution characteristics of normal brain tissue in clinical brain magnetic resonance imaging, fixing the lower limit of the standard intensity interval to 0 and the upper limit of the standard intensity interval to a fixed value. The value is 255, which is perfectly compatible with the gray quantification range of conventional magnetic resonance imaging. It can cover all effective gray values of normal brain tissue and artifact regions, completely eliminate the overall intensity shift problem caused by weighted calculation, and unify the data distribution scale of dual-modal features. The adjusted local voxel intensity set of the first modality obtained in step 503 is retrieved, and the intensity values of all voxels in the set are traversed in the whole domain after weighted adjustment. The magnitude of all intensity values is compared one by one, and the maximum and minimum intensity values in the current set are selected to determine the complete intensity extreme value range of the local region of the first modality artifact.
[0072] After determining the extreme value range, a linear normalization mapping operation is performed point-by-point on the weighted intensity value of each voxel within the first mode set. The specific calculation process is as follows: the weighted intensity value of the current single voxel is subtracted from the minimum intensity value of the entire set to obtain the relative intensity difference of the voxel. Then, this relative intensity difference is divided by the difference between the maximum intensity value and the minimum intensity value of the set to obtain the dimensionless normalization scaling factor. Finally, this normalization scaling factor is multiplied by the difference between the upper limit value and the lower limit value of the standard intensity interval, which is the difference between 255 and 0. The result is the new normalized intensity value of the current voxel mapped to the standard interval. The entire process of difference calculation, ratio calculation, and interval mapping calculation is repeated for each voxel. After all voxel operations are completed, all updated intensity values are integrated to obtain the normalized local voxel intensity set of the first mode. Using a completely consistent standard intensity interval and linear normalization mapping calculation rule, global normalization processing is performed on the adjusted local voxel intensity set of the second mode obtained in step 503. The weighted intensity values of all voxels in the second mode are traversed globally, and the maximum and minimum intensity values of the local region of the second mode are selected. The relative intensity difference calculation, normalization ratio coefficient calculation, and standard interval mapping calculation are performed for each voxel in sequence. The intensity scale correction of all voxels is uniformly completed, and finally the normalized local voxel intensity set of the second mode is obtained.
[0073] Step 505 involves concatenating the normalized first-modality local voxel intensity set and the normalized second-modality local voxel intensity set to obtain a dual-channel conditional feature map. Specifically, this includes: retrieving the normalized first-modality local voxel intensity set and the normalized second-modality local voxel intensity set processed in step 504. Both sets of intensity sets have completely corresponding three-dimensional spatial arrangement structures, consistent voxel counts, and uniform intensity numerical scales. Following the inherent topological arrangement of layers, rows, and columns in the three-dimensional space of the image, the dual-modality feature map is completed in a one-to-one correspondence manner between voxel spatial positions. The channel dimensions are stitched together; the normalized local voxel intensity values of the first modality are used as the first channel features of the feature map, fully preserving the fine anatomical structure features of the first modality image; the normalized local voxel intensity values of the second modality are used as the second channel features of the feature map, fully preserving the tissue grayscale texture features of the second modality image; the corresponding integration of the dual-channel features is completed at each spatial position, with no spatial misalignment, no feature overlap, and no data omission, and the two sets of single-channel local feature sets are fused into a complete dual-channel feature matrix, finally generating a dual-channel conditional feature map that adapts to the input of the diffusion model.
[0074] This embodiment, by precisely extracting the dual-modal local voxel features of closed artifact regions, can focus on the core areas of artifact distortion for targeted correction, avoiding the destruction of normal brain tissue features caused by uniform processing of the entire image, and accurately locating the distorted areas that need repair. Through differentiated morphological operations—applying dilation to the first modality image and erosion to the second modality image—it can filter out inherent noise and artifact interference from different modalities, enhancing the continuity of anatomical structure edges.
[0075] In a preferred embodiment of the present invention, step 6, generating a random noise image based on the dual-channel conditional feature map to obtain an initial state image, repeatedly concatenating the initial state image with the dual-channel conditional feature map and inputting iterative denoising into a pre-trained conditional diffusion model, and outputting the completed MR image missing modality after reaching a preset number of reverse diffusion steps, may include:
[0076] Step 601: Obtain the dual-channel conditional feature map. Based on the spatial dimension of the dual-channel conditional feature map, generate a random noise image of the same size with voxel values independently sampled from a standard Gaussian distribution to obtain the initial state image. Specifically, before performing the image iterative generation step, this invention completes the full construction and convergence training of a dedicated conditional diffusion generation model. The model as a whole includes five core steps: network structure construction, training dataset construction, forward diffusion noise addition process, backward denoising training process, and model parameter convergence and saving, providing a reliable inference foundation for subsequent missing modality image generation. This invention uses a lightweight improved U-shaped diffusion network as the core generation network. The network consists of an encoding structure, a decoding structure, a multi-layer skip connection structure, and a conditional embedding structure. The encoding structure employs a four-level downsampling structure to progressively compress the image spatial size and extract shallow texture features, artifact distortion features, and deep anatomical semantic features. The decoding structure employs a corresponding four-level upsampling structure to progressively restore the original spatial resolution of the image and recover fine image details. The skip connection structure connects encoding and decoding features at the same level, compensating for detail loss during downsampling. The conditional embedding structure receives dual-channel conditional feature maps and embeds artifact correction features and anatomical prior features into each layer of the network, achieving full-process conditional constraint generation. During model training, a paired dataset of multimodal MRI images after SEEG surgery is constructed. This dataset contains a large number of patient T1 complete modal images, distorted and incomplete T2-FLAIR images, and corresponding real, distortion-free T2-FLAIR standard images, forming complete training sample pairs. During forward diffusion, Gaussian noise is progressively superimposed on the real standard images, and noisy images of different noise levels are obtained through a fixed-step progressive noise addition method.
[0077] During reverse training, the network uses the dual-channel conditional feature map as a prior constraint, inputs a noisy image, and predicts residual noise within the image. By calculating the error loss between the predicted noise and the actual superimposed noise, the network weights and bias parameters are updated layer by layer using the backpropagation algorithm, continuously reducing the prediction error. After multiple rounds of global iterative training, the model loss function tends to stabilize and converge, and the optimal weight parameters are retained to complete the model training deployment. Based on this, this step relies on the converged conditional diffusion model and the fixed dual-channel conditional feature map. Through a closed-loop reverse iterative process of multiple rounds of tensor concatenation, conditional constraint inference, noise prediction, and voxel-by-voxel denoising update, invalid noise in the initial image is gradually eliminated, and the real brain anatomical structure and texture information are restored layer by layer. Finally, a complete T2-FLAIR modality image with intact structure, artifact elimination, and normal grayscale is generated.
[0078] The dual-channel conditional feature map output in step 505 is the only prior constraint in this iterative generation process. Its tensor dimension is [2, D, H, W], where 2 is the number of feature channels, D is the number of image slice layers, H is the number of pixels in height per slice, and W is the number of pixels in width per slice. The four-dimensional tensor dimension parameters of this feature map are precisely read, and the spatial dimensions of D, H, and W are locked to ensure that the initial noise tensor and the conditional feature tensor are completely aligned in terms of spatial dimension, voxel grid arrangement, and three-dimensional topology, without any size deviation or coordinate misalignment. This step completes three-dimensional voxel global sampling based on the standard normal Gaussian distribution N(0,1), limiting the sampling mean. =0, variance =1, the sampling probability density function for all voxels in the entire domain is unified as follows: Based on the above formula, the entire three-dimensional voxel mesh of size [D, H, W] is traversed. For each independent voxel corresponding to spatial coordinates (d, h, w), indiscriminate and independent random sampling is performed. All voxel sampling processes are conducted without human intervention, local numerical shifts, or regional weighted corrections, ensuring that the noise distribution is uniform, disordered, and featureless throughout the entire domain. After all voxel sampling is completed, all sampled values are integrated according to the inherent arrangement rules of the three-dimensional spatial layers, rows, and columns of magnetic resonance images to generate a single-channel three-dimensional Gaussian random noise image of dimension [1, D, H, W], which serves as the initial state image for the reverse diffusion iteration. .
[0079] Step 602: Concatenate the initial state image with the dual-channel conditional feature map to obtain the first composite input tensor; perform conditional diffusion model inference on the first composite input tensor to obtain the first noise prediction map, specifically including: fixing the initial state image generated in step 601. The [1, D, H, W] and the dual-channel conditional feature tensor C[2, D, H, W] output in step 505 are used to unify the data precision of the two sets of tensors to 32-bit floating-point type, ensuring one-to-one accurate mapping of voxel space coordinates and achieving concatenation of channel dimensions and complete matching of spatial dimensions. This invention uses a channel dimension concatenation and fusion algorithm to perform tensor concatenation operations. The concatenation rule is to merge the single-channel noise tensor and the dual-channel conditional tensor in the input channel dimension to generate a first composite input tensor with dimension [3, D, H, W]. The splicing formula is: In the formula, dim=0 represents channel dimension splicing, while the spatial dimensions D, H, and W remain unchanged throughout. This connection method enables precise binding of the random noise value at each voxel position with the corresponding anatomical features and artifact correction features, allowing the model inference to rely entirely on real prior constraints for noise identification. The composite tensor... The input is fed into a conditional diffusion U-shaped network that has converged during training. The model performs the first round of multi-scale feature extraction and noise prediction inference: the encoding layer compresses the spatial dimension step by step through four levels of downsampling, extracting high-frequency noise features of the tensor, SEEG artifact distortion features, brain gray and white matter anatomical features, and gray-level distribution features layer by layer; the decoding layer restores the original spatial resolution through corresponding four levels of upsampling, and at the same time maps the shallow edge and texture detail features of the encoding layer to the decoding layer through skip connections to compensate for the loss of details caused by downsampling. Based on the global feature fitting results, the network calculates the residual noise intensity of each voxel, and finally outputs the first noise prediction map with the same size and precision as the initial state tensor. [1,D, H, W].
[0080] Step 603: Denoise the initial state image based on the first noise prediction map to obtain the first denoised state image; concatenate the first denoised state image with the dual-channel conditional feature map to obtain the second composite input tensor. Specifically, this includes: retrieving the first noise prediction map and the initial state image output in step 602, and completing the first round of image state iteration update according to the inverse denoising update rules preset by the conditional diffusion model. The entire 3D image grid is traversed pixel by pixel. Using standard denoising logic, invalid noise values predicted by the model at corresponding locations are removed using the voxel grayscale values of the initial state image. The identified random noise components within the image are eliminated through precise point-by-point calculations. After all voxels in the entire region have completed the update calculation, the image data is integrated and reconstructed to obtain the first denoised state image. After the first round of denoising, most of the high-intensity global random noise within the image is effectively removed, the basic anatomical contours of the brain and the grayscale base of brain tissue are initially revealed, and the surface distortion noise of the SEEG artifact region is initially corrected. The overall spatial structure and voxel topological relationship of the image remain intact and distortion-free. After the first round of denoising update, the fixed dual-channel conditional feature map is reused, and the aforementioned channel splicing and fusion method is strictly followed. The first denoised state image and the dual-channel conditional feature map are again connected and fused along the channel dimension to generate a second composite input tensor adapted to the second round of model inference.
[0081] Step 604: Perform conditional diffusion model inference on the second composite input tensor to obtain the second noise prediction map; denoise the first denoised state image based on the second noise prediction map to obtain the second denoised state image. Specifically, this includes: inputting the second composite input tensor into the converged conditional diffusion model to start the second round of refined conditional inference and noise prediction; the first iteration mainly completes the removal of large-scale, high-intensity low-frequency noise, but high-frequency fine noise, local non-uniform noise, and weak texture deviations at the edges of artifacts still remain inside the image. During this round of inference, the model continuously relies on the patient-specific anatomical prior information and artifact adaptive correction information carried by the dual-channel conditional feature map to compare and analyze the gray-level distribution pattern of the current denoised image with the standard brain tissue structure features, accurately identifying the weak residual noise and local texture distortion errors that were not completely removed in the first iteration; through multi-scale feature extraction and deep semantic fitting, the model completes the quantitative calculation of global voxel residual noise, outputting a second noise prediction map with the same size as the first denoised state image, accurately representing the subtle noise distribution features in the current image state; according to a unified inverse denoising update rule, the image gray-level values are updated pixel by pixel, all subtle residual noise components are removed, and the second denoised state image is generated.
[0082] Step 605: The second denoised state image is concatenated with the dual-channel conditional feature map to obtain a third composite input tensor. Conditional diffusion model inference is performed on the third composite input tensor to obtain a third noise prediction map. The second denoised state image is then denoised based on the third noise prediction map to obtain a third denoised state image. This process of concatenation, model inference, and denoising is continuously iterated until the number of iterations reaches the preset number of back diffusion steps. The state image obtained from the last denoising step is used as the missing modality of the completed MR image. Specifically, this invention presets a fixed total number of back diffusion iteration steps to adapt to the task of repairing artifacts and completing missing modalities in MRI images after SEEG. The model inference weights, iteration update rules, and feature constraints are fixed and unified throughout the process, without any stage parameter adjustments or adaptive changes, ensuring that the iterative generation process is stable, controllable, and the results are reproducible. Continuing the aforementioned standardized operation logic, a closed-loop iterative generation mechanism is constructed. Each iteration sequentially executes three core steps: composite data stitching, model conditional inference prediction, and voxel denoising update. With each iteration, subtle residual noise within the current image is gradually eliminated, anatomical details are continuously refined, and artifact correction effects are continuously deepened. The dual-channel conditional feature map maintains a constant output throughout, providing precise anatomical constraints and artifact correction constraints for each round of model inference, effectively avoiding issues such as anatomical shifts, texture distortions, artifact recurrence, and abnormal grayscale drift during iteration. As the number of iterations accumulates, disordered noise features completely disappear, multi-level fine anatomical details of the brain continuously converge and take shape, grayscale deviations and texture distortions in artifact distortion areas are thoroughly corrected, and the tissue grayscale features, texture features, and anatomical features corresponding to the missing T2-FLAIR modality are gradually and completely restored. When the cumulative number of iterations reaches a preset fixed total number of steps, all iterative loop operations are immediately terminated, and no new feature stitching, noise prediction, or image update operations are performed. The image finally updated after the iteration termination is determined as the final completed MR missing modality image.
[0083] In this embodiment, the final generated missing modal images have no obvious artifact residue, the gray and white matter are clearly and naturally distinguished, and the gray distribution of brain tissue is uniform and continuous. It can accurately match the individual anatomical characteristics of patients and effectively make up for the problem of missing modal scans caused by clinical SAR energy constraints.
[0084] like Figure 2 As shown, embodiments of the present invention also provide a diffusion-based MR image missing modality completion system, including:
[0085] The acquisition module is used to acquire first-mode magnetic resonance images and second-mode magnetic resonance images, and to perform rigid body registration and resampling on the second-mode magnetic resonance images to obtain the registered second-mode image.
[0086] The selection module is used to determine the first reference position, the second reference position, and the third reference position in the first modal magnetic resonance image, and connect the three reference positions to form a closed marked region;
[0087] The segmentation module is used to divide the closed marked region into multiple sub-region grid cells with the first reference position, the second reference position, the third reference position and the geometric center of the closed marked region as nodes, so as to obtain a regional gridded structure;
[0088] The calculation module is used to calculate the ratio of the area dispersion of all sub-region grid cells to the total area of the closed marked region based on the regional grid structure, and obtain the regional uniformity adjustment parameters.
[0089] The adjustment module is used to adjust parameters according to regional uniformity, and to perform weighted adjustment and normalization stitching on the voxel intensity values located in the closed marked area in the first modal magnetic resonance image and the registered second modal image to obtain a dual-channel conditional feature map.
[0090] The output module is used to generate a random noise image based on the dual-channel conditional feature map to obtain the initial state image. The initial state image is repeatedly concatenated with the dual-channel conditional feature map and input into the pre-trained conditional diffusion model for iterative denoising. After reaching the preset number of reverse diffusion steps, the missing modal of the completed MR image is output.
[0091] It should be noted that this system is a system corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.
[0092] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0093] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0094] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for completing missing modalities in MR images based on a diffusion model, characterized in that, The method includes: Step 1: Acquire the first modal magnetic resonance image and the second modal magnetic resonance image; perform rigid body registration and resampling on the second modal magnetic resonance image to obtain the registered second modal image. Step 2: In the first modal magnetic resonance image, determine the first reference position, the second reference position, and the third reference position, and connect the three reference positions to form a closed marked region; Step 3: Using the first reference position, the second reference position, the third reference position, and the geometric center of the closed marked region as nodes, divide the closed marked region into multiple sub-region grid units to obtain the region gridded structure; Step 4: Based on the regional gridding structure, calculate the ratio of the area dispersion of all sub-region grid cells to the total area of the closed marked region to obtain the regional uniformity adjustment parameter; Step 5: Based on the region homogeneity adjustment parameters, the voxel intensity values located within the closed-mark regions in the first-mode magnetic resonance image and the registered second-mode image are weighted, adjusted, normalized, and stitched together to obtain a dual-channel conditional feature map. Specifically, this includes: acquiring the region homogeneity adjustment parameters, the first-mode magnetic resonance image, the registered second-mode image, and the vertex coordinate set of the closed-mark regions; extracting the voxel intensity values within the closed-mark regions in the first-mode magnetic resonance image to obtain the first-mode local voxel intensity set based on the vertex coordinate set of the closed-mark regions, and extracting the voxel intensity values within the closed-mark regions in the registered second-mode image to obtain the second-mode local voxel intensity set; performing a circular expansion operation on the first-mode local voxel intensity set, covering each voxel with a circular structuring element of a preset radius, and replacing the intensity value of each voxel with the maximum voxel intensity value within the coverage area to obtain the expanded first-mode local voxel intensity set; performing a circular erosion operation on the second-mode local voxel intensity set, covering each voxel with a circular structuring element of a preset radius... A circular structural element covers each voxel, and the intensity value of each voxel is replaced with the minimum voxel intensity value within the coverage area, resulting in the eroded second-mode local voxel intensity set. The intensity value of each voxel in the dilated first-mode local voxel intensity set is multiplied by the region uniformity adjustment parameter to obtain the adjusted first-mode local voxel intensity set. The intensity value of each voxel in the eroded second-mode local voxel intensity set is multiplied by the region uniformity adjustment parameter to obtain the adjusted second-mode local voxel intensity set. The adjusted first-mode local voxel intensity set is normalized and mapped to a preset standard interval to obtain the normalized first-mode local voxel intensity set. The adjusted second-mode local voxel intensity set is normalized and mapped to a preset standard interval to obtain the normalized second-mode local voxel intensity set. The normalized first-mode local voxel intensity set and the normalized second-mode local voxel intensity set are concatenated to obtain a dual-channel conditional feature map. Step 6: Generate an initial state image by generating a random noise image based on the dual-channel conditional feature map. Repeatedly concatenate the initial state image with the dual-channel conditional feature map and input it into the pre-trained conditional diffusion model for iterative denoising. After reaching the preset number of reverse diffusion steps, output the missing modal of the completed MR image.
2. The method for completing missing modalities in MR images based on a diffusion model according to claim 1, characterized in that, Acquire first-mode and second-mode magnetic resonance images, perform rigid body registration and resampling on the second-mode magnetic resonance image to obtain the registered second-mode image, including: Acquire first-mode magnetic resonance images and second-mode magnetic resonance images, and extract the voxel space coordinate set of the first-mode magnetic resonance images and the voxel space coordinate set of the second-mode magnetic resonance images; Based on the voxel space coordinate set of the first mode magnetic resonance image and the voxel space coordinate set of the second mode magnetic resonance image, the normalized mutual information value is calculated, and the rigid body space transformation parameters are calculated with the goal of maximizing the normalized mutual information value. Based on the rigid body space transformation parameters, coordinate mapping is performed on the voxel space coordinate set of the second mode magnetic resonance image to obtain the coordinate-mapped second mode magnetic resonance image. The voxel intensity values of the second modal magnetic resonance image after coordinate mapping are resampled by trilinear interpolation to obtain the registered second modal image.
3. The method for completing missing modalities in MR images based on a diffusion model according to claim 2, characterized in that, In the first modal magnetic resonance image, a first reference position, a second reference position, and a third reference position are determined, and the three reference positions are connected to form a closed marked region, including: Acquire the first modal magnetic resonance image, extract the three-dimensional spatial coordinates and voxel intensity values of each voxel in the first modal magnetic resonance image, and obtain the voxel intensity distribution data of the first modal; Based on the voxel intensity distribution data of the first mode, three gradient components are obtained for each voxel: the intensity difference between adjacent voxels in the first direction, the intensity difference between adjacent voxels in the second direction, and the intensity difference between adjacent voxels in the third direction. The sum of squares of the three gradient components is calculated and the arithmetic square root is calculated to obtain the gradient magnitude. Voxels with gradient magnitudes greater than a preset gradient threshold are marked as boundary voxels. All boundary voxels constitute the anatomical structure boundary feature map. Based on the anatomical structure boundary feature map, the boundary voxel with the largest coordinate value in the first direction is determined as the first reference position, the boundary voxel with the largest coordinate value in the second direction is determined as the second reference position, and the boundary voxel with the largest coordinate value in the third direction is determined as the third reference position. Connect the first reference position, the second reference position, and the third reference position sequentially with straight line segments to form a closed marked region, thus obtaining the set of vertex coordinates of the closed marked region; Based on the vertex coordinate set, calculate the first side vector formed by the first reference position and the second reference position, calculate the second side vector formed by the second reference position and the third reference position, calculate the cross product modulus of the first side vector and the second side vector, and multiply the cross product modulus by half to obtain the area value of the closed marked region.
4. The method for completing missing modalities in MR images based on a diffusion model according to claim 3, characterized in that, Using the first reference position, the second reference position, the third reference position, and the geometric center of the closed marked region as nodes, the closed marked region is divided into multiple sub-region grid cells, resulting in a region mesh structure, including: Obtain the spatial coordinates of the first reference position, the second reference position, and the third reference position; calculate the average of the three spatial coordinates to obtain the spatial coordinates of the geometric center. Based on the spatial coordinates of the geometric center and the spatial coordinates of the first, second, and third reference positions, the geometric center is connected to the first reference position, the second reference position, and the third reference position. This results in a first sub-region enclosed by the first reference position, the second reference position, and the geometric center; a second sub-region enclosed by the second reference position, the third reference position, and the geometric center; and a third sub-region enclosed by the third reference position, the first reference position, and the geometric center. The first, second, and third sub-regions together form a regional grid structure.
5. The method for completing missing modalities in MR images based on a diffusion model according to claim 4, characterized in that, Based on the regional gridding structure, the ratio of the area dispersion of all sub-region grid cells to the total area of the closed marked region is calculated to obtain the regional uniformity adjustment parameters, including: Obtain the vertex coordinates of the first, second, and third sub-regions in the region mesh structure; Calculate the area value of the first sub-region based on the vertex coordinates of the first sub-region, calculate the area value of the second sub-region based on the vertex coordinates of the second sub-region, and calculate the area value of the third sub-region based on the vertex coordinates of the third sub-region. Calculate the average area values of the first, second, and third sub-regions to obtain the average area of the sub-regions; calculate the difference between the area value of the first sub-region and the average area of the sub-regions, the difference between the area value of the second sub-region and the average area of the sub-regions, and the difference between the area value of the third sub-region and the average area of the sub-regions, square the three differences respectively, sum them up, and multiply the sum by one-third to obtain the area dispersion. Obtain the area value of the closed marked region, and multiply the area dispersion by the reciprocal of the area value of the closed marked region to obtain the region uniformity adjustment parameter.
6. The method for completing missing modalities in MR images based on a diffusion model according to claim 5, characterized in that, An initial state image is obtained by generating a random noise image based on the dual-channel conditional feature map. The initial state image and the dual-channel conditional feature map are repeatedly concatenated and input into a pre-trained conditional diffusion model for iterative denoising. After reaching a preset number of back-diffusion steps, the missing modalities of the completed MR image are output, including: Obtain the dual-channel conditional feature map, and generate a random noise image of the same size with voxel values independently sampled from a standard Gaussian distribution based on the spatial dimension of the dual-channel conditional feature map to obtain the initial state image; The initial state image is concatenated with the dual-channel conditional feature map to obtain the first composite input tensor; the first composite input tensor is subjected to conditional diffusion model inference to obtain the first noise prediction map; The initial state image is denoised according to the first noise prediction map to obtain the first denoised state image; the first denoised state image is concatenated with the dual-channel conditional feature map to obtain the second composite input tensor. A conditional diffusion model inference is performed on the second composite input tensor to obtain a second noise prediction map; the first denoised state image is then denoised based on the second noise prediction map to obtain a second denoised state image. The second denoised state image is concatenated with the dual-channel conditional feature map to obtain the third composite input tensor. The third composite input tensor is then subjected to conditional diffusion model inference to obtain the third noise prediction map. The second denoised state image is then denoised based on the third noise prediction map to obtain the third denoised state image. This process of concatenation, model inference, and denoising is repeated until the number of iterations reaches the preset number of reverse diffusion steps. The state image obtained from the last denoising is then used as the missing modality of the completed MR image.
7. A diffusion-based MR image missing modality completion system, wherein the system implements the method as described in any one of claims 1 to 6, characterized in that, include: The acquisition module is used to acquire first-mode magnetic resonance images and second-mode magnetic resonance images, and to perform rigid body registration and resampling on the second-mode magnetic resonance images to obtain the registered second-mode image. The selection module is used to determine the first reference position, the second reference position, and the third reference position in the first modal magnetic resonance image, and connect the three reference positions to form a closed marked region; The segmentation module is used to divide the closed marked region into multiple sub-region grid cells with the first reference position, the second reference position, the third reference position and the geometric center of the closed marked region as nodes, so as to obtain a regional gridded structure; The calculation module is used to calculate the ratio of the area dispersion of all sub-region grid cells to the total area of the closed marked region based on the regional grid structure, and obtain the regional uniformity adjustment parameters. The adjustment module is used to adjust parameters according to regional uniformity, and to perform weighted adjustment and normalization stitching on the voxel intensity values located in the closed marked area in the first modal magnetic resonance image and the registered second modal image to obtain a dual-channel conditional feature map. The output module is used to generate a random noise image based on the dual-channel conditional feature map to obtain the initial state image. The initial state image is repeatedly concatenated with the dual-channel conditional feature map and input into the pre-trained conditional diffusion model for iterative denoising. After reaching the preset number of reverse diffusion steps, the missing modal of the completed MR image is output.
8. A computing device, characterized in that, include: One or more processors; A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed by a processor, implements the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Intelligent focus detection method based on multi-modal medical image fusion
CN122335845A
Image-text report generation method based on regional guidance and cross-modal fusion
CN122435623A
