Head model generation method and device, equipment, storage medium and program product

By segmenting and topological repairing tissue data from MRI and MEG helmets, a head model with high anatomical accuracy is generated, which solves the problems of incomplete accuracy and topology in head model construction in existing technologies. This achieves efficient and robust head model generation and registration, which is suitable for clinical and research applications.

CN121661294AActive Publication Date: 2026-03-13GUOCI CLOUD DIGITAL (DEQING) TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-03
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing technologies for constructing head models in magnetoencephalography (MEG) and high-density electroencephalography (EEG) suffer from problems such as low anatomical accuracy, incomplete topological segmentation results, and insufficient registration accuracy, leading to distorted or non-convergent calculation results and making it difficult to apply effectively in diverse clinical and research environments.

Method used

By receiving MRI scan data and MEG helmet models, tissue segmentation and topology repair are performed to generate a head model with high anatomical accuracy. The 3D U-Net model is used for tissue segmentation, and accurate masks are generated by combining morphological operations and Boolean operations. Registration and fusion are performed through spatial transformation matrices to ensure the topological integrity and robustness of the model.

Benefits of technology

It achieves efficient and automated head model generation, improves segmentation accuracy and registration success rate, and ensures the geometric accuracy and reliability of the model, making it suitable for physical simulation and clinical diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121661294A_ABST
    Figure CN121661294A_ABST
Patent Text Reader

Abstract

The invention discloses a method, device and equipment for generating a head model, a storage medium and a program product. The method is characterized by comprising the following steps of: receiving and verifying original three-dimensional T1 weighted image data and an original three-dimensional grid model; performing tissue segmentation based on the verified three-dimensional T1 weighted image data and the original three-dimensional T1 weighted image data to obtain a cerebral grey matter mask, a cerebral white matter mask, a scalp mask and a skull mask; performing topological structure repair on the brain grey matter mask and the brain white matter mask to obtain a brain mask; respectively converting the scalp mask, the skull mask and the brain mask into a scalp mesh model, a skull mesh model and a brain mesh model; calculating and applying a spatial transformation matrix from the verified three-dimensional grid model to the scalp grid model, and performing spatial registration and fusion on the scalp grid model, the skull grid model and the brain grid model to obtain a head model; the method has the advantages that the efficiency, precision and robustness of head model generation are effectively improved, and the method has good cross-platform deployment capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical auxiliary diagnosis and neuroimaging analysis technology, and in particular to a method, apparatus, device, storage medium and program product for generating head models. Background Technology

[0002] In neuroimaging techniques such as magnetoencephalography (MEG) or electroencephalography (EEG), high-precision localization of brain functional sources relies on accurately mapping sensor-level functional information onto an individualized, anatomically precise 3D head model. This model typically includes key tissue structures such as the scalp, skull, gray matter, and white matter. Constructing and aligning such a head model is the cornerstone of subsequent analysis, and its accuracy directly determines the reliability of the source localization results. Currently, achieving this goal mainly relies on academic software packages such as FreeSurfer. However, these tools typically only support the Linux operating system and have high requirements for computing hardware (especially memory), which limits their deployment and application in diverse clinical and research environments, reducing the accessibility of the technology. Furthermore, processing a complete head model of a single subject with FreeSurfer usually takes 8 to 10 hours. Such a long processing cycle constitutes a serious time bottleneck in clinical diagnostic scenarios or large-scale cohort data studies that require rapid feedback.

[0003] Existing technologies face significant challenges in head tissue segmentation. On the one hand, deep learning-based segmentation methods (such as nnU-Net) can achieve high accuracy when processing tissues with large-scale, high-quality labeled data, such as gray matter and white matter. However, their strong dependence on labeled data is a fatal flaw, as acquiring pixel-level accurate labeled data for tissues such as the scalp and skull is extremely costly and time-consuming, making these methods difficult to apply directly to the segmentation of the entire head, thus limiting their applicability. On the other hand, traditional image processing algorithms that do not rely on labeled data (such as those based on thresholding, region growing, and morphological operations) can handle structures such as the scalp and skull, but their segmentation accuracy is severely insufficient when dealing with regions with blurred boundaries, overlapping gray-level distributions, and complex morphologies between gray matter and white matter. This often leads to a large number of misclassifications and omissions, and these errors are directly propagated to the entire head model, reducing its anatomical accuracy.

[0004] Furthermore, the topological incompleteness of the segmentation results exacerbates the problem. Whether from deep learning or traditional algorithms, the original segmentation masks often contain topological defects such as internal holes, unwanted connections between tissues, or tiny discrete regions detached from the main body. These defects do not conform to real biological anatomy and can lead to non-manifold edges or singularities when generating subsequent 3D mesh models, causing physical simulations such as finite element or boundary element methods to fail to converge or produce distorted results. Simultaneously, during the registration process, existing technologies suffer from insufficient accuracy and robustness when aligning the 3D model of an external device (such as a MEG helmet) with the individual's head model. Manual registration relies on operators selecting anatomical landmarks, a tedious process with high subjectivity and poor repeatability. General automatic registration algorithms (such as the standard ICP algorithm) are extremely sensitive to the initial pose of the point cloud. When the initial position and pose deviation between the helmet and the human head are large, the algorithm is prone to getting trapped in local optima, leading to registration failure or severely insufficient accuracy. Existing automation solutions fail to fully consider the complex data characteristics of MEG helmet point clouds, which are relatively sparse, while magnetic resonance imaging (MRI) scalp point clouds are dense and contain noise. This makes it difficult to achieve an ideal balance between accuracy, efficiency, and robustness, thus affecting the reliability and practicality of the entire system. Summary of the Invention

[0005] This invention provides a method, apparatus, device, storage medium, and program product for generating a head model, which can achieve efficient processing and generate a head model with high anatomical accuracy, while ensuring the topological completeness of the segmentation results and the robustness of the registration process.

[0006] In a first aspect, embodiments of the present invention provide a method for generating a head model, comprising: The system receives raw 3D T1-weighted image data from an MRI scanner and raw 3D mesh model from a MEG helmet, and verifies the file format and data integrity of the raw 3D T1-weighted image data and raw 3D mesh model respectively, to obtain verified 3D T1-weighted image data and verified 3D mesh model. Tissue segmentation was performed based on the verified 3D T1-weighted image data and the original 3D T1-weighted image data to obtain gray matter mask, white matter mask, scalp mask and skull mask; Topological restoration was performed on the gray matter mask and white matter mask to obtain the brain mask; The scalp mask, skull mask, and brain mask are converted into corresponding scalp mesh models, skull mesh models, and brain mesh models, respectively. Calculate the spatial transformation matrix from the verified 3D mesh model to the scalp mesh model, and apply the spatial transformation matrix to spatially register and fuse the scalp mesh model, skull mesh model, and brain mesh model to obtain the head model.

[0007] Compared with existing technologies, the advantages of this invention lie in its ability to perform tissue segmentation based on both verified 3D T1-weighted image data and the original 3D T1-weighted image data. This enables efficient and accurate differentiated segmentation, taking into account the differences in data characteristics and segmentation requirements between brain tissue and scalp / skull tissue. This allows for the simultaneous acquisition of accurate masks for all key tissues in a single process, solving the problem of automated segmentation of the entire head and significantly improving the applicability and processing efficiency of the method. Furthermore, by performing specialized topological repair on the gray matter and white matter masks, internal holes, discrete noise points, and other defects present in the original segmentation mask can be effectively eliminated. Topological defects such as non-anatomical connections between tissues are addressed to generate a topologically complete brain mask. This lays a solid foundation for the subsequent generation of a high-quality, manifold 3D mesh model suitable for physical simulation, avoiding distortion or non-convergence in subsequent source localization calculations due to model topological errors. By calculating and registering the spatial transformation matrix from the verified 3D mesh model to the scalp mesh model, compared to general automatic registration algorithms that rely on manual labeling or are sensitive to initial pose, the method proposed in this invention improves the registration success rate and accuracy under large initial pose deviations, enhancing the automation, robustness, and geometric accuracy of the entire head model generation process. In summary, this invention provides a complete and efficient solution from data preprocessing, multimodal tissue segmentation, topology repair to cross-device model registration, effectively overcoming the limitations of existing technologies in terms of platform dependence, processing efficiency, segmentation accuracy, topology quality, and registration reliability.

[0008] Furthermore, the specific operational procedures for obtaining the gray matter mask, white matter mask, scalp mask, and skull mask are as follows: The verified 3D T1-weighted image data is preprocessed, and the 3D U-Net model is pre-trained. The preprocessed 3D T1-weighted image data is input into the pre-trained 3D U-Net model, and the probability map of each voxel in the 3D T1-weighted image data belonging to gray matter, white matter or background is output, thus obtaining the gray matter mask and the white matter mask. Boolean union operation is performed on the gray matter mask and white matter mask, and morphological closing operation is performed on the mask after Boolean union operation to obtain the brain tissue mask. The Otsu adaptive thresholding algorithm is used on the original 3D T1-weighted image data to generate a complete head mask containing the scalp, skull, and brain tissue; Perform a preset number of morphological erosion operations on the complete head mask to generate an internal mask with the scalp layer removed. Subtract this internal mask from the complete head mask using Boolean subtraction to obtain the initial scalp layer mask. By subtracting the initial scalp mask and brain tissue mask sequentially from the complete head mask using Boolean subtraction, the initial skull mask is obtained. For the initial scalp layer mask and the initial skull layer mask, morphological closing operations are first performed, followed by 3D connected component analysis of the results. Finally, the largest connected component is retained as the scalp mask and skull mask, respectively. This approach synergistically leverages the advantages of model segmentation based on large-scale labeled data with the applicability of traditional image processing techniques that do not rely on annotations. This allows for the high-precision, automated generation of all segmentation masks in a single step, effectively solving the core challenges of existing technologies where single methods cannot simultaneously achieve both accuracy and feasibility for all tissue segmentation, as well as the scarcity of fully labeled tissue data. This provides a reliable data foundation for generating high-precision head models.

