Mathematical model of human semicircular canal spatial attitude

Located deep in the temporal bone, the semicircular canal is a subtle structure that requires a spatial coordinate system for measurement and observation. In this study,Fifty-five semicircular canal and eyeball models were obtained by segmentation of MRI data. The spatial coordinate system was established by taking the top of the common crus and the bottom of eyeball as the horizontal plane. Firstly, the plane equation is calculated according to the centerline of the semicircular canals. Then, according to the parameters of the plane equation, the plane normal vectors are obtained. Finally, the average unit normal vector of each semicircular canal plane can be obtained by calculating the average value of the vectors. It is more intuitive and accurate to calculate the average normal vector of semicircular canal plane with the vector average method, which is different from the angular average method in different degrees. The mathematical model of semicircular canal spatial attitude established in this study is more reliable, which can guide the vestibular function examination, and also help guide the diagnosis and treatment of BPPV.


Introduction
The position and direction of semicircular canals in three-dimensional coordinate systems are very important for vestibular function examination and BPPV diagnosis and treatment. Because the semicircular canal is located in the deep part of the temporal bone, its structure is complicated and delicate, which makes it difficult to observe and measure directly. Moreover, it is necessary to establish a spatial coordinate system to measure the spatial direction of the semicircular canal, which makes it rare to study the spatial attitude of the semicircular canal. In addition, the reported data are often inconsistent 1,2,3,4 , often lack of reliable spatial coordinate system, and are limited to the study of semicircular canal morphology and the relative position relationship between the semicircular canal 5,6,7,8,9,10,11 . With the development of modern medical imaging and computer technology, the planar fitting and spatial posture measurement of semicircular canals based on 3D reconstruction technology have become the research focus of semicircular canal anatomy and morphology. Bradshaw studies the spatial posture of the semicircular canal through semi-automatic segmentation of semicircular canal, automatic extraction of semicircular canal centerline, and calculation of semicircular canal plane fitting equation. This method is more reliable than manual measurement reported in other literature, but its biggest disadvantage is that the head space coordinate system is not established. Because the plane equations of each semicircular canal are not in the standard spatial coordinate system, the application of the measurement results is limited 7 . The author explains that the reason why the head space coordinate system was not established is that it is difficult to determine the landmark positions needed for establishing the coordinate system, and the scanning range is insufficient, resulting in the omission of the landmark position. The commonly used three-dimensional coordinate systems include Frankfurt coordinate system 4,11 and Reid's coordinate system 3 . Frankfort horizontal is the plane passing through bilateral porions and the left orbitale.
Reid's plane is defined as the plane that passes through the center of each external auditory canal and the inferior margin of the two orbits 1,12 . It is more difficult to find bone markers on MRI images. Some studies have tried to use semicircular canals and eyeballs to establish a spatial coordinate system, and it is considered that the plane formed by the bifurcation of the common crus and the center of the eyeball is horizontal 13,14 . However, further studies have shown that the plane formed by the bifurcation of the common crus and the bottom of the eyeball is parallel to the Frankfurt plane 15 . In previous studies, the angle between the plane of the semicircular canal and the coordinate planes were calculated first, and then the average value of each angle was calculated. As a matter of fact, the spatial direction of the semicircular canal is determined by the normal vector of the semicircular canal. The coordinate value of the unit vector of the semicircular canal plane normal vector is equal to the cosine value of the direction angle. According to the rules of vector calculation, the average value of normal vectors in the semicircular canal plane should be the average value of the cosine of direction angle, not the average value of the direction angle. In this study, firstly, the spatial coordinate system is established through the semicircular canal and eyeball, then the plane equation is fitted according to the centerline of the semicircular canal and the normal vector is obtained. Finally, the mathematical model of the spatial posture of the human semicircular canal based on the average unit normal vector of each semicircular canal plane is established, which is convenient for vestibular research and application. Results

