A brain tetrahedral mesh generation method and system based on thickness field algorithm, a terminal and a medium
By generating tetrahedral meshes of the brain using a thickness field algorithm, the error problem caused by excessively large mesh element size in brain finite element simulation is solved. This achieves adaptive mesh generation and accurate capture of boundary features, improving the accuracy and efficiency of simulation results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG BRAIN ENHANCE TECH CO LTD
- Filing Date
- 2026-04-16
- Publication Date
- 2026-07-31
AI Technical Summary
In existing finite element simulations of the brain, the mesh element size is too large to accurately capture the geometric features and physical field gradients of the boundary surface, resulting in discretization errors and affecting the accuracy and efficiency of the solution results.
A brain tetrahedral mesh is generated using a thickness field algorithm. Adaptive meshing is achieved by calculating the thickness field of each material, accurately capturing boundary geometric features and generating a sparse mesh, thus avoiding over-refinement.
It achieves the generation of fine tetrahedral meshes in boundary regions such as cerebrospinal fluid thin surfaces and gray matter grooves, eliminating topological pseudostructures and ensuring the accuracy of physical field properties and computational efficiency.
Smart Images

Figure CN122023729B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing technology, and in particular to a method, system, terminal, and medium for generating brain tetrahedral meshes based on a thickness field algorithm. Background Technology
[0002] In finite element method (FE) simulations of brain stimulation, the mesh generation and quality directly affect the accuracy and stability of subsequent finite element solutions. This is especially true in areas with complex topologies, such as the grooves between gray and white matter and the thin surfaces of cerebrospinal fluid between the skull and gray matter. The complexity and precision of these topologies pose significant challenges to the finite element solution, directly impacting the accuracy of the results. This problem arises from the inability of the mesh element size to accurately capture the geometric features and physical field gradients of the boundary surfaces, leading to discretization errors. Therefore, a mesh generation and optimization algorithm that adapts to boundary surfaces is essential.
[0003] Previous methods for addressing this problem primarily relied on global uniform refinement and indiscriminate local smoothing. However, this approach lacked an understanding of the physical field gradient characteristics, leading to excessive refinement in regions with gentle gradients, resulting in redundant accuracy and failing to reduce global errors. Furthermore, in regions with strong gradients at the boundaries, the excessive number of mesh elements increased the total number of degrees of freedom, causing poor convergence of the solution's errors. Additionally, this method resulted in excessive overhead in storing the stiffness matrix and high time costs in solving the problem.
[0004] Therefore, existing technologies still have shortcomings. Summary of the Invention
[0005] To address the aforementioned deficiencies in existing technologies, this invention provides a method, system, terminal, and medium for generating brain tetrahedral meshes based on a thickness field algorithm. The technical solution adopted by this invention is as follows: In a first aspect, the present invention provides a method for generating brain tetrahedral meshes based on a thickness field algorithm, the method comprising: Three-dimensional label data containing a five-layer physical model of the brain is obtained, and slice images and masked binary label images corresponding to different substances are extracted based on the three-dimensional label data. Each layer of the five-layer physical model corresponds to five substances, including: scalp, skull, cerebrospinal fluid, gray matter and white matter regions. Based on the sliced images and the masked binary label images of different materials, the thickness field is calculated to generate the tetrahedral size information of each material. The generated tetrahedral size information of each material is then input into the tetrahedral subdivision algorithm to obtain several subdivided tetrahedrons. For the several tetrahedrons after partitioning, calculate the probability value of each tetrahedron belonging to each substance in the five-layer physical model, and iterate through all tetrahedrons to select several target tetrahedrons. Based on the maximum probability value corresponding to each target tetrahedron, a tetrahedron label is obtained for each target tetrahedron, and the tetrahedron label is used to reflect the substance corresponding to the target tetrahedron; The number of different labels between each target tetrahedron and its corresponding domain tetrahedron is counted. The tetrahedron labels of each target tetrahedron are verified based on the number of different labels. After the verification is passed, the final labels of all tetrahedrons are bound to the geometric information of the tetrahedrons to obtain a tetrahedron mesh. The tetrahedron mesh is used by the finite element solver for simulation calculation.
[0006] In one implementation, thickness field calculation is performed based on the sliced image and the masked binary label images of different substances to generate tetrahedral size information for each substance, including: For each substance's masked binary label image, a skeleton extraction algorithm is used to extract the skeleton image from the slice image; The L2 distance transform algorithm is used to process the skeleton image to obtain the central diameter image of the slice image, and the shortest distance from each pixel to the corresponding tissue edge is obtained. Based on the shortest distance, the thickness value of each pixel is determined and updated. For each voxel, the thickness values in the X, Y, and Z axes are obtained respectively. The minimum of the three thickness values is taken as the final thickness value of the voxel, and the thickness field is obtained. After scaling and outlier truncation of the thickness field, a weighted average kernel of size 5 is used to perform convolution operations on the X, Y, and Z axes to smooth the thickness values with abrupt changes at the edges in the thickness field. The smoothed thickness field is scaled and outlier truncation is performed again to obtain the tetrahedral size information of each material.
[0007] In one implementation, determining and updating the thickness value of each pixel based on the shortest distance includes: Construct a circular range with each pixel as the center and the shortest distance as the radius, and initially set the thickness value of all pixels within the circular range to 0; Iterate through each pixel within the circular area. If the thickness value of a pixel is less than the thickness value of the center pixel, then update the thickness value of that pixel to the thickness value of the center pixel.
[0008] In one implementation, all tetrahedrons are iterated through, and a number of target tetrahedrons are selected, including: Get the self-label of each tetrahedron and the current label of the corresponding neighborhood tetrahedron, and compare the self-label of each tetrahedron with the current label of the corresponding neighborhood tetrahedron; Filter out tetrahedrons whose current label is different from their own label and which have more than one domain tetrahedron; If the self-label of the selected tetrahedron is different from the label of the substance corresponding to the calculated maximum probability value, then the selected tetrahedron will be used as the target tetrahedron. For each target tetrahedron, the number of differences between the target tetrahedron's own label and the current label of the corresponding neighborhood tetrahedron is counted to obtain a first quantity value.
[0009] In one implementation, the tetrahedron label for each target tetrahedron is obtained based on the maximum probability value corresponding to each target tetrahedron, including: Obtain the probability value of each substance in the five-layer physical model for each target tetrahedron, and determine the maximum probability value corresponding to each target tetrahedron; For each target tetrahedron, its own label is modified to the label corresponding to the substance with the highest probability value, thus obtaining the tetrahedron label for each target tetrahedron.
[0010] In one implementation, the number of distinct labels between each target tetrahedron and the neighborhood tetrahedron is counted, and the tetrahedron labels of each target tetrahedron are validated based on the number of distinct labels, including: For each target tetrahedron, count the number of differences between the tetrahedron label of the target tetrahedron and the current label of the corresponding domain tetrahedron to obtain the second count value; If the second quantity value is greater than the first quantity value, then the tetrahedral label of the target tetrahedron is withdrawn as its own label; If the second quantity value is less than or equal to the first quantity value, then retain the tetrahedral label of the target tetrahedron.
[0011] In one implementation, the method involves counting the number of distinct labels between each target tetrahedron and the neighborhood tetrahedron, and validating the tetrahedron label of each target tetrahedron based on the number of distinct labels. The method also includes: Obtain the third number of tetrahedral labels of the target tetrahedron and the fourth number of tetrahedral labels of the target tetrahedron that are withdrawn as their own labels; If the third quantity is equal to the fourth quantity, and the number of iterations exceeds the preset value, then exit the loop traversal step.
[0012] Secondly, embodiments of the present invention also provide a brain tetrahedral mesh generation system based on a thickness field algorithm, wherein the system is used to implement the steps of the brain tetrahedral mesh generation method based on a thickness field algorithm as described in any of the above-mentioned solutions, and the system includes: The label and image extraction module is used to acquire three-dimensional label data of a five-layer physical model in the brain, and extract slice images and masked binary label images corresponding to different substances based on the three-dimensional label data. Each layer of the five-layer physical model corresponds to five substances, including: scalp, skull, cerebrospinal fluid, gray matter and white matter regions. The thickness field calculation module is used to perform thickness field calculation based on the sliced image and the masked binary label images of different materials, generate tetrahedral size information for each material, and input the generated tetrahedral size information for each material into the tetrahedral subdivision algorithm to obtain several subdivided tetrahedrals. The tetrahedron filtering module is used to calculate the probability value of each tetrahedron belonging to each substance in the five-layer physical model for a number of tetrahedrons after subdivision, and to iterate through all tetrahedrons to filter out a number of target tetrahedrons. The label modification module is used to obtain a tetrahedral label for each target tetrahedron based on the maximum probability value corresponding to each target tetrahedron. The tetrahedral label is used to reflect the substance corresponding to the target tetrahedron. The tetrahedral mesh generation module is used to count the number of different labels between each target tetrahedron and its corresponding domain tetrahedron. Based on the different number of labels, the tetrahedral labels of each target tetrahedron are verified. After the verification is passed, the final labels of all tetrahedrons are bound to the geometric information of the tetrahedrons to obtain the tetrahedral mesh. The tetrahedral mesh is used by the finite element solver for simulation calculation.
[0013] Thirdly, embodiments of the present invention also provide a terminal, wherein the terminal includes a memory, a processor, and a brain tetrahedral mesh generation program based on a thickness field algorithm stored in the memory and executable on the processor. When the processor executes the brain tetrahedral mesh generation program based on a thickness field algorithm, it implements the steps of the brain tetrahedral mesh generation method based on a thickness field algorithm in any of the above-mentioned schemes.
[0014] Fourthly, embodiments of the present invention also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a brain tetrahedral mesh generation program based on a thickness field algorithm, the brain tetrahedral mesh generation program based on a thickness field algorithm implementing the steps of the brain tetrahedral mesh generation method based on a thickness field algorithm as described in any of the above schemes on the computer-readable storage medium.
[0015] Beneficial Effects: Compared with existing technologies, this invention provides a method for generating brain tetrahedral meshes based on a thickness field algorithm. First, three-dimensional label data of a five-layer physical model within the brain is acquired. Based on this data, slice images and masked binary label images corresponding to different substances are extracted. Each layer of the five-layer physical model corresponds to one of five substances: scalp, skull, cerebrospinal fluid, gray matter, and white matter. Next, thickness field calculations are performed on the slice images and the masked binary label images to generate tetrahedral size information for each substance. This tetrahedral size information is then input into a tetrahedral subdivision algorithm to obtain several subdivided tetrahedra. Then, for each subdivided tetrahedron, the probability value of each tetrahedron belonging to each substance in the five-layer physical model is calculated. All tetrahedra are iterated over to select several target tetrahedra. Finally, based on the maximum probability value corresponding to each target tetrahedron, a tetrahedral label is obtained for each target tetrahedron. This tetrahedral label reflects the substance corresponding to the target tetrahedron. Finally, the number of different labels between each target tetrahedron and its corresponding domain tetrahedron is counted. The tetrahedron labels of each target tetrahedron are verified based on the number of different labels. After the verification is passed, the final labels of all tetrahedrons are bound to the geometric information of the tetrahedrons to obtain a tetrahedron mesh. The tetrahedron mesh is used by the finite element solver for simulation calculation.
[0016] This invention achieves adaptive mesh generation for different anatomical structures of the brain through thickness field calculations of different materials. This facilitates the generation of fine tetrahedral meshes in boundary regions such as thin cerebrospinal fluid surfaces and gray matter grooves, accurately capturing boundary geometric features. Conversely, it generates sparse tetrahedral meshes in regions with gentle physical field gradients, such as within white matter, while avoiding redundant calculations caused by over-refinement. This invention also batch corrects obviously misdivided spike tetrahedrals, effectively eliminating topological pseudostructures in the mesh and ensuring the physical field properties at the interfaces between different materials. Attached Figure Description
[0017] Figure 1 This is a flowchart of a preferred embodiment of the brain tetrahedral mesh generation method based on the thickness field algorithm of the present invention.
[0018] Figure 2 The image shows a comparison of the effects of removing misclassified spike tetrahedrons after using the brain tetrahedron mesh generation method based on the thickness field algorithm according to the present invention.
[0019] Figure 3 The schematic diagram of the brain tetrahedral mesh generation system based on the thickness field algorithm provided in the embodiment of the present invention.
[0020] Figure 4 A schematic diagram of a terminal provided in an embodiment of the present invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0022] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content, operations, or steps, nor does it require execution in the described order. For example, some operations or steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0023] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0024] It should be understood that, in order to clearly describe the technical solutions of the embodiments of the present invention, the terms "first" and "second" are used in the embodiments of the present invention to distinguish identical or similar items with essentially the same function and effect. For example, "first control information" and "second control information" are only used to distinguish different control information and do not limit their order.
[0025] Those skilled in the art will understand that the words "first" and "second" do not limit the quantity or the order of execution, and that the words "first" and "second" do not necessarily imply that they are different.
[0026] It should also be understood that the term “and / or” as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0027] To address the problems of existing technologies, this invention provides a method for generating tetrahedral meshes of the brain based on a thickness field algorithm. The method in this embodiment achieves adaptive mesh subdivision of different anatomical structures of the brain through thickness field calculations for different substances. This facilitates the generation of fine tetrahedral meshes in boundary regions such as thin cerebrospinal fluid surfaces and gray matter grooves, accurately capturing boundary geometric features. It also generates sparse tetrahedral meshes in regions with gentle physical field gradients, such as within white matter, and avoids redundant calculations caused by over-refinement. In specific applications, this embodiment first acquires three-dimensional label data of a five-layer physical model within the brain. Based on this three-dimensional label data, slice images and masked binary label images corresponding to different substances are extracted. Each layer of the five-layer physical model corresponds to five substances: scalp, skull, cerebrospinal fluid, gray matter, and white matter. Next, thickness field calculations are performed based on the slice images and the masked binary label images of different substances to generate tetrahedral size information for each substance. This generated tetrahedral size information is then input into a tetrahedral subdivision algorithm to obtain several subdivided tetrahedra. Then, for the resulting tetrahedrons, the probability value of each tetrahedron belonging to each substance in the five-layer physical model is calculated, and all tetrahedrons are iterated through to select several target tetrahedrons. Next, based on the maximum probability value corresponding to each target tetrahedron, a tetrahedron label is obtained for each target tetrahedron. This tetrahedron label reflects the substance corresponding to the target tetrahedron. Finally, the number of different labels between each target tetrahedron and its corresponding neighborhood tetrahedron is counted. The tetrahedron label of each target tetrahedron is verified based on the number of different labels. After verification, based on the final labels of all tetrahedrons, they are bound to the geometric information of the tetrahedrons to obtain a tetrahedral mesh. This tetrahedral mesh is used for simulation calculations by the finite element solver. This invention batch corrects obviously misdivided spike tetrahedrons, effectively eliminates topological pseudostructures in the mesh, and ensures the physical field properties at the interfaces of different substances.
[0028] The brain tetrahedral mesh generation method based on the thickness field algorithm in this embodiment can be applied to terminals, such as computers, smart TVs, and other intelligent products and devices. Specifically, for example... Figure 1 As shown in the figure, the brain tetrahedral mesh generation method based on the thickness field algorithm in this embodiment includes the following steps: Step S100: Obtain three-dimensional label data of a five-layer physical model in the brain, and extract slice images and masked binary label images corresponding to different substances based on the three-dimensional label data. Each layer in the five-layer physical model corresponds to five substances, including: scalp, skull, cerebrospinal fluid, gray matter and white matter regions.
[0029] This step is the foundational data preparation stage for the entire technical solution. Through medical image segmentation and image processing, it facilitates the acquisition of partition data of the five layers of brain matter and the two-dimensional slice data required for subsequent thickness field calculations. Specifically, this embodiment first uses a convolutional neural network segmentation algorithm based on 3DU-Net to segment brain magnetic resonance imaging (MRI) or computed tomography (CT) images, obtaining three-dimensional labeled data of the brain with a five-layer physical model. The specific parameters of the 3DU-Net convolutional neural network segmentation algorithm are: input image size 128×128×128 voxels, convolution kernel size 3×3×3, pooling kernel size 2×2×2, activation function ReLU, and output layer using softmax normalization. In the final output three-dimensional labeled data, each voxel corresponds to an integer label value, and the label value corresponds one-to-one with the matter in the five-layer physical model. For example, label 1 = scalp, label 2 = skull, label 3 = cerebrospinal fluid, label 4 = gray matter, and label 5 = white matter. The voxel resolution of the three-dimensional label data is 0.5×0.5×0.5mm, covering the entire anatomical region of the brain, with no missing parts and no artifacts, providing a precise basis for subsequent material partitioning processing.
[0030] Next, this embodiment sequentially extracts slice images along the X, Y, and Z axes, and extracts mask binary label images corresponding to five different substances according to the five-layer model. Specifically, based on the above-mentioned three-dimensional label data, this embodiment extracts slice images sequentially along the X, Y, and Z axes with a step size of 1 voxel and without overlap. When slicing along the X axis, the x value is fixed, and y and z are traversed to obtain a slice image with dimensions of Ymax × Zmax pixels. When slicing along the Y axis, the y value is fixed, and x and z are traversed to obtain a slice image with dimensions of Xmax × Zmax pixels. When slicing along the Z axis, the z value is fixed, and x and y are traversed to obtain a slice image with dimensions of Xmax × Ymax pixels; where Xmax, Ymax, and Zmax are the maximum voxel indices of the brain three-dimensional label data along the three axes, and the pixel resolution of the slice image is consistent with the voxel resolution, which is 0.5 × 0.5 mm. In this embodiment, for each extracted 2D slice image, a corresponding masked binary label image is generated for each substance based on the label values of the five-layer physical model. The generation process uses Otsu's method (maximum inter-class variance method) for binarization optimization. Specifically, the pixel value corresponding to the target substance is set to 1 (indicating that the pixel is the target substance region); the pixel value corresponding to non-target substances is set to 0 (indicating that the pixel is the background region). This embodiment ultimately obtains five classes of masked binary label images with the same number and dimensions as the slice images (one class each for scalp, skull, cerebrospinal fluid, gray matter, and white matter). Each class of masked binary label images only identifies the region of the corresponding substance, achieving complete separation of different substances and providing a foundation for subsequent independent calculation of the thickness field for each substance.
[0031] Step S200: Based on the sliced image and the masked binary label images of different materials, perform thickness field calculation to generate tetrahedral size information for each material, and input the generated tetrahedral size information for each material into the tetrahedral subdivision algorithm to obtain several subdivided tetrahedrons.
[0032] This step is one of the core innovative aspects of this invention. Through material-specific, multi-axial, and refined thickness field calculations, tetrahedral size information (i.e., size field) adapted to the anatomical features of each material is generated, achieving the adaptive mesh subdivision goal of "fine boundaries and sparse interior". This step performs a complete thickness field calculation process for each of the five material layers one by one, ensuring that the thickness field of each material is adapted to its own anatomical structure (such as the thin surface of cerebrospinal fluid, gray matter grooves, and white matter interior). In this embodiment, for the masked binary label image of each material, a skeleton extraction algorithm is used to extract the skeleton image from the slice image. Then, the L2 distance transform algorithm is used to process the skeleton image to obtain the central diameter image of the slice image, and the shortest distance from each pixel to the corresponding tissue edge is obtained. Based on the shortest distance, the thickness value of each pixel is updated. Specifically, a circular range is constructed with each pixel as the center and the shortest distance as the radius. Initially, the thickness value of all pixels within the circular range is set to 0. Each pixel within the circular range is traversed. If the thickness value of a pixel is less than the thickness value of the center pixel, the thickness value of that pixel is updated to the thickness value of the center pixel. Next, for each voxel, the thickness values along the X, Y, and Z axes are obtained. The minimum of the three thickness values is taken as the final thickness value of the voxel, resulting in a thickness field. Then, the thickness field is scaled and truncated for outliers. A weighted average kernel of size 5 is then used to perform convolution operations along the X, Y, and Z axes to smooth thickness values with abrupt changes at the edges. Finally, the smoothed thickness field is scaled and truncated for outliers again to obtain the tetrahedral size information for each material.
[0033] In practical applications, this embodiment first performs skeleton extraction and central tube diameter calculation. Specifically, for all masked binary label images of a certain material, the following operations are performed image by image: (1) Skeleton extraction: The skeleton extraction algorithm is refined by distance transformation to extract the skeleton image of the target material in the slice. The specific steps are as follows: L2 distance transformation is performed on the mask binary label image to obtain the Euclidean distance from each pixel to the background; based on the distance value, continuous erosion is performed from the edge of the material to the center, and only the pixel with the largest distance value (i.e. skeleton point) is retained; connectivity detection is performed on the eroded image to remove isolated pseudo skeleton points and obtain a continuous and complete one-dimensional skeleton image. The skeleton image is a binary image, with skeleton points being 1 and background being 0.
[0034] (2) Calculation of the central tube diameter: The L2 distance transformation algorithm is applied again to the skeleton image to calculate the shortest Euclidean distance r from each skeleton point and surrounding pixel to the edge of the target material, thus obtaining the central tube diameter image. The specific calculation formula for the L2 distance transformation is as follows:
[0035] in, The current pixel coordinates, The pixel coordinates of the target material's edge. The unit is mm, consistent with the pixel resolution. In the central axis tube diameter image, the value of each pixel is the shortest distance from that point to the edge of the material, reflecting the effective radial range of the material at that location, providing core parameters for subsequent thickness calculations.
[0036] Furthermore, based on the aforementioned central tube diameter image, this embodiment initializes and updates the thickness value of each pixel. All thickness values are stored using 32-bit floating-point type to ensure calculation accuracy. The specific steps are as follows: Step 1, Initialize thickness values: Create a floating-point array of thickness values with the same dimensions as the central tube diameter image, and set the initial thickness value of all pixels to 0.0mm; Step 2, update the thickness value of the circular range: construct a circular neighborhood range with each pixel as the center and the central diameter value r of the pixel as the radius. Use the eight-neighbor traversal method to traverse all pixels within the circular range. The traversal rule is: if the Euclidean distance from a pixel to the center of the circle is ≤ r, then it is determined to be a pixel within the circular range. Step 3, Thickness Value Assignment Rules: During the traversal, if the current thickness value of a pixel within the circular area is less than the r value of the center pixel, then the thickness value of that pixel is updated to the r value of the center pixel; if it is greater than or equal to the r value, then the original thickness value remains unchanged. The core purpose of this step is to match the thickness value within the material region with the anatomical thickness of that region, ensuring that the thickness value of the boundary region is smaller and the thickness value of the inner region is larger.
[0037] Furthermore, after calculating the pixel thickness values of all slice images along the X, Y, and Z axes, the two-dimensional pixel thickness values are upgraded to three-dimensional voxel thickness values to achieve three-dimensional reconstruction of the thickness field. The specific steps are as follows: Step 1, Pixel-Voxel Coordinate Mapping: Establish the pixel coordinates of a 2D slice A one-to-one correspondence with the three-dimensional voxel coordinates (x, y, z) ensures that each voxel can accurately match its corresponding pixel in the slice along the X, Y, and Z axes; Step 2, Multi-axial thickness value extraction: For each voxel Extract the thickness value of the corresponding pixel in the slice along the X, Y, and Z axes, respectively, and denot it as... ; Step 3, determination of voxel thickness value: Take the minimum value in as the final thickness value of the voxel, that is
[0038] The design basis for taking the minimum value is: Ensure that the thickness value of the voxel does not exceed its anatomical thickness in any axial direction, and avoid overly rough subsequent mesh meshing due to an overly large thickness value in a single axial direction, which cannot capture boundary geometric features.
[0039] Step 4, construction of three-dimensional thickness field: Integrate the final thickness values of all voxels to obtain a three-dimensional thickness field array consistent with the dimension of the brain three-dimensional label data. The array dimension is Xmax×Ymax×Zmax, and each element is the thickness value of the corresponding voxel, with the unit of mm.
[0040] Furthermore, to eliminate outliers in the thickness field and ensure continuous transition of thickness values, perform scaling truncation and convolution smoothing on the above three-dimensional thickness field. This processing is performed separately for five layers of substances, and exclusive thresholds and parameters are set for each substance. The specific details are as follows: First, based on brain anatomical statistical data, set the lower threshold Tmin and upper threshold Tmax for the thickness value of each substance, and剔除extreme outliers in the thickness field. The specific threshold settings are shown in Table 1.
[0041] Table 1
[0042] The truncation rule is: If the voxel thickness value T < Tmin, set it to Tmin; if T > Tmax, set it to Tmax; if it is within the range of [Tmin, Tmax], keep the original value unchanged. After truncation, linearly scale the thickness field to map the thickness value to the general range of 0.1~25.0mm. The scaling formula is: . Where Tscale is the scaled thickness value and T is the truncated thickness value.
[0043] Use a 5×5×5 Gaussian weighted average kernel to perform three-dimensional convolution operations on the thickness field in the X, Y, and Z axial directions to smooth the thickness values with abrupt changes at the edges in the thickness field and ensure the spatial continuity of the thickness values. The weight distribution rule of the Gaussian weighted average kernel is: The weight of the central voxel is the largest (0.2), and the weights of the voxels towards the edges decrease sequentially (the weight of the edge voxel is 0.01), and the total weight is 1 to avoid overall offset of the thickness value after convolution. The specific implementation of the convolution operation is based on CUDA parallel computing, and the thread block size is set to 32×32×1, which greatly improves the convolution efficiency and avoids excessive computing time for three-dimensional convolution.
[0044] Furthermore, since the scalp surface is the outermost boundary of the brain, this embodiment requires a finer mesh to capture its anatomical features. Therefore, this embodiment performs a specific optimization on the scalp region using morphological algorithms combined with uniform assignment of surface voxel thickness values. The specific steps are as follows: Step 1, Scalp surface voxel localization: Using a 3×3×3 cubic structuring element, perform a morphological erosion operation on the scalp mask binary labeled image to obtain the mask image of the internal region of the scalp; calculate the difference image between the original scalp mask image and the eroded mask image, and the voxels with a difference of 1 are the scalp surface voxels (only the outermost 1~2 voxels are retained, which conforms to anatomical characteristics); Step 2, assigning surface voxel thickness values: uniformly set the thickness values of the above-mentioned scalp surface voxels to a fine value of 1.0~1.5mm (specifically 1.2mm). This value is much smaller than the thickness value of the voxels inside the scalp, ensuring that the mesh of the scalp surface is finer after subsequent subdivision. Step 3: Smooth transition between surface and interior layers: Construct a 3×3×3 local neighborhood centered on the voxels of the scalp surface layer, and perform a simple average of the voxel thickness values within the neighborhood to avoid abrupt changes in the thickness values of the surface and interior voxels, thus ensuring the continuity of the thickness field.
[0045] Furthermore, this embodiment also performs a second scaling and truncation on the thickness field after all the above processing, and converts it into tetrahedral size information (i.e., size field) that can be directly read by the mesh generation algorithm. The specific steps are as follows: Step 1, Second Scaling and Truncation: Set the tetrahedral target feature side length range [Smin, Smax] for each material, where Smin is the minimum side length and Smax is the maximum side length. Linearly map the thickness field value to this range to achieve accurate conversion from thickness value to tetrahedral size. The specific mapping rules are shown in Table 2. Table 2
[0046] The formula for linear mapping is: , where S is the average feature side length of the tetrahedral target, and T is the smoothed voxel thickness value.
[0047] Step 2, Size Field Construction: Integrate the mapped tetrahedral size values to obtain a three-dimensional size field array. This array is completely consistent with the dimensions of the brain's three-dimensional label data and thickness field array. The value of each voxel is the target average feature side length of the tetrahedron in that region, which is the core input of the mesh subdivision algorithm. Step 3, Data Output: Output the size field array in VTK (Visualization Tool Kit) mesh data format, along with a masked binary label image of the five material layers, to ensure that the mesh generation algorithm can adaptively generate meshes based on the size field and match the material regions.
[0048] After obtaining the tetrahedron size information, this embodiment inputs the generated size field and mask data into the Delaunay triangulation algorithm. Delaunay triangulation is a widely used triangulation method in computational geometry, whose core characteristic is maximizing the minimum angle, thereby generating a triangular mesh with optimal shape quality. This embodiment allows setting triangulation constraint parameters: minimum tetrahedron angle ≥ 20°, and maximum volume determined by the size field value (formula: volume V = (4 / 3)π(S / 2)). 3 The brain's three-dimensional space is tetrahedralized, resulting in several tetrahedrons. At this point, the tetrahedrons only have spatial geometric information (vertex coordinates, face index, neighborhood relations) and have not yet been assigned material labels. They are recorded as bare meshes, and each tetrahedron is assigned a unique integer index ID.
[0049] Step S300: For the several tetrahedrons after subdivision, calculate the probability value of each tetrahedron belonging to each substance in the five-layer physical model, and iterate through all tetrahedrons to select several target tetrahedrons.
[0050] This step is the correction stage for spiked tetrahedra. Based on CUDA-accelerated trilinear interpolation, the material assignment probability of the tetrahedra is calculated. Through global traversal, batch filtering, and label verification, obvious and large-area misclassified spiked tetrahedra are removed from the mesh, resulting in a tetrahedral mesh. All calculations in this step are based on GPU parallel computing, and batch processing is performed on the unique index ID of the tetrahedra, significantly improving computational efficiency.
[0051] Specifically, this embodiment first uses the three-dimensional label data of the five-layer physical model of the brain and a CUDA-accelerated trilinear interpolation algorithm to calculate the probability value of each tetrahedron belonging to the scalp, skull, cerebrospinal fluid, gray matter, and white matter. The specific steps are as follows: 1. Tetrahedral centroid calculation: For each tetrahedron, calculate its geometric centroid coordinates. The coordinates of the centroid are the average of the coordinates of the four vertices of the tetrahedron, that is:
[0052] in, For the tetrahedron The three-dimensional coordinates of each vertex.
[0053] 2. Trilinear interpolation weight calculation: Map the coordinates of the tetrahedron centroid to the voxel coordinate system of the brain 3D label data, find the voxel where the centroid is located and its 8 neighboring voxels, calculate the relative coordinates (dx, dy, dz) of the centroid in the voxel, and obtain the interpolation weights of the 8 neighboring voxels. The total weight is 1.
[0054] 3. Probability Value Calculation: Based on interpolation weights, the label values of the 8 neighboring voxels are weighted and summed to obtain the original probability values of the tetrahedron belonging to the five substances. The softmax normalization algorithm is then used to normalize the original probability values, ensuring that the sum of the probability values of the five substances is 1. The normalization formula is:
[0055] in, The tetrahedron belongs to the first The normalized probability value of a substance. For the first The original probability value of a substance. =1,2,3,4,5 correspond to the scalp, skull, cerebrospinal fluid, gray matter, and white matter, respectively. For the first The original probability value of a substance.
[0056] 4. Determining the maximum probability value: For each tetrahedron, extract the maximum probability value among the probability values of its belonging to the five substances. And record the label corresponding to the substance with the highest probability value, denoted as probability label Lp.
[0057] To quickly count the number of neighboring label differences for each tetrahedron, this embodiment constructs a tetrahedron adjacency table based on the face-sharing topology of tetrahedrons. For each tetrahedron, this embodiment extracts the vertex indices of its four triangular faces, and each face is recorded as a unique face identifier; it iterates through all the face identifiers of tetrahedrons, and if two tetrahedrons share the same face identifier, they are determined to be neighboring tetrahedrons; a hash table, i.e., the adjacency table, is created with the tetrahedron ID as the key and the list of neighboring tetrahedron IDs as the value. Through this adjacency table, all neighboring tetrahedrons of any tetrahedron can be queried in O(1) time complexity, greatly improving the efficiency of subsequent label difference statistics. In this embodiment, the number of neighboring tetrahedrons of a single tetrahedron is 3 to 6, which conforms to the topological characteristics of a tetrahedral mesh.
[0058] Further, in this embodiment, the self-label of each tetrahedron and the current label of the corresponding neighborhood tetrahedron are obtained, and the self-label of each tetrahedron is compared with the current label of the corresponding neighborhood tetrahedron. Then, tetrahedrons whose current label of more than one neighborhood tetrahedron is different from their self-label are selected. If the self-label of the selected tetrahedron is different from the label of the substance corresponding to the calculated maximum probability value, the selected tetrahedron is taken as the target tetrahedron. Next, for each target tetrahedron, the number of times the self-label of the target tetrahedron is different from the current label of the corresponding neighborhood tetrahedron is counted to obtain a first quantity value n1.
[0059] In specific implementation, this embodiment assigns the initial self-label Ls of each tetrahedron to the material label of the voxel containing its centroid. If the centroid spans multiple material regions, the material label with the largest proportion is assigned. Next, a first round of filtering is performed: the adjacency list is traversed to filter tetrahedrons with more than one neighboring tetrahedron whose self-label differs from the tetrahedron's, i.e., tetrahedrons with a neighboring label difference of ≥2. Then, a second round of filtering is performed: for the tetrahedrons selected in the first round, tetrahedrons whose self-label Ls differs from the probability label Lp are further filtered out; these tetrahedrons are the target tetrahedrons. For each target tetrahedron, the number of times its self-label differs from all neighboring tetrahedron labels is counted, denoted as the first quantity value n1, and n1 is bound and stored with the target tetrahedron ID.
[0060] Step S400: Based on the maximum probability value corresponding to each target tetrahedron, obtain the tetrahedron label for each target tetrahedron. The tetrahedron label is used to reflect the substance corresponding to the target tetrahedron.
[0061] In this embodiment, batch label updates are performed on all selected target tetrahedra. Specifically, the probability value of each target tetrahedron belonging to each substance in the five-layer physical model is obtained, and the maximum probability value corresponding to each target tetrahedron is determined. Then, for each target tetrahedron, its own label Ls is modified to the label corresponding to the substance with the maximum probability value, that is, Ls is modified to Lp, resulting in the tetrahedron label Lnew for each target tetrahedron.
[0062] Step S500: Count the number of different labels between each target tetrahedron and the corresponding domain tetrahedron. Verify the tetrahedron label of each target tetrahedron based on the number of different labels. After the verification is passed, bind the final labels of all tetrahedrons with the geometric information of the tetrahedrons to obtain the tetrahedron mesh. The tetrahedron mesh is used by the finite element solver for simulation calculation.
[0063] Furthermore, to avoid exacerbating tag conflicts with neighboring tags due to tag modifications, the updated tetrahedral tags are validated, and a decision is made based on the validation results to retain or withdraw them. This embodiment can, for each target tetrahedron, count the number of differences between the target tetrahedron's tetrahedron tag and the current tag of the corresponding neighboring tetrahedron to obtain a second quantity value; if the second quantity value is greater than the first quantity value, the target tetrahedron's tetrahedron tag is withdrawn as its own tag; if the second quantity value is less than or equal to the first quantity value, the target tetrahedron's tetrahedron tag is retained. This embodiment can also obtain a third quantity of retained target tetrahedron tags and a fourth quantity of target tetrahedron tags withdrawn as their own tags; if the third and fourth quantities are equal, and the number of iterations exceeds a preset value, the iteration step is exited.
[0064] In practical application, this embodiment calculates the number of times the updated tetrahedron label Lnew differs from the labels of all neighboring tetrahedrons based on the adjacency list for each updated target tetrahedron, and records this number as the second quantity value n2. If n2 > n1, it means that after the label modification, the label conflict between the tetrahedron and its neighbors has intensified, so the label modification is withdrawn and the original label Ls is restored. If n2 ≤ n1, it means that after the label modification, the consistency between the tetrahedron and its neighbors has improved, so the updated tetrahedron label Lnew is retained.
[0065] In the iterative loop of this embodiment, each loop executes "global traversal filtering → label update → verification → result statistics" until the algorithm converges or reaches the preset number of loops. The specific convergence judgment rule is as follows: initialize the loop counter k=0, and k=k+1 after each loop. If the third quantity N3 and the fourth quantity N4 of this loop are equal, it means that the effectiveness and inefficiency of label modification are equal, the algorithm has reached the convergence state, and there is no need to continue iterating; if the loop counter k≥20 (the preset maximum number of loops), it means that the algorithm has completed most of the label correction, and there is no significant benefit to continue iterating, so the loop is forcibly exited; if the above two convergence conditions are not met, the next round of looping is continued.
[0066] After convergence, this embodiment binds the final labels of all tetrahedrons (the target tetrahedron uses the verified label, and the non-target tetrahedrons use their initial self-label) with the geometric information of the tetrahedrons to obtain a tetrahedral mesh. The tetrahedral mesh is used by the finite element solver for simulation calculations.
[0067] Furthermore, the tetrahedral mesh obtained based on the above steps is a preliminary tetrahedral mesh, which has removed most of the obvious spiked tetrahedra, thus making the generated tetrahedral mesh smooth. This embodiment can also provide a fine-tuning stage for spiked tetrahedra. For the remaining edges and slightly misclassified spiked tetrahedra in the preliminary tetrahedral mesh, based on neighborhood label count statistics, differential label updates, and label stability verification, the spiked tetrahedra are completely removed, ensuring that the labels do not fluctuate repeatedly, and finally generating a high-quality brain tetrahedral mesh with a consistent topology. This step is also based on GPU parallel computing, and the specific implementation details for batch processing of tetrahedral IDs are as follows: This embodiment first uses the initial tetrahedral mesh label data and adjacency list to globally traverse all tetrahedra. For each tetrahedron, the number of neighboring tetrahedra with different labels is counted based on the adjacency list, denoted as N, where N ranges from 0 to 6. Next, a first buffer space, buffer1, is created. This buffer is a hash table structure, with the tetrahedron ID as the key and the current label value as the value. All tetrahedron IDs and their current label values are stored in buffer1 as baseline data for subsequent stability verification. In this step, only tetrahedra with N ≥ 2 undergo subsequent label updates. Tetrahedra with N = 0 (all neighboring labels are the same as their own) or N = 1 (only one neighboring label is different, representing a normal interface transition) are considered normal tetrahedra, and their current labels are directly retained without any modification.
[0068] Specifically, when performing differentiated label updates, this embodiment targets tetrahedrons with N≥2 and executes differentiated label update rules based on the specific value of N to ensure the accuracy and rationality of label updates. The specific rules are as follows: If N=4 for a certain tetrahedron, it means that the labels of its four neighboring tetrahedrons are significantly different from its own, and it is a typical spiked tetrahedron. The update rule is as follows: extract the labels of the four neighboring tetrahedrons of the tetrahedron based on the adjacency list; use dictionary statistics to count the frequency of the four labels, find the label with the highest frequency (denoted as the first label L1); and then directly update the current label of the tetrahedron to the first label L1.
[0069] If N=3 for a given tetrahedron, the update rule is as follows: Extract the labels of the three neighboring tetrahedrons based on the adjacency list; count the frequency of the three labels, and find the label with the highest frequency and a repetition count greater than 1 (denoted as the second label L2). Update the current label of the tetrahedron to the second label L2. The design of "repetition count greater than 1" in this rule avoids erroneous updates caused by all neighboring labels having different values, ensuring the reliability of label updates.
[0070] If N=2 for a certain tetrahedron, the most refined spike tetrahedron determination and update needs to be combined with neighborhood label consistency and singular node detection. The update rule is: extract the labels of the two neighboring tetrahedrons that are different from the tetrahedron's own label based on the adjacency list, and denoted as La and Lb; if La=Lb: it means that the neighborhood labels are inconsistent, the current label is not modified, and the original label is retained; if La=Lb: perform the following singular node detection steps: (1) extract the two vertices that the two neighboring tetrahedrons share (obtain the intersection based on the tetrahedron vertex index array to get two common vertices V1 and V2); (2) singular node detection: calculate the number of neighboring tetrahedrons and curvature value of the vertex and the vertices respectively. If any one of the vertices is a singular node (the number of neighboring tetrahedrons > 8 or the curvature value > 1.5 rad / mm), then update the current label of the tetrahedron to La (or Lb, the two are consistent); if neither is a singular node, the current label is not modified. The design of this rule is based on the fact that the mesh topology at singular nodes is prone to distortion and can easily generate spike tetrahedrons, which need to be eliminated by updating the labels.
[0071] Furthermore, to prevent the tetrahedral labels at the interface from switching meaninglessly and repeatedly during the loop (label oscillation), the stability of the labels modified in this loop is checked, and stable labels are locked. The specific steps are as follows: Second cache space construction: Create a second cache space buffer2, which has the same hash table structure as buffer1. Store the tetrahedron IDs whose tags have been modified in this loop and the updated tag values into buffer2; unmodified tetrahedrons are not included in the cache. Full cache comparison: Perform a two-level full comparison between buffer2 and buffer1 from the previous loop. First-level comparison: Whether the tetrahedron ID set is completely consistent, that is, whether the two rounds of loops modify the same batch of tetrahedrons; The second layer of comparison: whether the label value corresponding to each ID is completely consistent, that is, whether the same tetrahedron is modified to the same label value in the two rounds of loop; Stable label locking: If both comparisons above are satisfied (buffer2 and buffer1 are completely identical), it means that the labels of this batch of tetrahedrons have entered an oscillation state. In all subsequent loops, no further label modifications will be made to this batch of tetrahedrons, and their current label values will be locked directly. If the comparison is not satisfied, it means that the label modification is still iterating in a reasonable direction, and the next loop will continue to be executed. Cache update: Use buffer2 from the current loop as buffer1 for the next loop to provide a benchmark for the next round of stability verification.
[0072] In the iterative loop of this embodiment, each loop executes "N value calculation → differential label update → stability verification → cache update", with a preset maximum number of loops of 12. When the number of loops reaches 12, the loop immediately exits and outputs the final label value of all tetrahedra. This label value perfectly matches the material region of the tetrahedron, with no misclassification or oscillation.
[0073] Finally, this embodiment permanently binds the geometric information (vertex coordinates, face indices, neighborhood relations) of all the subdivided tetrahedrons to the final output label values, completing the complete removal of the spiked tetrahedrons and ultimately generating a brain tetrahedral mesh based on the thickness field algorithm. Figure 2 As shown, Figure 2 Comparison of the effects of removing misdivided spiked tetrahedrons. Figure 2 In the left image, the blue area represents the gray surface spike tetrahedrons. Figure 2 The right image shows the effect after removing the spikes from all four sides.
[0074] The brain tetrahedral mesh of this embodiment has the following core features: Adaptive partitioning: The tetrahedrons in the boundary regions of cerebrospinal fluid thin surface, gray matter grooves, and scalp surface are small in size and high in density, accurately capturing geometric features; the tetrahedrons in the white matter interior and skull interior are large in size and low in density, avoiding redundant calculations. Consistent topological structure: no spiked tetrahedrons, no deformed units, smooth and continuous interfaces between different substances, consistent with brain anatomy. Precise and continuous labeling: The label of each tetrahedron is perfectly matched with the material region, and the label transition at the interface is continuous, with no misclassification or oscillation; Continuous physical properties: Based on the tags, corresponding physical properties (density, electrical conductivity, elastic modulus, etc.) can be directly assigned to each tetrahedron. There are no local discontinuities in the physical field properties, avoiding numerical solution anomalies.
[0075] The final brain tetrahedral mesh is stored in the VTK general finite element format and can be directly input into the finite element solver for simulation calculations of physical fields such as electrical stimulation, biomechanics, and heat conduction of the brain.
[0076] Therefore, this invention, through the calculation of the thickness field and the use of strategic algorithms to remove spiked tetrahedrons, can generate a fine tetrahedral mesh at the boundary surface, while appropriately reducing the number and size of tetrahedrons at the mesh center. Furthermore, two strategic algorithms are used to effectively remove misaligned spiked tetrahedrons generated by mesh generation. While ensuring the stability and accuracy of subsequent finite element solutions, this invention also effectively reduces the degrees of freedom of the solution system, thereby reducing computational storage and costs.
[0077] Based on the above embodiments, the present invention also provides a brain tetrahedral mesh generation system based on a thickness field algorithm, the system being used to implement the steps of the above method embodiments. Specifically, as Figure 3 As shown, the system in this embodiment includes: a label and image extraction module 10, a thickness field calculation module 20, a tetrahedron filtering module 30, a label modification module 40, and a tetrahedron mesh generation module 50. The label and image extraction module 10 is used to acquire three-dimensional label data of a five-layer physical model within the brain, and extract slice images and masked binary label images corresponding to different substances based on the three-dimensional label data. Each layer of the five-layer physical model corresponds to five substances: scalp, skull, cerebrospinal fluid, gray matter, and white matter regions. The thickness field calculation module 20 is used to perform thickness field calculations based on the slice images and the masked binary label images of different substances, generating tetrahedron size information for each substance, and inputting the generated tetrahedron size information for each substance into a tetrahedron subdivision algorithm to obtain several subdivided tetrahedra. The tetrahedron filtering module 30 is used to calculate the probability value of each tetrahedron belonging to each substance in the five-layer physical model for the subdivided tetrahedra, and iterate through all tetrahedra to filter out several target tetrahedra. The label modification module 40 is used to obtain a tetrahedral label for each target tetrahedron based on the maximum probability value corresponding to each target tetrahedron. The tetrahedral label reflects the material corresponding to the target tetrahedron. The tetrahedral mesh generation module 50 is used to count the number of different labels between each target tetrahedron and its corresponding neighborhood tetrahedron. Based on the different number of labels, the tetrahedral label of each target tetrahedron is verified. After verification, based on the final labels of all tetrahedrons, the tetrahedral mesh is bound to the geometric information of the tetrahedrons to obtain a tetrahedral mesh. The tetrahedral mesh is used by the finite element solver for simulation calculations.
[0078] The principle of each module in the brain tetrahedral mesh generation system based on the thickness field algorithm in this embodiment is the same as that of each step in the above method embodiment, and will not be elaborated further here.
[0079] Based on the above embodiments, the present invention also provides a terminal, the principle block diagram of which can be as follows: Figure 4 As shown. The terminal may include one or more processors 100 ( Figure 4(Only one is shown in the image), memory 101, and computer program 102 stored in memory 101 and executable on one or more processors 100. For example, a brain tetrahedral mesh generation program based on a thickness field algorithm. When one or more processors 100 execute computer program 102, they can implement the various steps in the embodiment of the brain tetrahedral mesh generation method based on a thickness field algorithm. Alternatively, when one or more processors 100 execute computer program 102, they can implement the functions of various modules / units in the embodiment of the brain tetrahedral mesh generation system based on a thickness field algorithm, which is not limited here.
[0080] In one embodiment, the processor 100 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0081] In one embodiment, memory 101 may be an internal storage unit of an electronic device, such as a hard drive or RAM. Memory 101 may also be an external storage device of the electronic device, such as a plug-in hard drive, smart media card (SM), secure digital card (SD), flash card, etc. Furthermore, memory 101 may include both internal and external storage units. Memory 101 is used to store computer programs and other programs and data required by the terminal. Memory 101 can also be used to temporarily store data that has been output or will be output.
[0082] Those skilled in the art will understand that Figure 4 The block diagram shown is merely a partial structural diagram related to the present invention and does not constitute a limitation on the terminal to which the present invention is applied. A specific terminal may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0083] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), direct memory bus RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0084] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating a brain tetrahedral mesh based on a thickness field algorithm, characterized in that, The method includes: Three-dimensional label data containing a five-layer physical model of the brain is obtained, and slice images and masked binary label images corresponding to different substances are extracted based on the three-dimensional label data. Each layer of the five-layer physical model corresponds to five substances, including: scalp, skull, cerebrospinal fluid, gray matter and white matter regions. Based on the sliced images and the masked binary label images of different materials, the thickness field is calculated to generate the tetrahedral size information of each material. The generated tetrahedral size information of each material is then input into the tetrahedral subdivision algorithm to obtain several subdivided tetrahedrons. For the several tetrahedrons after partitioning, calculate the probability value of each tetrahedron belonging to each substance in the five-layer physical model, and iterate through all tetrahedrons to select several target tetrahedrons. Based on the maximum probability value corresponding to each target tetrahedron, a tetrahedron label is obtained for each target tetrahedron, and the tetrahedron label is used to reflect the substance corresponding to the target tetrahedron; The number of different labels between each target tetrahedron and its corresponding neighboring tetrahedrons is counted. The tetrahedron labels of each target tetrahedron are verified based on the number of different labels. After the verification is passed, the final labels of all tetrahedrons are bound to the geometric information of the tetrahedrons to obtain a tetrahedron mesh. The tetrahedron mesh is used by the finite element solver for simulation calculation. Iterate through all tetrahedrons and select a number of target tetrahedrons, including: Get the self-label of each tetrahedron and the current label of the corresponding neighboring tetrahedrons, and compare the self-label of each tetrahedron with the current label of the corresponding neighboring tetrahedrons; Filter out tetrahedrons whose current label is different from their own label because they have more than one neighboring tetrahedron; If the self-label of the selected tetrahedron is different from the label of the substance corresponding to the calculated maximum probability value, then the selected tetrahedron will be used as the target tetrahedron. For each target tetrahedron, the number of differences between the target tetrahedron's own label and the current label of its corresponding neighboring tetrahedrons is counted to obtain a first quantity value.
2. The method of claim 1, wherein, Based on the sliced images and the masked binary label images of different materials, thickness field calculations are performed to generate tetrahedral size information for each material, including: For each substance's masked binary label image, a skeleton extraction algorithm is used to extract the skeleton image from the slice image; The L2 distance transform algorithm is used to process the skeleton image to obtain the central diameter image of the slice image, and the shortest distance from each pixel to the corresponding tissue edge is obtained. Based on the shortest distance, the thickness value of each pixel is determined and updated. For each voxel, the thickness values in the X, Y, and Z axes are obtained respectively. The minimum of the three thickness values is taken as the final thickness value of the voxel, and the thickness field is obtained. After scaling and outlier truncation of the thickness field, a weighted average kernel of size 5 is used to perform convolution operations on the X, Y, and Z axes to smooth the thickness values with abrupt changes at the edges in the thickness field. The smoothed thickness field is scaled and outlier truncation is performed again to obtain the tetrahedral size information of each material.
3. The method of claim 2, wherein, Based on the shortest distance, determine and update the thickness value for each pixel, including: Construct a circular range with each pixel as the center and the shortest distance as the radius, and initially set the thickness value of all pixels within the circular range to 0; Iterate through each pixel within the circular area. If the thickness value of a pixel is less than the thickness value of the center pixel, then update the thickness value of that pixel to the thickness value of the center pixel.
4. The method of claim 1, wherein, Based on the maximum probability value corresponding to each target tetrahedron, the tetrahedron label for each target tetrahedron is obtained, including: Obtain the probability value of each substance in the five-layer physical model for each target tetrahedron, and determine the maximum probability value corresponding to each target tetrahedron; For each target tetrahedron, its own label is modified to the label corresponding to the substance with the highest probability value, thus obtaining the tetrahedron label for each target tetrahedron.
5. The method of claim 4, wherein, The number of distinct labels between each target tetrahedron and its neighboring tetrahedrons is counted. Based on this number of distinct labels, the tetrahedron labels of each target tetrahedron are validated, including: For each target tetrahedron, the number of different labels between the tetrahedron label of the target tetrahedron and the current label of its corresponding neighboring tetrahedrons is counted to obtain the second count value; If the second quantity value is greater than the first quantity value, then the tetrahedral label of the target tetrahedron is withdrawn as its own label; If the second quantity value is less than or equal to the first quantity value, then retain the tetrahedral label of the target tetrahedron.
6. The method of claim 4, wherein, The process involves counting the number of distinct labels between each target tetrahedron and its neighboring tetrahedrons, validating the tetrahedron labels of each target tetrahedron based on these distinct labels, and also includes: Obtain the third number of tetrahedral labels of the target tetrahedron and the fourth number of tetrahedral labels of the target tetrahedron that are withdrawn as their own labels; If the third quantity is equal to the fourth quantity, and the number of iterations exceeds the preset value, then exit the loop traversal step.
7. A brain tetrahedral mesh generation system based on thickness field algorithm, characterized in that, The system is used to implement the steps of the brain tetrahedral mesh generation method based on the thickness field algorithm according to any one of claims 1-6, and the system comprises: The label and image extraction module is used to acquire three-dimensional label data of a five-layer physical model in the brain, and extract slice images and masked binary label images corresponding to different substances based on the three-dimensional label data. Each layer of the five-layer physical model corresponds to five substances, including: scalp, skull, cerebrospinal fluid, gray matter and white matter regions. The thickness field calculation module is used to perform thickness field calculation based on the sliced image and the masked binary label images of different materials, generate tetrahedral size information for each material, and input the generated tetrahedral size information for each material into the tetrahedral subdivision algorithm to obtain several subdivided tetrahedrals. The tetrahedron filtering module is used to calculate the probability value of each tetrahedron belonging to each substance in the five-layer physical model for a number of tetrahedrons after subdivision, and to iterate through all tetrahedrons to filter out a number of target tetrahedrons. The label modification module is used to obtain a tetrahedral label for each target tetrahedron based on the maximum probability value corresponding to each target tetrahedron. The tetrahedral label is used to reflect the substance corresponding to the target tetrahedron. The tetrahedral mesh generation module is used to count the number of different labels between each target tetrahedron and its corresponding neighboring tetrahedrons. Based on the different number of labels, the tetrahedral labels of each target tetrahedron are verified. After the verification is passed, the final labels of all tetrahedrons are bound to the geometric information of the tetrahedrons to obtain the tetrahedral mesh. The tetrahedral mesh is used by the finite element solver for simulation calculation.
8. A terminal, characterized by comprising: The terminal includes a memory, a processor, and a brain tetrahedral mesh generation program based on a thickness field algorithm stored in the memory and executable on the processor. When the processor executes the brain tetrahedral mesh generation program based on a thickness field algorithm, it implements the steps of the brain tetrahedral mesh generation method based on a thickness field algorithm as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a brain tetrahedral mesh generation program based on a thickness field algorithm, the brain tetrahedral mesh generation program based on a thickness field algorithm implementing the steps of the brain tetrahedral mesh generation method based on a thickness field algorithm as described in any one of claims 1-6 on the computer-readable storage medium.