[0009] Furthermore, the specific process for obtaining the brain mask is as follows: Use the brain white matter mask as the initial seed region; The initial seed region is subjected to layer-by-layer morphological dilation, and in each dilation iteration, it is determined whether the position of the newly dilated voxel has spatial overlap with the gray matter mask. If the location of the newly expanded voxel has been marked as gray matter, then the voxel is not added to the expanded white matter mask; if the location of the newly expanded voxel has not been marked as gray matter, then the voxel is added to the expanded white matter mask. When the dilation process can no longer add any new voxels that do not overlap with the gray matter, the iteration terminates. The final dilated white matter mask is then combined with the original gray matter mask using a Boolean union operation to generate a topologically complete final brain mask. This method intelligently fills in gaps or voids between the white matter and gray matter masks that may exist due to segmentation errors or blurred boundaries, while maintaining the original anatomical morphology of the brain tissue. It also avoids non-anatomical fusion between tissues, thus generating a final brain mask that is internally continuous, has clear boundaries, and a complete topological structure. This directly addresses and solves the topological defects of the original segmentation mask in existing technologies, providing crucial mask data with anatomically connected properties for subsequent generation of manifold mesh models that can be used for physical simulation.

[0010] Furthermore, the specific steps for converting these into corresponding scalp mesh models, skull mesh models, and brain mesh models are as follows: The moving cube algorithm was used to extract isosurfaces from the scalp mask, skull mask, and brain mask, respectively, resulting in triangular mesh models for the scalp, skull, and brain. These models were then processed sequentially using Laplacian smoothing and mesh extraction algorithms to obtain the final mesh models. The Laplacian smoothing algorithm reduces surface noise and staircase artifacts, improving the smoothness and geometric quality of the triangular mesh model. The mesh extraction algorithm reduces the number of triangular faces while maintaining the basic shape of the model, thus reducing its complexity while ensuring visual and computational accuracy, resulting in a high-quality mesh model suitable for subsequent visualization, registration, and simulation calculations.

[0011] Furthermore, the specific steps to obtain the head model are as follows: Uniform sampling is performed on the scalp mesh model and the verified 3D mesh model to generate initial scalp point cloud and device point cloud. A statistical outlier removal algorithm is used to denoise the initial scalp point cloud and device point cloud. Voxel downsampling is then performed on the denoised scalp point cloud and device point cloud to generate preprocessed scalp point cloud and device point cloud. The local geometric feature descriptor of each point in the preprocessed scalp point cloud and device point cloud is obtained by the fast point feature histogram method. The local geometric feature descriptor of each point is matched point-to-point by the random sampling consistency method, and the initial transformation matrix is ​​obtained according to the preset distance threshold. The initial transformation matrix is ​​iteratively aligned using the nearest point method to obtain the final transformation matrix; The final transformation matrix is ​​applied to the denoised device point cloud to generate a spatial transformation matrix that includes the registered device point cloud and scalp point cloud. By applying a spatial transformation matrix, the scalp mesh model, skull mesh model, and brain mesh model are spatially registered and fused to obtain the final head model. This significantly improves the robustness and final accuracy in registering sparse device point clouds to dense scalp point clouds, effectively solving the problems of sensitivity to initial pose and easy getting trapped in local optima in existing general automatic registration algorithms, leading to registration failure or insufficient accuracy. This ensures the reliability of spatial alignment between the head model and the verified 3D mesh model.

[0012] Furthermore, it includes providing a user interface that allows users to verify the head model. Users can observe the head model from different perspectives through the user interface, check the integrity of each tissue structure and the rationality of registration, and make a final confirmation or choose to reprocess based on the user's professional judgment. This combines automated processes with expert experience as the final step in quality control, aiming to further improve the credibility and acceptability of the final output head model in clinical applications or scientific research.

[0013] Secondly, embodiments of the present invention provide an apparatus for generating a head model, the apparatus comprising: The data input and verification module is used to receive the original three-dimensional T1-weighted image data from the MRI scanner and the original three-dimensional mesh model from the MEG helmet, and to verify the file format and data integrity of the original three-dimensional T1-weighted image data and the original three-dimensional mesh model respectively, so as to obtain the verified three-dimensional T1-weighted image data and the verified three-dimensional mesh model. The hybrid segmentation module is used to perform tissue segmentation based on the verified 3D T1-weighted image data and the original 3D T1-weighted image data, respectively, to obtain brain gray matter mask, brain white matter mask, scalp mask and skull mask; The topology correction module is used to repair the topology of the gray matter mask and the white matter mask to obtain the brain mask. The mesh model generation module is used to convert scalp masks, skull masks, and brain masks into corresponding scalp mesh models, skull mesh models, and brain mesh models, respectively. The point cloud registration module is used to calculate the spatial transformation matrix from the verified 3D mesh model to the scalp mesh model, and apply the spatial transformation matrix to spatially register and fuse the scalp mesh model, skull mesh model, and brain mesh model to obtain the head model.

[0014] Thirdly, embodiments of the present invention provide an electronic device, the device comprising: a processor and a memory storing computer program instructions; The processor reads and executes the computer program instructions to implement the head model generation method as described in the first aspect.

[0015] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the head model generation method as described in the first aspect.

[0016] Fifthly, embodiments of the present invention provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the head model generation method as described in the first aspect. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating a method for generating a head model according to an embodiment of the present invention. Figure 2(a) is a schematic diagram of the results of obtaining the gray matter mask and white matter mask using Freesurfer according to an embodiment of the present invention; Figure 2(b) is a schematic diagram of the results of obtaining the gray matter mask and white matter mask using the present invention according to an embodiment of the present invention; Figure 3 A schematic diagram of a network model including the scalp, skull, and brain provided in an embodiment of the present invention; Figure 4(a) is a visualization diagram of the preprocessed scalp point cloud provided in an embodiment of the present invention; Figure 4(b) is a visualization diagram of the preprocessed device point cloud provided by an embodiment of the present invention; Figure 5 A schematic diagram of the obtained spatial transformation matrix provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of a head model generation device provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0018] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments.

[0019] like Figure 1 As shown, a method for generating a head model includes: S101: Receive raw 3D T1-weighted image data from an MRI scanner and raw 3D mesh model from a MEG helmet, and verify the file format and data integrity of the raw 3D T1-weighted image data and raw 3D mesh model respectively to obtain verified 3D T1-weighted image data and verified 3D mesh model; In this embodiment, the MEG helmet uses a 64 / 128-channel miniaturized quantum magnetoencephalography (MEG) instrument from Zero Magnet Equipment (Deqing) Co., Ltd., which is a medical device based on quantum precision measurement technology, used for non-invasive detection of brain magnetic field signals to achieve brain functional imaging and neural activity tracking.

[0020] The verification of the file format and data integrity of the original 3D T1-weighted image data and the original 3D mesh model is carried out according to the following process: The verification of 3D T1-weighted image data in NIfTI file format specifically includes: First, perform a file extension check: determine if the file extension is .nii or .nii.gz; if not, it is determined to be a format incompatibility and the check fails; if yes, proceed to the next step. Secondly, file header parsing and verification are performed: the standard file header of the NIfTI format file is read and parsed, and the metadata within it is verified, specifically including: Magic String Validation: Checks if the magic field in the file header is "n+1" or "ni1"; if it does not match, the file is considered corrupted or not in standard NIfTI format, and the validation fails; if it matches, proceed to the next step. Dimension information verification: Read the dim field in the file header to confirm whether the image dimension is three-dimensional, that is, dim[0] is required to be 3, and dim[1], dim[2], and dim[3] are all greater than 1; if it is not three-dimensional data, it is determined that it is not applicable to this solution and the verification fails; if it is three-dimensional data, proceed to the next step; Data type validation: Read the datatype field in the file header to confirm whether the data type is a numeric type supported by the system, such as 16-bit integer, 32-bit floating-point, etc. If not, the validation fails; if yes, proceed to the next step. Spatial information verification: Check the qform_code and sform_code in the file header to confirm whether the file contains valid spatial orientation and scale information. If not, the verification fails; if yes, proceed to the next step. Finally, perform data integrity verification: calculate the theoretical size of the image data block based on the dimensions (dim[1], dim[2], dim[3]) and data type (datatype) described in the file header; compare the theoretical size with the actual size of the data block stored in the file; if they are inconsistent, the file is determined to be incomplete or corrupted and the verification fails; if they are consistent, the verification succeeds.