segmentation for semicircular canal and eyeball
The boundary between the eyeball and the surrounding tissues is clear, and the method based on threshold can quickly segment the eyeball. However, because the thresholds of the semicircular canal and cochlea are different, it is difficult to segment the inner ear based on the threshold method. The Segment Editor module of 3D slicer includes threshold segmentation function and provides a variety of automatic thresholds searching methods.
Automatic threshold searching methods, such as the Otsu method, can segment the semicircular canal, but the model surface is not smooth enough. To improve the segmentation result, the markers of segmentation results are expanded and extracted into the voxel model, and then transformed into the surface model by using the marching cubes function of the grayscale model maker, which makes the surface of the semicircular canal model smoother.  The superior intersection of the posterior semicircular canal and the superior semicircular canal is the top of the common corus (A), and then other key points D, C, B and E can be identified in turn.

Mathematical model of space attitude of semicircular canal
The average unit normal vector of each semicircular canal plane is obtained by calculating the sum of the normal vectors of 55 pairs of posterior semicircular canal plane, superior semicircular canal plane, and lateral semicircular canal plane (Fig.2). Because their spatial coordinates are the cosine values of the angles along X, Y, and Z axes of the standard spatial coordinate system, the angles between the semicircular canal plane and the corresponding sagittal plane, coronal plane, and horizontal plane can be calculated by using arccosine function (see Table 1). The unit normal vector of each semicircular plane is distributed on the circle with radius 1. For the convenience of observation, the radius is expanded to 100, the normal vectors of different semicircular canal planes are marked with different color points, and the average normal vectors are represented by arrows. The distribution and relationship of normal vectors of semicircular canal plane can be observed directly (Fig.3). The traditional method is to calculate the angle between the semicircular canal plane and the coordinate plane first, and then calculate the average value of the angle (see Table 2 When the data distribution is more concentrated, the results of vector averaging method and angular averaging method are similar; when the data distribution is more dispersed, the difference between the results of vector averaging method and angular averaging method will increase.

Discussions
The organ function is always precisely correlated with its anatomical features. However, unlike other organs, the study of semicircular canal function needs not only to understand the anatomical and morphological characteristics of the semicircular canal but also to understand its position and direction in three-dimensional space. In recent years, with the development of vertigo science, especially the need for diagnosis and treatment of BPPV, the knowledge of semicircular canal space posture is urgently needed.
In the past, the study of semicircular canal anatomy usually used cadavers, which was limited to anatomical morphology, and the spatial posture of the semicircular canal was not fully studied. In recent years, with the development of medical imaging, it is possible to obtain a semicircular canal model by segmenting temporal bone image data to study the anatomical morphology and spatial posture of the semicircular canal. The prerequisite for measuring the spatial orientation of the semicircular canal is to establish a spatial coordinate system. Commonly used three-dimensional spatial coordinate systems include the Frankfurt coordinate system 11 and Reid's coordinate system 3 , which is determined by bony points including the superior or midpoint of the auricle and the infra-orbital margin point. The study of the spatial posture of the semicircular canal has been limited by the lack of scan coverage that did not include the bony points, or by the difficulty of identifying the bony points on MRI scans, making it difficult to establish a spatial coordinate system. It is found that the plane formed by common crus bifurcation and eyeball bottom is parallel to the Frankfurt plane, which makes it possible to establish a spatial coordinate system through the semicircular canal and eyeball, and is especially suitable for the automatic construction of standard spatial coordinate systems 15, . To measure the spatial direction of semicircular canals, the plane of the semicircular canal needs to be obtained. There are different methods to establish the semicircular canal plane, including taking three coordinates at different positions of the semicircular canal, taking the semicircular canal bisector plane, and taking the semicircular canal centerline. Among them, the most scientific method is to automatically take the centerline of the semicircular canal to construct the semicircular canal plane 7, . Skeletonize's skeletonize function supports 3D image skeleton extraction, but the 3D Slicer software has a VMTK plug-in, which can call its vtkvmtkPolyDataCenterline function in python programming to get the centerline of the inner ear model, and can observe and analyze it in the 3D Slicer software.
Traditionally, different studies on measuring the spatial direction of the semicircular canal always calculate the angles between each semicircular canal and the sagittal plane, coronal plane, and cross-sectional plane, and then take the average value of the angles in each coordinate plane as the spatial direction of the semicircular canal (Table 2) Set the unit normal vector of the semicircular canal based on averaging angles to be nu ⃗⃗⃗⃗ then Where n is the number of semicircular canal planes, α i , β i , γ i is the direction angle of the ith semicircular canal, and I, j, k are coordinate unit vectors. The correctness of this method needs further discussion and verification. According to the dihedral angle principle, the angle between the two planes is equal to the angle between the normal vectors or the complementary angle of the included angle. In this way, the spatial direction measurement of the semicircular canal can be transformed into the problem of its normal vector direction angle.
The unit normal vector of the semicircular canal plane is a three-dimensional space vector, and the coordinate value of the unit vector is the cosine value of its direction angle. Unlike the calculation of the mean direction angle, the mean value of the vector are calculated as the mean value of the cosine of the directional angle (see Table 1), i.e., to sum the unit normal vectors of each semi-regulated plane to find it's unit normal vector nu → , that is Where n is the number of semicircular canal planes, α_i, β_i, γ_i is the directional angle of the ith semicircular canal, i, j, k is the coordinate unit vector. Compared to the average value of direction angle (Table 2), the method of calculating the average value of the semicircular canal plane normal vector (Table 1) is more intuitive and accurate, and the results are not completely consistent, especially for the data of lateral semicircular canal. The possible reason is that the length of lateral semicircular canal is short and has a certain curvature, and the individual difference of plane fitting is large. This may be because the shortest and non-planar nature of the lateral semicircular canal leads to the increase of individual differences in plane fitting 6,7 , which can lead to inaccurate results from the mathematical average method of direction angular value. Moreover, the understanding of the spatial direction of the semicircular canal is often based on an intuitive understanding of the angle between two straight lines in a two-dimensional plane. For example, if the angle between the posterior semicircular canal and the sagittal plane is 45 degrees, it is considered that the posterior semicircular canal is parallel to the sagittal plane after rotating around the Z-axis for 45 degrees. This problem can also be transformed into the rotation of the normal vector of the semicircular canal plane. In the two-dimensional plane, the angle between the unit vector v 1 → and the unit vector v 2 → is θ and it is right that the vector v 1 → is parallel to the vector v 2 → after rotation angle θ .
Viewed in three dimensions, the axis of rotation is the normal vector u ⃗ of the plane formed by the vector v 1 → and the vector v 2 → . Similarly, the angle between the posterior semicircular canal and the sagittal plane is 45 degrees. To make the posterior semicircular canal rotate and parallel to the sagittal plane, that is, to make the posterior semicircular canal plane normal vector v 1 → rotate and parallel to the sagittal plane normal vector v 2 → (X-axis)，it should rotate 45 degrees around the vector u ⃗ , which is the normal vector of the plane formed by vector v 1 → and vector v 2 → , instead of rotating around the Z-axis. According to the angle between the plane of semicircular canal and the coordinate plane in Table 1, the unit vector of the plane normal vector can be constructed, and the coordinate value is the cosine value of the direction angle. If you need to rotate the posterior semicircular canal to make it parallel to the sagittal plane, you only need to rotate its plane normal vector (blue line) to make it parallel to the Xaxis, that is, the sagittal normal vector (Fig.4).

Fig. 4 Solid model of human semicircular canal spatial attitude
Red, blue, and green represent the normal vectors of the right lateral semicircular canal plane, posterior semicircular canal plane and superior semicircular canal plane, respectively. The medial cross represents the Y-axis and Z-axis.
Most of the previous studies are based on manual point taking and measurements, which cannot meet the need to know the spatial attitude of semicircular canals accurately. Therefore, we use automatic semicircular plane fitting technology, use means of vector instead of means of direction angle to obtain semicircular spatial orientation, and establish a mathematical model of semicircular spatial attitude, which can guide the vestibular function examination such as head shaking test, and also help to guide the diagnosis and treatment of BPPV.

Methods
Clinical data 55 cases included in the study with normal inner ear examined by MRI during the period from January 2014 to December 2019. Inclusion criteria: (1) the semicircular canal was clearly displayed without artifacts; (2) the bottom of the eyeball was clearly without artifacts; (3) a complete semicircular canal model could be obtained by image segmentation.
Exclusion criteria: (1) the existence of local lesions may affect the anatomical structure of semicircular canals; (2) the presence of abnormal head structure.

Image processing and modeling
The original image data were exported from PACS and saved in DICOM format. The images were obtained by reading the catalog with 3D slicer 4.10.2 software, and the 3D-CISS Sequence was automatically exported and saved in NII format. 55 cases of semicircular canal and eyeball were semi-automatically segmented and exported to STL format。

Analysis of space attitude of semicircular canal
1.Obtain the centerline of semicircular canal VMTK is an open-source c + + library using ITK and VTK for vascular structure segmentation, extraction, and analysis. It has a plug-in for 3D Slicer software. It mainly uses its vtkvmtkPolyDataCenterline function to get the inner ear centerline model 16 .
The centerline model of the inner ear is converted to a series of points.It can be seen from the analysis that the centerline of the whole inner ear includes three semicircular canal central rings. There are common intersections between the rings. The intersections appear at least three times in the array. The distance between the intersections of the semicircular canal central rings has a fixed pattern, according to which other abnormal intersections can be excluded.
The centerline of semicircular canal can show the morphological characteristics of semicircular canal. According to the relative spatial position of the central ring of the semicircular canal, we can identify each semicircular canal, that is, the posterior semicircular canal is in the rearmost position, the superior semicircular canal is in the uppermost position, and the lateral semicircular canal is in the outermost position. The superior intersection of the posterior semicircular canal and the superior semicircular canal is the top of the common crus.
2.Establishment of the standard spatial coordinate system Firstly, the fundus plane was formed by taking the lowest point of the eyeball (the minimum Z value) and the bifurcation of bilateral common crus, and the mathematical equation of the plane was calculated. Then, adjusting the plane is needed. The distance from each point of the eyeball to the plane can be calculated by the mathematical equation of the plane with the coordinate values of the point. The point with the longest distance is taken as the lowest point of the eyeball in the standard coordinate system, which forms a horizontal plane with the bifurcation of bilateral common crus.
To establish the spatial coordinate system, the coordinate axes must be determined. The normal vector of the horizontal plane is Z-axis.
Because the semicircular canals are symmetrical left and right, the line connecting the bilateral crus bifurcation is selected as the X-axis, and the Y-axis is further determined as the cross product of the X-axis and Z-axis. In order to keep consistent with the spatial coordinate system of 3D slicer software, the right-hand Cartesian coordinate system is adopted.

3.Fitting equation of semicircular canal plane
The centerline of the semicircular canal can be transformed into a group of points with different adjacent distances. The distribution of the points in the curved part is dense, while that in the straight part is sparse. It is inaccurate to fit the plane directly according to these points. In order to improve the fitting results, firstly, the spline curves were fitted according to the central line of the semicircular canal, and then the points of the spline curves were calculated according to the least square method to fit the semicircular canal plane.
To determine its position in the standard spatial coordinate system, it is necessary to further calculate the angle(direction angle) between its normal vector and each axis in the standard spatial coordinate system and then establish the unit normal vector in the standard space coordinate system according to the cosine of the direction angle (direction cosine).
Presume the plane normal vector of semicircular canal as a = {x, y, z } , and the angles between it and the x, y, z axes of the standard space coordinate system are respectively α, β, γ,and the vector a° is the unit normal vector of the vectorv a in the standard space coordinate system, Then a° = (cosα)i + (cosβ)j + (cosγ)k, where i,j,k are unit vector of coordinate system. 4.Establish the mathematical model of semicircular canal attitude Firstly, the plane equations of the posterior semicircular canal, the superior semicircular canal, and the lateral semicircular canal are calculated, and the unit vector of the normal vector in the standard spatial coordinate system is obtained. Finally, the average unit normal vector of each semicircular canal plane needs to be calculated to form the mathematical model of the spatial posture of the human semicircular canal.

Ethical approval
This study was conducted in accordance with the Helsinki protocol and standard of Good Clinical Practice, and was approved by the Ethics Committee of the Wenzhou People's Hospital (No.2018143). The Ethics Committee determined that the study was exempt from an informed consent requirement since it was a review of existing clinical data with patient identifiers removed.

Data availability
Data files are available on request to the corresponding author.