[0021] Verification of 3D mesh models in STL format specifically includes: First, perform a file extension check: determine if the file extension is .stl; if not, it is determined to be a format incompatibility and the check fails; if yes, proceed to the next step. Secondly, format type identification and structure verification are performed: STL format is divided into ASCII and binary; the system first identifies its type and performs corresponding verification: For ASCII format: check if the file starts with the keyword "solid" and ends with "endsolid"; at the same time, scan the file line by line to check for the existence of pairs of keywords "facet normal" and "endfacet", as well as keywords "outerloop" and "endloop", to ensure that its syntax structure conforms to the specification. For binary format: verify the first 80 bytes of header information of the file and read the next 4 bytes of unsigned integer, which records the total number M of triangle faces in the model; If the file structure does not conform to any of the above STL format specifications, the verification fails; if it does conform, proceed to the next step. Finally, a data integrity check is performed, which mainly targets binary format: After obtaining the total number of triangle faces M, the theoretical file size should be calculated as "84 + M * 50" bytes (i.e., 80 bytes header + 4 bytes total + M faces × 50 bytes per face); the theoretical file size is compared with the actual file size. If they do not match, the file is determined to be incomplete or corrupted, and the check fails; if they match, the check succeeds.

[0022] The execution logic of the above verification process is as follows: only when the original 3D T1 weighted image data and the original 3D mesh model have passed all the above verification steps are they marked as "verified" data and allowed to enter the subsequent processing process; if any verification step of any data fails, the system will interrupt the process and report the error information to the user.

[0023] S102. Perform tissue segmentation based on the verified three-dimensional T1-weighted image data and the original three-dimensional T1-weighted image data to obtain the gray matter mask, white matter mask, scalp mask and skull mask. The specific steps for obtaining the gray matter mask, white matter mask, scalp mask, and skull mask are as follows: The verified 3D T1-weighted image data is preprocessed, and the 3D U-Net model is pre-trained. The preprocessing includes: first, bias field correction is performed on each 3D T1-weighted image data using the N4ITK algorithm; then, intensity normalization is performed on the bias field-corrected image using the Z-score method; and finally, the normalized image is resampled to isotropic resolution. The process of pre-training the 3D U-Net model is as follows: at least 1542 three-dimensional T1-weighted images are randomly selected from the public dataset OASIS, and the gray matter and white matter regions in each image are labeled by experts to obtain the labeled dataset. The labeled dataset is preprocessed to obtain a preprocessed dataset. The preprocessing includes: first, applying the N4ITK algorithm to perform bias field correction on each 3D T1-weighted image in the labeled dataset; then, applying the Z-score method to normalize the intensity of the bias field-corrected image; and finally, resampling the normalized image to an isotropic resolution (1.0mm x 1.0mm x 1.0mm in this embodiment). The N4ITK (Non-parametric Regression-based Bias Field Correction) algorithm is a non-parametric, non-uniform intensity normalization method for bias field correction of magnetic resonance images; the Z-score method is a standard score method that converts image intensity values ​​into a distribution with a mean of 0 and a standard deviation of 1. Data augmentation is performed on the preprocessed dataset to obtain the augmented dataset. The augmented dataset is then randomly divided, with 80% of the augmented dataset used as the training set and 20% used as the validation set. The data augmentation includes: random elastic deformation, random affine transformation, random gamma correction, and random addition of Gaussian noise. Define the composite loss function , ,in, These represent the weighting coefficients, This indicates Dice's loss. , Represents pixels The predicted probability, Represents pixels The true label, Represents the smoothing coefficient. Represents cross-entropy loss, , Represents pixels Category The predicted probability, Represents pixels Category The true label, This represents the total number of pixels in the 3D T1-weighted image data. , Indicates the total number of categories. ; The training set is input into the 3D U-Net model, using five-fold cross-validation, and the model is optimized using the Adam optimizer and based on the composite loss function. The 3D U-Net model was iteratively optimized with 1000 training rounds. The learning rate was dynamically adjusted using cosine annealing. Training was stopped when the performance metrics of the 3D U-Net model on the validation set converged, resulting in the pre-trained 3D U-Net model. The preprocessed 3D T1-weighted image data is input into the pre-trained 3D U-Net model, and the probability map of each voxel in the 3D T1-weighted image data belonging to gray matter, white matter, or background is output to obtain the gray matter mask and white matter mask. As shown in Figure 2(a), the gray matter mask and white matter mask obtained by Freesurfer have topological defects such as internal holes, cross surfaces, or non-manifold edges. As shown in Figure 2(b), the gray matter mask and white matter mask obtained by the present invention effectively eliminate the topological defects existing by using Freesurfer. Its tissue boundaries are clear and smooth, and its geometric shape is more reasonable. Thus, while ensuring topological correctness, it significantly improves the reliability and usability of the segmentation results, which can directly serve subsequent quantitative analysis and visualization.

[0024] Boolean union operation is performed on the gray matter mask and white matter mask, and morphological closing operation is performed on the mask after Boolean union operation to obtain the brain tissue mask. In this embodiment, the specific operation process for obtaining the brain tissue mask includes sequentially performing Boolean union and morphological closing operations, the detailed implementation of which is as follows: First, perform a Boolean union operation to combine the gray matter mask and the white matter mask: The input consists of a gray matter mask Mask_GM and a white matter mask Mask_WM, both of which are three-dimensional binary images. A voxel with a value of 1 represents the corresponding tissue region, and a voxel with a value of 0 represents the background. The two masks have the same spatial dimension. Create a new 3D mask with the same dimensions as the input mask, as the brain tissue mask Mask_BrainTissue output by the Boolean union operation, and initialize all its voxels to 0; Iterate through all voxel coordinates (i, j, k) and simultaneously read the values ​​of Mask_GM(i, j, k) and Mask_WM(i, j, k) at each coordinate position. If Mask_GM(i, j, k) is 1 or Mask_WM(i, j, k) is 1, then set Mask_BrainTissue(i, j, k) to 1; otherwise, Mask_BrainTissue(i, j, k) remains 0. This operation can be represented as: Mask_BrainTissue(i, j, k) = Mask_GM(i, j, k) ∨ Mask_WM(i, j, k), where "∨" represents the logical OR operator; here, i represents the index in the left-right direction (X-axis), j represents the index in the front-back direction (Y-axis), and k represents the index in the up-down direction (Z-axis, i.e., the slice direction); The output is a brain tissue mask, Mask_BrainTissue, which contains all voxels belonging to the gray or white matter of the brain.

[0025] Subsequently, a morphological closing operation is performed on the brain tissue mask obtained by the Boolean union operation. Morphological closing is a basic morphological operation used to fill small holes inside target objects in binary images, connect neighboring objects, or smooth object boundaries. It consists of two basic operations combined in sequence: first, dilation, then erosion. The input for the morphological closing operation is the brain tissue mask Mask_BrainTissue; a preset three-dimensional structuring element SE (a 3x3x3 cube in this embodiment) is used as the kernel for the morphological operation. First, perform an expansion operation: Use the preset three-dimensional structuring element SE to expand the brain tissue mask Mask_BrainTissue. For each voxel in the brain tissue mask, if there is a voxel with a value of 1 in its neighborhood, the value of that voxel in the output expansion mask is set to 1, thereby expanding the boundary of the brain tissue region outward and filling the small holes. Then perform the erosion operation: use the preset three-dimensional structuring element SE to perform the erosion operation on the dilation mask. For each voxel, only when all voxels in its neighborhood are 1, the value of that voxel in the final output brain tissue mask is set to 1, so that the boundary of the brain tissue region shrinks inward. After undergoing morphological closing operations involving dilation followed by erosion, the small holes and gaps inside the original mask were filled, while having minimal impact on the overall size of the object, ultimately resulting in a brain tissue mask with a more complete topological structure.

[0026] The Otsu adaptive thresholding algorithm is used on the original 3D T1-weighted image data to generate a complete head mask containing the scalp, skull, and brain tissue; In this embodiment, the Otsu adaptive thresholding algorithm is a classic algorithm for automatically performing global thresholding segmentation of images. Its core idea is to find an optimal grayscale threshold that maximizes the inter-class variance (or is equivalent to minimizing the intra-class variance) between the background and foreground categories segmented by the threshold. Specifically, it includes the following steps: Traverse the original 3D T1-weighted image data, count the number of voxels at each gray level, and generate a gray-level histogram. Convert the frequency of each gray level in the gray-level histogram into a probability, so that the sum of the probabilities of each gray level is 1; Let the current candidate threshold be k, where 0≤k≤L-1, and L-1 represents the maximum gray level; Voxels with gray levels in the range [0, k] are classified as background class C0, and voxels with gray levels in the range [k+1, L-1] are classified as foreground class C1. The probability weights ω0(k) of the background class, ω1(k) of the foreground class, the average gray value μ0(k) of the background class, and the average gray value μ1(k) of the foreground class are calculated. Calculate the inter-class variance σ_B^2(k) corresponding to the current candidate threshold k, σ_B^2(k) = ω0(k)·[μ0(k) -μ_T]^2 + ω1(k)·[μ1(k) - μ_T]^2, where μ_T represents the average gray value of the entire image; The candidate threshold that maximizes the inter-class variance σ_B^2(k) is selected as the final optimal threshold; The original 3D T1-weighted image data is binarized based on the optimal threshold. Voxels with gray values ​​greater than the optimal threshold are marked as foreground and the rest are marked as background, thus obtaining a complete head mask in which head tissues (scalp, skull, brain tissue) are separated from the background (air).

[0027] A morphological erosion operation is performed on the complete head mask a preset number of times to generate an internal mask with the scalp layer removed. The internal mask is then subtracted from the complete head mask using a Boolean subtraction operation to obtain the initial scalp layer mask. In this embodiment, the preset number of operations is 5 to 7. In this embodiment, morphological erosion is a basic morphological operation that shrinks or thins foreground objects in a binary image. The specific process for generating an internal mask with the scalp layer removed is as follows: Key parameters are set, including the structuring element SE and the number of iterations N1. The structuring element SE is a small binary matrix, which in this embodiment is a 3x3x3 cube with the origin at its center. The number of iterations N1 determines the degree of erosion, that is, the distance by which the boundary of the foreground object shrinks inward. The value of the number of iterations N1 is set empirically based on the resolution of the 3D T1-weighted image data and the estimated average scalp thickness. In this embodiment, for an image with an isotropic resolution of 1mm, N1 is set to 2 or 3 to remove an outer layer of about 2-3mm thickness. Use the complete header mask as input for the first iteration; for the i-th iteration (1≤i≤N1), perform the following operations: a. Create a temporary output mask with the same dimensions as the input mask and initialize all its voxels to 0; b. Iterate through each voxel V in the input mask; c. Align the center of the structural element SE with the voxel V; d. If all voxels in the neighborhood covered by the structuring element SE have a value of 1 (i.e., SE is completely contained within the foreground region), then the voxel value is set to 1 at the position corresponding to voxel V in the temporary output mask; if one voxel in the neighborhood covered by the structuring element SE has a value of 0, then the voxel value is set to 0 at the position corresponding to voxel V in the temporary output mask. After completing the i-th iteration, the generated temporary output mask is used as the input for the (i+1)-th iteration; After N1 iterations, the internal mask of the scalp layer is obtained.

[0028] By subtracting the initial scalp mask and brain tissue mask sequentially from the complete head mask using Boolean subtraction, the initial skull mask is obtained. In this embodiment, Boolean subtraction is performed at the voxel level to remove the portion of one mask that overlaps with another. The specific operation is as follows: The input consists of the minuend Mask_A and the subtrahend Mask_B, both of which are three-dimensional binary masks of the same dimension. Create a new 3D mask with the same dimensions as the input mask as the output Mask_Result, and initialize all its voxels to 0; Iterate through all voxel coordinates (i, j, k) and simultaneously read the values ​​of Mask_A (i, j, k) and Mask_B (i, j, k) at each coordinate position. When Mask_A (i, j, k) is 1 and Mask_B (i, j, k) is 0, set Mask_Result (i, j, k) to 1; otherwise, keep Mask_Result (i, j, k) at 0. This operation can be represented as: Mask_Result(i, j, k) = Mask_A(i, j, k) ∧ (¬ Mask_B(i, j, k)), where "∧" represents the logical AND operator and "¬" represents the logical NOT operator; here, i represents the index in the left-right direction (X-axis), j represents the index in the front-back direction (Y-axis), and k represents the index in the up-down direction (Z-axis, i.e., the slice direction); When extracting the initial scalp layer mask: use the complete head mask as the minuend Mask_A, use the inner mask as the subtrahend Mask_B, and Mask_Result is the initial scalp layer mask; When extracting the initial skull layer mask: the complete head mask is used as the minuend Mask_A, the initial scalp layer mask is used as the first minuend Mask_B1, the brain tissue mask is used as the second minuend Mask_B2, and Mask_Result is the initial skull layer mask.

[0029] For the initial scalp layer mask and the initial skull layer mask, morphological closing operations are first performed, then three-dimensional connected component analysis is performed on the operation results, and finally the largest connected component of each is retained as the scalp mask and the skull mask.

[0030] In this embodiment, 3D connected component analysis is used to identify and label all separated foreground objects (connected components) in a 3D binary image, and can be used for subsequent filtering operations. The specific operations are as follows: The input is the initial scalp layer mask or the initial skull layer mask after performing the morphological closing operation. (1) Set connectivity criteria: The 26-connectivity criterion is adopted, that is, a central voxel and all 26 adjacent voxels that share a face, an edge, or a vertex in three-dimensional space are considered to be interconnected; (2) Mark all connected components: a. Create a 3D integer label matrix with the same dimensions as the input mask, and initialize all its voxels to 0; b. Initialize the label counter current_label = 1; c. Traverse each voxel (i, j, k) in the input mask from beginning to end; here i represents the index in the left-right direction (X-axis), j represents the index in the front-back direction (Y-axis), and k represents the index in the up-down direction (Z-axis, i.e., the slice direction). d. If the current voxel value is 1 (foreground) and its corresponding position in the 3D integer label matrix has a value of 0 (unlabeled), then perform the following operation: i. Starting from the current voxel, set the value of the starting point in the three-dimensional integer label matrix to current_label, and start the search algorithm (in this embodiment, it is breadth-first search (BFS) or depth-first search (DFS)). ii. According to the 26-connectivity criterion, search for foreground voxels that are connected to the current voxel and are not labeled, and label them all as current_label; iii. Once all voxels connected to the starting point have been marked, the search ends, and the value of current_labe is incremented by 1; (3) Analysis and screening stage: After the labeling phase is completed, all voxels with the same non-zero label value in the three-dimensional integer label matrix constitute an independent connected component; Traverse the three-dimensional integer label matrix and count the total number of voxels (i.e., volume) contained in each label value (i.e., each connected component). Compare the total number of voxels in all connected components, and record the label value corresponding to the connected component with the largest total number of voxels as label_max; (4) Generate the final mask: Create a new 3D binary mask and initialize all its voxel values ​​to 0; traverse the 3D integer label matrix and assign the voxel positions with label values ​​equal to label_max to 1 in the new 3D binary mask. The resulting mask is the final mask that preserves the largest connected component, which retains only the largest connected component in the original input and removes all smaller, discrete noise or artifacts.

[0031] S103. Perform topological repair on the gray matter mask and white matter mask to obtain the brain mask; The specific process for obtaining the brain mask is as follows: Use the brain white matter mask as the initial seed region; The initial seed region is subjected to layer-by-layer morphological dilation, and in each dilation iteration, it is determined whether the position of the newly dilated voxel has spatial overlap with the gray matter mask. In this embodiment, the layer-by-layer morphological dilation operation is essentially a constrained iterative morphological dilation. Its purpose is to allow a "seed" mask (white matter) to grow within the boundary of another "constraint" mask (non-gray matter region) until all accessible space is filled, thereby repairing the topological hole between them. The specific operation is as follows: The inputs are the white matter mask Mask_WM as the seed mask and the gray matter mask Mask_GM as the constraint mask; The key parameter is set as the structuring element SE, which is a three-dimensional binary matrix that defines the neighborhood, usually a 3x3x3 cube, to achieve 26-connected three-dimensional spatial expansion. First, initialize: copy Mask_WM to obtain the dilation mask Mask_Dilating for the current iteration; perform a logical NOT operation on Mask_GM to obtain the allowed growth region mask Mask_Allow, where voxels with a value of 1 in Mask_Allow represent non-gray matter regions, which are the spaces that dilation can enter; Restart the iteration loop until Mask_Dilating no longer changes after one complete iteration, then stop the iteration loop; In each iteration loop, a standard three-dimensional morphological dilation is first performed on Mask_Dilating using the structuring element SE to obtain a temporary dilation result Mask_Temp, which expands the boundary of Mask_Dilating outward by one voxel layer. Perform a voxel-level Boolean AND operation between Mask_Temp and Mask_Allow, and update the result to the new Mask_Dilating, i.e.: Mask_Dilating = Mask_Temp ∧ Mask_Allow; This step preserves all newly expanded voxels, but only if these voxels are located outside the gray matter region. Any voxel that attempts to expand into the gray matter region will be removed because the corresponding value in Mask_Allow is 0. This achieves the logic of "determining whether the location of the newly expanded voxel overlaps with the gray matter mask". Determine whether the updated Mask_Dilating in the current iteration is the same as the one before the update. If they are the same, the iteration terminates; otherwise, continue to the next iteration. After the iteration terminates, the final updated Mask_Dilating becomes a mask that fills all non-gray matter gaps between the white matter and gray matter. Performing a Boolean union operation between the final updated Mask_Dilating and Mask_GM, i.e., Mask_Brain_Final = Mask_Dilating ∨ Mask_GM, yields a topologically complete final brain mask, Mask_Brain_Final. This brain mask has no internal holes, and its outer boundary is consistent with the original gray matter and white matter joint boundary.

[0032] If the location of the newly expanded voxel has been marked as gray matter, then the voxel is not added to the expanded white matter mask; if the location of the newly expanded voxel has not been marked as gray matter, then the voxel is added to the expanded white matter mask. When the dilation process can no longer add any new voxels that do not overlap with the gray matter, the iteration terminates. The final dilated white matter mask is then combined with the original gray matter mask using a Boolean union operation to generate a topologically complete final brain mask.

[0033] S104. Convert the scalp mask, skull mask and brain mask into the corresponding scalp mesh model, skull mesh model and brain mesh model respectively; The specific steps for converting the data into the corresponding scalp mesh model, skull mesh model, and brain mesh model are as follows: The moving cube algorithm is used to extract isosurfaces from the scalp mask, skull mask, and brain mask, respectively, resulting in triangular mesh models of the scalp, skull, and brain. Then, the Laplacian smoothing algorithm and mesh extraction algorithm are sequentially applied to these models to obtain the corresponding mesh models of the scalp, skull, and brain. Figure 3 As shown, the resulting mesh model, which includes the scalp, skull, and brain, is well-defined and has smooth boundaries, meeting the requirements for high-precision biomechanical analysis.

[0034] In this embodiment, the specific process of the moving cube algorithm is as follows: the interface between tissue and background in the scalp mask, skull mask, or brain mask is taken as the isosurface, a threshold is set (in this embodiment, the area with a voxel value greater than 0.5 is determined as the tissue interior), all voxel units are traversed, and a set of triangular patches covering the isosurface is generated by looking up a table, thereby obtaining the scalp triangular mesh model, the skull triangular mesh model, and the brain triangular mesh model respectively.

[0035] In this embodiment, the Laplacian smoothing algorithm is an iterative mesh smoothing method that eliminates high-frequency noise (jaws and sharp features) on the mesh surface by moving each vertex to the average position of its neighboring vertices, making it smoother. The specific process is as follows: The input is a triangular mesh model, such as the "scalp triangular mesh model" generated by the Marching Cubes algorithm, which consists of a set of vertices (V) and a set of faces (F) that define the connection relationships between the vertices; Set key parameters, including the number of iterations N2 and the smoothing factor λ. The number of iterations N2 controls the degree of smoothing. The more iterations, the smoother the model, but it may also lead to oversmoothing and feature loss (volume shrinkage). The value of N2 is usually between 5 and 20. The smoothing factor λ is a decimal between 0 and 1, which controls the magnitude of vertex movement in each iteration. The larger the λ, the stronger the smoothing effect in a single iteration. It is usually set to a value of around 0.5. Start an outer loop, which iterates for a preset number of iterations, N². At the beginning of each iteration, based on the positions of all vertices in the triangular mesh model, a temporary new position v_p' for each vertex v_p is calculated in parallel. For any vertex v_p, its new position is determined as follows: a. Find all adjacent vertices that are directly connected to vertex v_p by an edge, forming a neighborhood vertex set N(p) = {v_1, v_2, ..., v_k}, where k represents the number of adjacent vertices; b. Calculate the geometric center (i.e., centroid) C_p of the neighborhood vertex, C_p = (1 / k) * Σ(v_j), where v_j∈ N(p); c. Calculate the displacement vector D_p from vertex v_p to centroid C_p, where D_p = C_p - v_p; d. Calculate the temporary new position v_p' of vertex v_p based on the smoothing factor λ, v_p' = v_p + λ * D_p; Once the temporary new positions of all vertices in the triangular mesh model have been calculated, the positions of all vertices v_p are updated to their corresponding temporary new positions v_p', thus completing this iteration. After completing N2 iterations, the outer loop ends, resulting in a triangular mesh model with a smoother surface and less noise.

[0036] In this embodiment, the mesh extraction algorithm aims to reduce the number of vertices and faces in the mesh model while preserving the original geometry and visual features of the model to the greatest extent possible. This invention employs an edge collapse algorithm based on a quadratic error metric, a commonly used method with both good performance and efficiency. The specific operation is as follows: The input is a triangular mesh model obtained after processing with the Laplace smoothing algorithm; The key parameter is set as the target number of faces T or the reduction rate R, which is used to define the termination condition of the algorithm. In this embodiment, the model is simplified to 50,000 faces remaining, or 90% of the faces are reduced. Initialize the quadratic error metric matrix: Calculate a 4x4 quadratic error metric matrix Q_v for each vertex v in the triangular mesh model. This matrix Q_v is the sum of the quadratic errors of the plane equations defined by all the triangular faces associated with vertex v. For a plane p=[a,b,c,d]^T defined by the plane equation ax+by+cz+d=0, its quadratic error matrix is ​​K_p = p * p^T. The Q_v of vertex v is the sum of K_p of all its adjacent faces. In a physical sense, Q_v stores the error v'^T * Q_v * v' generated by moving the vertex to any position v'. Calculate the collapse cost for all edges: Traverse all edges in the triangular mesh model. For edge e connecting vertices v_1 and v_2, calculate the cost of collapsing edge e into a new vertex v_bar. The collapse operation refers to merging v_1 and v_2 into a new vertex v_bar. The optimal position of the new vertex v_bar is determined by minimizing the quadratic error, whose error matrix is ​​Q_bar = Q_v1 + Q_v2. Therefore, the position of v_bar can be obtained by solving the inverse matrix of Q_bar. The cost of this collapse operation is the quadratic error of the new vertex v_bar at that position: cost = v_bar^T * Q_bar * v_bar. Store all edges and their corresponding collapse costs in a priority queue (min-heap), with the edge with the lowest cost at the top of the queue; Iterative edge collapse execution: Start a loop, the loop condition being that the current number of mesh faces is greater than the target number of faces T; in each loop, take the edge e = (v_1, v_2) with the lowest cost from the priority queue; remove v_1 and v_2, create a new vertex v_bar, and update the connection relationships of all edges connected to v_1 and v_2 so that they point to v_bar, and remove the face that degenerates (two vertices overlap) in the process; calculate the error matrix Q_bar of the new vertex v_bar, Q_bar = Q_v1 + Q_v2; recalculate the collapse cost of all edges connected to the new vertex v_bar, and update the position of the corresponding element in the priority queue; the loop terminates when the number of mesh faces reaches the target value T; The final output is a lightweight final mesh model (e.g., a scalp mesh model) with a significantly reduced number of vertices and faces, but with the macroscopic shape preserved.

[0037] S105. Calculate the spatial transformation matrix from the verified 3D mesh model to the scalp mesh model, and apply the spatial transformation matrix to spatially register and fuse the scalp mesh model, skull mesh model, and brain mesh model to obtain the head model. The specific steps to obtain the head model are as follows: Uniform sampling was performed on the scalp mesh model and the verified 3D mesh model to generate initial scalp point cloud and device point cloud. A statistical outlier removal algorithm was used to denoise the initial scalp point cloud and device point cloud. Voxel downsampling was then performed on the denoised scalp point cloud and device point cloud to generate preprocessed scalp point cloud and device point cloud. The preprocessed scalp point cloud is shown in Figure 4(a), and the preprocessed device point cloud is shown in Figure 4(b). In this embodiment, the principle of the statistical outlier removal algorithm is based on the assumption that the spacing between points in the real point cloud data is relatively uniform, while noise points (outliers) are relatively isolated. By analyzing the statistical characteristics of each point and its neighborhood, these outliers can be effectively identified and removed. The specific operation is as follows: The input is the initial point cloud (e.g., the initial scalp point cloud). The key parameters to set include the number of neighborhood points k and the standard deviation threshold σ_mult. The number of neighborhood points k is a positive integer used to define an analysis neighborhood for each point, that is, to find the k nearest neighbors for each point. The value of k is usually between 30 and 100, depending on the density of the point cloud. The standard deviation threshold σ_mult is a positive number used to define the threshold for identifying outliers. The larger the value, the higher the tolerance of the algorithm for outliers. It is usually set to 1.0 to 2.0. Calculate the average neighborhood distance for each point: For each point p_i in the input point cloud, use an efficient nearest neighbor search structure such as a kd-tree to find the k nearest neighbor points of p_i; calculate the Euclidean distance from p_i to these k neighbor points, and take the average of these distances, denoted as d_i; Calculate the statistics of the global distance distribution: After obtaining d_i of all points, construct a sample set {d_1,d_2, ..., d_N'} from these values, where N' represents the total number of points in the point cloud; calculate the mean μ and standard deviation σ of this sample set, μ = (1 / N)* Σ(d_i), σ = sqrt[(1 / N) * Σ(d_i - μ)^2]; Define a distance threshold and remove outliers: Calculate the distance threshold T based on the mean μ, standard deviation σ, and standard deviation multiple threshold σ_mult, where T = μ + σ_mult * σ; Iterate through each point p_i in the point cloud, checking if its corresponding d_i is greater than T. If d_i > T, point p_i is considered an outlier and removed from the point cloud; if d_i ≤ T, point p_i is considered an interior point and retained. The final output is a cleaner, denoised point cloud with sparse noise points removed.

[0038] The local geometric feature descriptor of each point in the preprocessed scalp point cloud and device point cloud is obtained by the fast point feature histogram method. The local geometric feature descriptor of each point is matched point-to-point by the random sampling consistency method, and the initial transformation matrix is ​​obtained according to the preset distance threshold. In this embodiment, the preset distance threshold is 4mm. In this embodiment, the fast point feature histogram method is a feature descriptor used to describe the local geometric information around a point in a point cloud. It generates a rotation-invariant multidimensional histogram by encoding the normal vector relationship between the query point and its neighboring points, which is then used for subsequent point pair matching. The specific operation is as follows: The input point cloud is either a preprocessed scalp point cloud or a preprocessed device point cloud, where the normal vector of each point has been calculated. The normal vector estimation operation is as follows: for each point p_i in the point cloud, in the neighborhood where its radius r_norm is less than the feature calculation radius r, a local plane is fitted by principal component analysis, and the normal vector of this plane is used as the normal vector n_i of point p_i. The key parameter is set to the feature calculation radius r, which is a positive number. This defines the neighborhood range considered when calculating the fast point feature histogram. This radius must be larger than the radius used for normal vector estimation. Calculate the simplified point feature histogram: For each query point p_q in the point cloud, find all neighboring points p_k within its feature calculation radius r; for each neighboring point p_k, construct a local coordinate system uvw, where u = n_q, v = (p_k - p_q) × u, w = u × v; in this local coordinate system, calculate the three angular feature values ​​(α, φ, θ) between the query point normal vector n_q and the neighboring point normal vector n_k; quantize and vote the three sets of feature values ​​into a multi-dimensional histogram to form the simplified point feature histogram of point p_q; Calculating the Fast Point Feature Histogram: For each query point p_q in the point cloud, its final Fast Point Feature Histogram descriptor is obtained by weighted summation of its own simplified point feature histogram and the simplified point feature histograms of all its neighboring points p_k within the feature calculation radius r. It can be expressed as: FPFH(p_q) = SPFH(p_q) + (1 / k) * Σ [ (1 / w_k) * SPFH(p_k) ], where FPFH represents the Fast Point Feature Histogram, SPFH represents the Simplified Point Feature Histogram, k represents the number of neighboring points, and w_k represents the distance between points p_q and p_k, which is used as the weight. The above weighted summation process allows the Fast Point Feature Histogram to contain geometric information from a wider neighborhood while maintaining computational efficiency. Finally, a corresponding fast point feature histogram descriptor (a 33-dimensional floating-point vector) is generated for each point in the input point cloud.

[0039] In this embodiment, the random sample consensus method is an iterative algorithm used to estimate the parameters of a mathematical model from a dataset containing a large number of "outside points" (false matches). In this invention, it is used to find a set of geometrically consistent "inside points" (correct matches) from a large number of potential point pair matches obtained based on FPFH feature similarity, and to estimate the initial rigid body transformation matrix. The specific operations are as follows: The input includes: source point cloud (i.e. device point cloud) and its fast point feature histogram descriptor, target point cloud (i.e. scalp point cloud) and its fast point feature histogram descriptor, and all potential matching point pairs obtained by finding the nearest neighbors of the fast point feature histogram descriptors; Key parameters are set, including the number of iterations N3, the number of samples k, and the interior point distance threshold t. The number of iterations N3 is a positive integer that defines the number of times the algorithm attempts to find the optimal model. In this embodiment, the number of iterations is 1000. The number of samples k is the number of point pairs randomly selected in each iteration for calculating the transformation model. For three-dimensional rigid body transformation, k=3. The interior point distance threshold t is a positive number. After transformation, if the distance between the source point and the target point of a matching point pair is less than this threshold, it is considered an interior point. Start the N3-time iteration loop; In the i-th iteration (1≤i≤N3), k point pairs are randomly and non-repeatingly selected from all potential matching point pairs; based on these k point pairs, the rigid body transformation matrix H_i of the i-th iteration (including the rotation matrix R and translation vector T) is calculated; the rigid body transformation matrix H_i of the i-th iteration is applied to the source point cloud; for all potential matching point pairs, the distance between the transformed source point (i.e., the point in the source point cloud with H_i applied) and the corresponding target point (i.e., the point in the target point cloud) is calculated; the number of point pairs whose distance is less than the inlier distance threshold t is counted, and this number is used as the score of the rigid body transformation matrix H_i of the i-th iteration (i.e., the number of inlier points); the score of the rigid body transformation matrix H_i of the i-th iteration is compared with the highest score recorded in all previous iterations. If the score of the rigid body transformation matrix H_i of the i-th iteration is higher, the optimal transformation matrix H_best is updated to H_i, and the corresponding set of inlier points is recorded. After completing N3 iterations, the optimal transformation matrix H_best with the most interior point support is obtained. Based on all interior points corresponding to the optimal transformation matrix H_best, a more accurate transformation matrix is ​​recalculated based on the above steps and used as the initial transformation matrix. Finally, an initial transformation matrix is ​​obtained that can roughly align the device point cloud to the scalp point cloud.

[0040] The initial transformation matrix is ​​iteratively aligned using the nearest point method to obtain the final transformation matrix; In this embodiment, the iterative nearest point method is a classic algorithm for precise registration of two point clouds. Based on a rough alignment, it iteratively optimizes the transformation matrix to minimize the distance between corresponding points in the two point clouds. The specific operation is as follows: The inputs include: source point cloud (i.e., device point cloud), target point cloud (i.e., scalp point cloud), and initial transformation matrix; Set key parameters, including the maximum number of iterations Max_Iter and the convergence threshold ε. The maximum number of iterations Max_Iter is a positive integer used to prevent the algorithm from looping indefinitely. In this embodiment, it is set to 100. The convergence threshold ε is a very small positive number. When the change in the transformation matrix or the change in error between two iterations is less than this threshold, the algorithm is considered to have converged and can be terminated early. The source point cloud is initially transformed using the initial transformation matrix; Start the iteration loop, and stop the iteration loop when the maximum number of iterations is reached or the convergence condition is met. For each point in the source point cloud after the initial transformation, find the point in the target point cloud with the closest Euclidean distance and establish the corresponding set of point pairs; A rigid body transformation matrix (including rotation matrix R and translation vector T) that minimizes the mean squared distance between point pairs is calculated based on a set of point pairs. The singular value decomposition method is used to solve the problem, which can be expressed as: minimizing E(R, T) = Σ || (R*p_i + T) - q_i ||^2, where p_i represents the i-th source point in the source point cloud, and q_i is the target point corresponding to p_i; Apply the rigid body transformation matrix to the source point cloud to update its spatial position; Calculate the difference between the rigid body transformation matrix in the current iteration and the rigid body transformation matrix in the previous iteration (or calculate the current average error). If the difference is less than the convergence threshold ε, it is determined to be converged and the iteration loop is terminated; otherwise, continue to the next iteration loop. Finally, a high-precision final transformation matrix is ​​obtained, which can accurately register the device point cloud to the coordinate system of the scalp point cloud.

[0041] The final transformation matrix is ​​applied to the denoised device point cloud to generate a spatial transformation matrix that includes the registered device point cloud and scalp point cloud, such as... Figure 5 As shown; By applying a spatial transformation matrix, the scalp mesh model, skull mesh model, and brain mesh model are spatially registered and fused to obtain the final head model.

[0042] In this embodiment, after S105, a method for generating a head model further includes providing a user interface that allows users to confirm the head model.

[0043] like Figure 6 As shown, the head model generation apparatus provided in this embodiment of the invention includes: The data input and verification module 210 is used to receive the original three-dimensional T1-weighted image data from the MRI scanner and the original three-dimensional mesh model from the MEG helmet, and to verify the file format and data integrity of the original three-dimensional T1-weighted image data and the original three-dimensional mesh model respectively, so as to obtain the verified three-dimensional T1-weighted image data and the verified three-dimensional mesh model. The hybrid segmentation module 220 is used to perform tissue segmentation based on the verified three-dimensional T1 weighted image data and the original three-dimensional T1 weighted image data respectively, to obtain brain gray matter mask, brain white matter mask, scalp mask and skull mask; Topology correction module 230 is used to perform topological structure repair on brain gray matter mask and brain white matter mask to obtain brain mask; Mesh model generation module 240 is used to convert scalp mask, skull mask and brain mask into corresponding scalp mesh model, skull mesh model and brain mesh model respectively; The point cloud registration module 250 is used to calculate the spatial transformation matrix from the verified 3D mesh model to the scalp mesh model, and apply the spatial transformation matrix to spatially register and fuse the scalp mesh model, skull mesh model and brain mesh model to obtain the head model.

[0044] In this embodiment, the hybrid segmentation module 220 includes a deep learning segmentation submodule and a traditional algorithm segmentation submodule; The deep learning segmentation submodule is used to segment the verified 3D T1-weighted image data to obtain the corresponding gray matter mask and white matter mask. The specific operation process is as follows: The verified 3D T1-weighted image data is preprocessed, and the 3D U-Net model is pre-trained. The preprocessing includes: first, bias field correction is performed on each 3D T1-weighted image data using the N4ITK algorithm; then, intensity normalization is performed on the bias field-corrected image using the Z-score method; and finally, the normalized image is resampled to isotropic resolution. The pre-training process for the 3D U-Net model is as follows: at least 1542 three-dimensional T1-weighted images are randomly selected from the public dataset OASIS, and the gray matter and white matter in each image are labeled by experts to obtain the labeled dataset. The labeled dataset is preprocessed to obtain a preprocessed dataset. The preprocessing includes: first, bias field correction is performed on each 3D T1 weighted image data in the labeled dataset using the N4ITK algorithm; then, intensity normalization is performed on the bias field corrected image using the Z-score method; and finally, the normalized image is resampled to isotropic resolution. Data augmentation is performed on the preprocessed dataset to obtain the augmented dataset. The augmented dataset is then randomly divided, with 80% of the augmented dataset used as the training set and 20% used as the validation set. The data augmentation includes: random elastic deformation, random affine transformation, random gamma correction, and random addition of Gaussian noise. Define the composite loss function , ,in, These represent the weighting coefficients, This indicates Dice's loss. , Represents pixels The predicted probability, Represents pixels The true label, Represents the smoothing coefficient. Represents cross-entropy loss, , Represents pixels Category The predicted probability, Represents pixels Category The true label, This represents the total number of pixels in the 3D T1-weighted image data. , Indicates the total number of categories. ; The training set is input into the 3D U-Net model, using five-fold cross-validation, and the model is optimized using the Adam optimizer and based on the composite loss function. The 3D U-Net model was iteratively optimized with 1000 training rounds. The learning rate was dynamically adjusted using cosine annealing. Training was stopped when the performance metrics of the 3D U-Net model on the validation set converged, resulting in the pre-trained 3D U-Net model. The preprocessed 3D T1-weighted image data is input into the pre-trained 3D U-Net model, and the probability map of each voxel in the 3D T1-weighted image data belonging to the gray matter, white matter, or background is output, thus obtaining the gray matter mask and the white matter mask.

[0045] The traditional algorithm segmentation submodule is used to segment the original 3D T1-weighted image data based on the gray matter mask and white matter mask to obtain the corresponding scalp mask and skull mask. The specific operation process is as follows: Boolean union operation is performed on the gray matter mask and white matter mask, and morphological closing operation is performed on the mask after Boolean union operation to obtain the brain tissue mask. The Otsu adaptive thresholding algorithm is used on the original 3D T1-weighted image data to generate a complete head mask containing the scalp, skull, and brain tissue; Perform a preset number of morphological erosion operations on the complete head mask to generate an internal mask with the scalp layer removed. Subtract this internal mask from the complete head mask using Boolean subtraction to obtain the initial scalp layer mask. By subtracting the initial scalp mask and brain tissue mask sequentially from the complete head mask using Boolean subtraction, the initial skull mask is obtained. For the initial scalp layer mask and the initial skull layer mask, morphological closing operations are first performed, then three-dimensional connected component analysis is performed on the operation results, and finally the largest connected component of each is retained as the scalp mask and the skull mask.

[0046] In this embodiment, the specific operation process of the topology correction module 230 is as follows: Use the brain white matter mask as the initial seed region; The initial seed region is subjected to layer-by-layer morphological dilation, and in each dilation iteration, it is determined whether the position of the newly dilated voxel has spatial overlap with the gray matter mask. If the location of the newly expanded voxel has already been marked as gray matter, then the voxel will not be added to the expanded white matter mask. If the location of the newly expanded voxel is not marked as gray matter, then the voxel is added to the expanded white matter mask. When the dilation process can no longer add any new voxels that do not overlap with the gray matter, the iteration terminates. The final dilated white matter mask is then combined with the original gray matter mask using a Boolean union operation to generate a topologically complete final brain mask.

[0047] In this embodiment, the specific operation process of the mesh model generation module 240 is as follows: The moving cube algorithm is used to extract isosurfaces from the scalp mask, skull mask, and brain mask respectively, to obtain the scalp triangular mesh model, skull triangular mesh model, and brain triangular mesh model. The Laplacian smoothing algorithm and mesh extraction algorithm are then applied to the scalp triangular mesh model, skull triangular mesh model, and brain triangular mesh model respectively to obtain the scalp mesh model, skull mesh model, and brain mesh model.

[0048] In this embodiment, the specific operation process of the point cloud registration module 250 is as follows: Uniform sampling is performed on the scalp mesh model and the verified 3D mesh model to generate initial scalp point cloud and device point cloud. A statistical outlier removal algorithm is used to denoise the initial scalp point cloud and device point cloud. Voxel downsampling is then performed on the denoised scalp point cloud and device point cloud to generate preprocessed scalp point cloud and device point cloud. The local geometric feature descriptor of each point in the preprocessed scalp point cloud and device point cloud is obtained by the fast point feature histogram method. The local geometric feature descriptor of each point is matched point-to-point by the random sampling consistency method, and the initial transformation matrix is ​​obtained according to the preset distance threshold. In this embodiment, the preset distance threshold is 4mm. The initial transformation matrix is ​​iteratively aligned using the nearest point method to obtain the final transformation matrix; The final transformation matrix is ​​applied to the denoised device point cloud to generate a spatial transformation matrix that includes the registered device point cloud and scalp point cloud. By applying a spatial transformation matrix, the scalp mesh model, skull mesh model, and brain mesh model are spatially registered and fused to obtain the final head model.

[0049] In this embodiment, the device further includes: a confirmation module for providing a user interface that allows users to confirm the head model.

[0050] To verify the overall performance of the method proposed in this invention, this embodiment designed and conducted a series of comparative experiments. The performance was compared on the same Linux workstation (Ubuntu 22.04, Intel Xeon W-2245 CPU, 64GB RAM, NVIDIA RTX 3080 GPU). Furthermore, to verify accessibility, this embodiment also conducted tests on a Windows 11 PC.

[0051] The dataset consists of three-dimensional T1-weighted images of 30 subjects randomly selected from the publicly available OASIS dataset.

[0052] The evaluation metrics used to validate processing efficiency and resource consumption include average processing time, peak memory usage, and cross-platform support. Average processing time refers to the average computation time required to complete the entire analysis process for a single subject. Peak memory usage refers to the maximum physical memory (RAM) occupied by the program during processing. Cross-platform support is an evaluation of whether the method can run natively on mainstream operating systems such as Linux and Windows.

[0053] The comparison method used is FreeSurfer, an industry-recognized benchmark toolkit, which executes its standard recon-all complete processing flow.

[0054] Table 1. Performance comparison of different treatment methods (mean ± standard deviation) As shown in Table 1, this invention demonstrates a significant advantage in processing efficiency. The average processing time of the method is only 2.5 minutes, which is more than an order of magnitude faster than FreeSurfer's approximately 8.5 hours. This solves the technical bottleneck of traditional methods being too time-consuming and unable to meet the immediate needs of clinical practice, making it possible to complete individualized head modeling within tens of minutes. Regarding hardware resource consumption, the peak memory usage of the method is only 7.8GB, which is about 70% lower than FreeSurfer's 26.4GB, significantly reducing dependence on computing hardware resources and improving deployability on general-purpose computing devices. Furthermore, this invention can also run natively on the Windows 11 operating system, demonstrating its excellent cross-platform support capabilities.

[0055] For brain segmentation: the publicly available dataset OASIS, which contains expert-manually segmented gray matter (GM) and white matter (WM) gold standards, was used for quantitative evaluation; for scalp and skull segmentation: due to the lack of publicly available gold standards, three neuroimaging experts blind-reviewed the segmentation results of 30 cases and scored them from the perspective of anatomical accuracy and completeness (1-5 points, 5 points being the best) for qualitative evaluation.

[0056] The evaluation metrics used to verify segmentation accuracy include the Dice similarity coefficient (DSC), the 95% Hausdorff distance (HD95), and expert scores. DSC measures the overlap between the segmentation results and the gold standard, with a value ranging from 0 to 1, and higher values ​​are better. HD95 measures the distance between the segmentation boundary and the gold standard boundary, in mm, and lower values ​​are better. Expert scores are used to evaluate the quality of scalp and skull segmentation.

[0057] Table 2. Performance comparison of different segmentation methods (mean ± standard deviation) As shown in Table 2, the hybrid segmentation strategy of this invention demonstrates a comprehensive advantage in accuracy, achieving targeted optimization for different tissues. In the core structures of gray and white matter, crucial for source localization, this invention consistently outperforms FreeSurfer in both the Dice coefficient and HD95, thanks to the powerful feature learning and contextual understanding capabilities of the 3D U-Net model. For the scalp and skull, where large-scale labeled data is lacking, the expert score of this invention is higher than FreeSurfer. This is mainly because this invention can more accurately utilize the Otsu threshold and morphological operations to peel away outer tissues, effectively avoiding the problem often encountered by FreeSurfer of misidentifying neck muscles or dura mater as scalp or skull. In summary, the experimental results demonstrate that this invention, while ensuring high accuracy in core brain regions, also maintains the integrity and anatomical accuracy of the entire head model, providing a solid foundation for generating high-quality head models.

[0058] The evaluation metrics used for topological integrity verification include genus and topological accuracy. Genus is a topological invariant used to describe the number of "holes" on the surface of an object. For a topologically correct, sphere-like closed surface, its genus should be 0. Topological accuracy represents the percentage of models with a genus of 0 out of the total number of models.

[0059] Table 3 Comparison of Topology Correction Effects (Mean ± Standard Deviation) Table 3 shows the uncorrected model, a 3D mesh model generated directly from the original brain tissue (union of gray and white matter) mask output by the deep learning module. Due to noise or algorithmic limitations, the uncorrected model often contains tiny holes, breaks, or incorrect internal connections after conversion to a 3D mesh. These topological defects severely affect the convergence and accuracy of subsequent physical simulations. The topology correction module 230 of this invention can deterministically solve this problem. As shown in Table 3, the average genus of the uncorrected model is 15.7, and the topological accuracy is 60%, indicating that most of the original models have serious topological errors. After processing by this invention, the average genus is 0, and the topological accuracy reaches 100%. This is due to the constrained morphological dilation strategy adopted by this invention, which can intelligently fill all non-organic gaps between the white and gray matter while preserving the original tissue boundaries, ultimately generating a perfect closed surface. This means that each generated brain mesh model is "watertight" and manifold, providing a reliable foundation for subsequent finite element or boundary element physical simulations requiring high geometric quality, fundamentally avoiding computational failures or result distortions caused by model topological defects.

[0060] For verification of registration accuracy, Fiducial Localization Error (FLE), registration time, and success rate are used. FLE is the average Euclidean distance (mm) between corresponding anatomical markers on the source and target data after registration. Registration time refers to the calculation time (s) for automated methods and the operation time (s) for manual methods. Success rate indicates the percentage of trials where the FLE of the registration result is less than the clinically acceptable threshold of 5.0 mm.

[0061] Table 4. Performance comparison of different registration methods (mean ± standard deviation): In Table 4, manual registration was performed by three experienced operators who manually selected the corresponding feature points. The ICP standard algorithm was to directly apply the point-to-point ICP algorithm. The initial transformation was set to the identity matrix, and no coarse registration was performed. In this invention, an initial scalp point cloud consisting of 8,000 points and an initial device point cloud consisting of 6,000 points were obtained by sampling. The in-point distance threshold in the random sampling consistency method was set to 4.0 mm, and the iteration nearest point method was set to iterate the nearest point 2,000 times.

[0062] As shown in Table 4, the FLE of this invention is only 1.3±0.3 mm, significantly better than the standard ICP algorithm (FLE 3.7±1.8 mm), and even slightly better than manual registration performed by experienced operators (FLE 1.5±0.4 mm). The standard ICP algorithm, lacking effective coarse registration guidance, is prone to getting trapped in local optima when initial pose deviations are large, resulting in a high average FLE and poor stability. In contrast, the method of this invention uses a random sampling consensus method combined with a fast point feature histogram descriptor for coarse registration, effectively guiding the point cloud to an initial position close to the global optimum. Fine-tuning is then performed using an iterative nearest-point method, significantly improving the final registration accuracy and consistency. The accuracy of only 1.3 mm is better than the clinically acceptable error threshold of 2 mm often mentioned in the literature, which is crucial for subsequent high-precision localization of brain functional sources. In terms of efficiency, the registration time of this invention is 75±15 s, much faster than the 950±120 s of manual registration, a reduction of more than an order of magnitude. Although it takes approximately 30 seconds longer than the standard ICP algorithm, it yields a significant improvement in accuracy and robustness. Most importantly, this invention achieves a 100% success rate, compared to only 70% for the standard ICP algorithm, demonstrating successful registration. This fully proves the superior robustness of this invention when processing data from different individuals with varying initial conditions.

[0063] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention is shown.

[0064] The electronic device may include a processor 301 and a memory 302 storing computer program instructions.

[0065] Specifically, the processor 301 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of the present invention.

[0066] Memory 302 may include mass storage for data or instructions. For example, and not limitingly, memory 302 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 302 may include removable or non-removable (or fixed) media. Where appropriate, memory 302 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 302 is non-volatile solid-state memory.

[0067] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the methods according to one aspect of this disclosure.

[0068] The processor 301 implements any of the head model generation methods in the above embodiments by reading and executing computer program instructions stored in the memory 302.

[0069] In one example, the electronic device may also include a communication interface 303 and a bus 304. For example, Figure 7 As shown, the processor 301, memory 302, and communication interface 303 are connected through bus 304 and complete communication with each other.

[0070] The communication interface 303 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of the present invention.

[0071] Bus 304 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Linear Predictive Coding (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (Peripheral Component Interconnect-X, PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VESA Local Bus, VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 304 may include one or more buses. Although specific buses are described and illustrated in the embodiments of the present invention, the present invention contemplates any suitable bus or interconnection. The electronic device can perform the head model generation method in the embodiments of the present invention, thereby implementing the head model generation method described above.

[0072] Furthermore, in conjunction with the head model generation method in the above embodiments, this invention can be implemented using a computer-readable storage medium. This computer-readable storage medium stores computer program instructions; when executed by a processor, these computer program instructions implement any of the head model generation methods described in the above embodiments.

[0073] The present invention also provides a computer program product, wherein the instructions in the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform various processes implementing any of the above-described head model generation method embodiments.

Claims

1. A method for generating a head model, characterized in that, include: The system receives raw 3D T1-weighted image data from an MRI scanner and raw 3D mesh model from a MEG helmet, and verifies the file format and data integrity of the raw 3D T1-weighted image data and raw 3D mesh model respectively, to obtain verified 3D T1-weighted image data and verified 3D mesh model. Tissue segmentation was performed based on the verified 3D T1-weighted image data and the original 3D T1-weighted image data to obtain gray matter mask, white matter mask, scalp mask and skull mask; Topological restoration was performed on the gray matter mask and white matter mask to obtain the brain mask; The scalp mask, skull mask, and brain mask are converted into corresponding scalp mesh models, skull mesh models, and brain mesh models, respectively. Calculate the spatial transformation matrix from the verified 3D mesh model to the scalp mesh model, and apply the spatial transformation matrix to spatially register and fuse the scalp mesh model, skull mesh model, and brain mesh model to obtain the head model.

2. The method according to claim 1, characterized in that... The specific steps for obtaining the gray matter mask, white matter mask, scalp mask, and skull mask are as follows: The verified 3D T1-weighted image data is preprocessed, and the 3D U-Net model is pre-trained. The preprocessed 3D T1-weighted image data is input into the pre-trained 3D U-Net model, and the probability map of each voxel in the 3D T1-weighted image data belonging to gray matter, white matter or background is output, thus obtaining the gray matter mask and the white matter mask. Boolean union operation is performed on the gray matter mask and white matter mask, and morphological closing operation is performed on the mask after Boolean union operation to obtain the brain tissue mask. The Otsu adaptive thresholding algorithm is used on the original 3D T1-weighted image data to generate a complete head mask containing the scalp, skull, and brain tissue; Perform a preset number of morphological erosion operations on the complete head mask to generate an internal mask with the scalp layer removed. Subtract this internal mask from the complete head mask using Boolean subtraction to obtain the initial scalp layer mask. By subtracting the initial scalp mask and brain tissue mask sequentially from the complete head mask using Boolean subtraction, the initial skull mask is obtained. For the initial scalp layer mask and the initial skull layer mask, morphological closing operations are first performed, then three-dimensional connected component analysis is performed on the operation results, and finally the largest connected component of each is retained as the scalp mask and the skull mask.

3. The method according to claim 1, characterized in that... The specific steps to obtain the brain mask are as follows: Use the brain white matter mask as the initial seed region; The initial seed region is subjected to layer-by-layer morphological dilation, and in each dilation iteration, it is determined whether the position of the newly dilated voxel has spatial overlap with the gray matter mask. If the location of the newly expanded voxel has been marked as gray matter, then the voxel is not added to the expanded white matter mask; if the location of the newly expanded voxel has not been marked as gray matter, then the voxel is added to the expanded white matter mask. When the dilation process can no longer add any new voxels that do not overlap with the gray matter, the iteration terminates. The final dilated white matter mask is then combined with the original gray matter mask using a Boolean union operation to generate a topologically complete final brain mask.

4. The method according to claim 1, characterized in that... The specific steps for converting to the corresponding scalp mesh model, skull mesh model, and brain mesh model are as follows: The moving cube algorithm is used to extract isosurfaces from the scalp mask, skull mask, and brain mask respectively, to obtain the scalp triangular mesh model, skull triangular mesh model, and brain triangular mesh model. The Laplacian smoothing algorithm and mesh extraction algorithm are then applied to the scalp triangular mesh model, skull triangular mesh model, and brain triangular mesh model respectively to obtain the scalp mesh model, skull mesh model, and brain mesh model.

5. The method according to claim 1, characterized in that... The specific steps to obtain the head model are as follows: Uniform sampling is performed on the scalp mesh model and the verified 3D mesh model to generate initial scalp point cloud and device point cloud. A statistical outlier removal algorithm is used to denoise the initial scalp point cloud and device point cloud. Voxel downsampling is then performed on the denoised scalp point cloud and device point cloud to generate preprocessed scalp point cloud and device point cloud. The local geometric feature descriptor of each point in the preprocessed scalp point cloud and device point cloud is obtained by the fast point feature histogram method. The local geometric feature descriptor of each point is matched point-to-point by the random sampling consistency method, and the initial transformation matrix is ​​obtained according to the preset distance threshold. The initial transformation matrix is ​​iteratively aligned using the nearest point method to obtain the final transformation matrix; The final transformation matrix is ​​applied to the denoised device point cloud to generate a spatial transformation matrix that includes the registered device point cloud and scalp point cloud. By applying a spatial transformation matrix, the scalp mesh model, skull mesh model, and brain mesh model are spatially registered and fused to obtain the final head model.

6. The method according to claim 1, characterized in that... It also includes providing a user interface that allows users to confirm the head model.

7. A device for generating a head model, characterized in that, The device includes: The data input and verification module is used to receive the original three-dimensional T1-weighted image data from the MRI scanner and the original three-dimensional mesh model from the MEG helmet, and to verify the file format and data integrity of the original three-dimensional T1-weighted image data and the original three-dimensional mesh model respectively, so as to obtain the verified three-dimensional T1-weighted image data and the verified three-dimensional mesh model. The hybrid segmentation module is used to perform tissue segmentation based on the verified 3D T1-weighted image data and the original 3D T1-weighted image data, respectively, to obtain brain gray matter mask, brain white matter mask, scalp mask and skull mask; The topology correction module is used to repair the topology of the gray matter mask and the white matter mask to obtain the brain mask. The mesh model generation module is used to convert scalp masks, skull masks, and brain masks into corresponding scalp mesh models, skull mesh models, and brain mesh models, respectively. The point cloud registration module is used to calculate the spatial transformation matrix from the verified 3D mesh model to the scalp mesh model, and apply the spatial transformation matrix to spatially register and fuse the scalp mesh model, skull mesh model, and brain mesh model to obtain the head model.

8. An electronic device, characterized in that, The device includes: a processor and a memory storing computer program instructions; The processor reads and executes the computer program instructions to implement the head model generation method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processor, implement the head model generation method as described in any one of claims 1-6.

10. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device causes the electronic device to perform the head model generation method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Method for three-dimensional registration and brain tissue extraction of individual human brain multimodality medical images

    CN105816192A

  • CT brain parenchyma segmentation system, method and device based on block region growing method

    CN113160245A

  • Modeling method and system of craniocerebral paracentesis preoperative three-dimensional model, device and medium

    CN113409456A

  • Brain tissue automatic sketching method and sketching system for MRI head image, computing device and storage medium

    CN113538496A

  • Graph network-based cerebral cortex surface full-automatic segmentation method and system

    CN114972366A

Cited By

  • Brain tetrahedral mesh generation method and system based on thickness field algorithm, terminal and medium

    CN122023729A

  • Brain tetrahedral mesh generation method and system based on thickness field algorithm and sharp tetrahedron removal, terminal and medium

    CN122023730A