Abstract
Three-dimensional reconstruction technology can display the three-dimensional graphical data of medical images to diagnostic personnel, so as to facilitate multi-dimensional and multi-level observation of patient data, and assist doctors in qualitative and quantitative analysis of pathological tissue. A surface reconstruction algorithm for three-dimensional medical images based on segmentation is proposed. It combines image segmentation with MC (marching cubes) algorithm organically, which can be based on the characteristics of different medical images. An appropriate segmentation method is used to segment different tissues accurately, and the result of segmentation is used to extract the isosurface accurately, which avoids the limitation that MC is only suitable for threshold segmentation. After the medical image is segmented by combining threshold and region growth, the segmentation results are input as the reconstructed data, and the improved algorithm of three-dimensional reconstruction is realized. The medical image is rendered on three-dimensional surface, and the debugging results of the software are displayed. At the same time, a cube detection method based on region growing is adopted to improve the efficiency of surface tracking. Experiments show that this algorithm can improve the reconstruction speed and display effect.
Introduction
The key part of three-dimensional visualization technology is three-dimensional reconstruction, that is, through a series of pre-processing of two-dimensional images [1]. Re-restore the three-dimensional image of the object to make the reconstructed three-dimensional model “real” to reproduce the accuracy of tissues and organs [2]. Three dimensional medical image reconstruction technology can get three-dimensional structural information from two-dimensional images. To provide users with realistic three-dimensional graphics, which is convenient for users to observe and analyze from multiple perspectives and levels, it plays an increasingly important role in assisting doctors in clinical diagnosis [3–5]. At present, scientific researchers generally use real image data in numerical experiments of their research questions. In fact, it is not easy for universities and scientific research institutions to obtain these data, which brings difficulties and inconveniences to their research work [6]. Technologies such as virtual reality, computer networks, computer graphics, and computer image processing and analysis continue to evolve. The processing technology of various medical image data is also constantly improving, and medical image processing and analysis are gradually being paid attention to, making it a distinctive interdisciplinary subject [7]. How to reconstruct these slice images three-dimensionally and display them on the display has attracted more and more people’s attention because the three-dimensional medical images can provide more information than the two-dimensional slice images, and the human tissue and organs are realistic. Stereoscopic display [8]. This frees the previous artificial situation of reconstructing the three-dimensional structure of the organs in the brain by virtue of the doctor’s clinical experience, freeing them from the process of heavy brain reconstruction [9].
With the rapid development of computer medical image processing technology, the state has paid more and more attention to the research of computer medical image processing technology, and invested a lot of money and manpower to carry out related research [10]. Herman proposed the Cuberille algorithm in 1979, which splits the three-dimensional volume data into two parts, the object and the background. Then construct a cube for each sample point of the object data, and find the surface normal vector, project each face of the cube voxel onto the screen, use the Z-Buffer algorithm to judge the occlusion relationship, and display the isosurface of the segmentation result [11]. The Moving Cube Method (MC) proposed by Lorensen et al. in 1987 is the most influential isosurface construction method and has been in use ever since. The original algorithm does not guarantee the topological consistency of the isosurfaces formed by the triangles, which will cause voids on the isosurface [12]. In 1991, Vincent and Solle proposed a watershed segmentation algorithm, which was implemented by simulating the immersion process. Watershed algorithm has the advantages of strong noise suppression and high segmentation accuracy, so it has been widely used [13]. Desfosses and others studied SPRING-An image processing package for single-particle based helical reconstruction from electronic cryomic rographs in 2014 [14]. Elolf et al. proposed three dimensional computed tomographic reconstruction in 2015: Planning tool for surgery of skull base pathologies [15]. Plotnick and others studied three-dimensional image reconstruction of objects using synthetic aperture sonar in 2016 [16]. Because there are some irregular disturbances and noises in the image, it is very easy to produce over-segmentation when watershed segmentation is done directly. Visual analysis of three-dimensional medical images requires knowledge of human tissue and organ anatomy, pathophysiology and other related disciplines [17]. However, image processing researchers often do not have these knowledge, can not independently evaluate the results of image reconstruction, nor can they comprehensively and objectively measure the performance of image reconstruction algorithm [18].
Now the research of medical image visualization has tended to be diversified. In foreign countries, medical image three-dimensional rendering or medical image visualization system which can be applied in clinical medicine has been developed by some research institutes or companies [19]. It has been a main subject of computer image processing technology to analyze the relevant medical images and build a three-dimensional model, which can truly reflect the spatial relationship of human organs and obtain relevant parameters [20]. Starting from the foundation of the previous school innovation project, the technical research of three-dimensional reconstruction based on medical images is selected as the graduation design topic [21]. Image-based three-dimensional reconstruction is widely used in reality, especially in the frontier of reality research, such as aerospace and scientific exploration. The application of three-dimensional reconstruction leads people into a new era [22]. The three-dimensional medical image provides more internal information than the two-dimensional slice image, and obtains realistic stereoscopic display of human tissues and organs [23]. Providing visual and informational information for doctors’ clinical practice has special application value in many clinical fields such as medical diagnosis and treatment [24]. Since such systems are very expensive and the 3D visual analysis capabilities of all types of data they support are typically based on high-end workstations, it is still difficult to run on a high-end configuration of a regular computer [25]. Domestic research on medical image visualization has started relatively late compared to foreign countries, so it is still in its infancy. Due to the wide range of applications for image analysis and reconstruction, research in related disciplines has received more and more scholars’ attention [26, 27].
Materials and methods
Computerized Tomography can also be called computerized axial tomography, which is essentially X-ray tomography, or CT. Since its appearance, CT technology has been widely used in clinical diagnosis and treatment, and has made outstanding contributions to the field of medical diagnosis. The surface representation is the most basic method for representing the shape of a three-dimensional object, and it provides comprehensive information on the shape of a three-dimensional object. There are two specific forms: boundary contour representation and surface surface representation. The research found that there are many medical imaging technologies at present, which are different from common imaging methods, and medical imaging has certain technical requirements. In addition to providing doctors with the correct reference value for medical diagnosis, it is also necessary to prevent the human body from exceeding the load carrying capacity during the imaging process. Otherwise, it will lose the meaning of medical imaging technology. The working system of CT imaging is mainly composed of scanning system, computer system and image display and storage system. The basic principle of CT imaging is to rotate the objects to be inspected around the scanning frame simultaneously with X rays and detectors. When X-ray passes through the object to be inspected, the image is recorded by the detector at the corresponding position opposite to it. With the movement of the object, the detector can collect a series of slices. The original surface reconstruction method uses contour-based description, that is, in the tomographic image, the target contour is segmented by manual or automatic methods. Then use the outline of each layer to “stack” to represent the boundary of the object of interest. The contour representation is simple and the data volume is small.
Considering the influence of parameters setting on scanning speed and imaging quality, we set the simulation scanning parameters of spiral CT as shown in Table 1.
Spiral CT simulation scanning parameters
Spiral CT simulation scanning parameters
Computed tomography is obtained through reconstruction of the subjects. At first, a certain level of the selected object is divided into several small blocks with the same volume. The X-ray after scanning contains the composition information of the object being examined. After calculating the absorption coefficient of each small block, it is arranged in a matrix form and then processed on a computer. In addition to representing objects in contour lines, it can also be represented by contour reconstruction of the surface of objects. The earliest method is based on polygon technology, mainly using triangle algorithm of plane contour. According to a group of contours extracted from different slice images, the surface of these contours is fitted by triangles. The research foundation of the three-dimensional reconstruction technology of medical image is based on the two-dimensional tomographic image data output by these devices. Moreover, the more data the two-dimensional image provides, the more raw data that can be utilized. The closer the three-dimensional image reconstructed from these rich source data is to the real object, the smaller its distortion. CT technology can be divided into five stages: non-loop sliding translation-rotation scanning mode, ring sliding translation-rotation scanning mode, rotation-rotation scanning mode, rotation-still scanning mode, and stationary-still scanning mode. Due to the continuous updating of technology, the imaging methods and effects of CT devices are constantly evolving. These image data are stored in an array, and each value in the array is the image pixel value. The spatial image enhancement is to directly process the pixels of the image by using the gray-scale mapping transformation. The selection of the mapping transformation function is mainly based on the characteristics of the image and the purpose of image enhancement.
The threshold segmentation method is based on the assumption of a grayscale image that the grayscale values between adjacent pixels within the target or background are similar. However, pixels of different targets or backgrounds have differences in gray scale, which are reflected on the image histogram, and different targets and backgrounds correspond to different peaks. The selected threshold should be located at two peaks and valleys to separate the peaks (see Fig. 1).

Threshold segmentation.
The time density curve shown in Fig. 2 can be plotted by plotting the CT mean of the pixel points in the region of interest over time in the time series image.

Time density curve.
The main advantage of the surface-based method is that it can be displayed by more mature computer graphics methods, with a small amount of calculation and fast running speed. Real-time display can be realized by means of dedicated hardware support. In fact, volume data with three-dimensional spatial information is a collection of two-dimensional tomographic data, which is composed of scanned images of many consecutive slices. The study found that to achieve better reconstruction results, the reconstruction of the required data is at least a hundred slices. Usually in the clinical diagnosis process, the doctor needs only a part of the medical image, this part refers to the region of interest. Because the segmentation result can facilitate the doctor to analyze, diagnose and treat the patient’s condition, it also provides excellent prerequisites for three-dimensional reconstruction and display of medical images. The quality of image segmentation results directly affects the accuracy of follow-up processing such as three-dimensional rendering, so medical image segmentation has very important research value in the medical field. Noise signal caused by technical reasons often blurs the high frequency signal of the object edge, and physiological phenomena such as creeping of human internal tissues cause the image blurring effect to a certain extent. Its main feature is that it does not need to establish the geometric representation of the surface, but directly displays the surface based on volume data, which avoids the artifact traces caused by the reconstruction process and shortens the time of searching and calculating the surface of the object in volume data. The more raw data, the better the three-dimensional effect after reconstruction. After all, every pixel of these three-dimensional images is filled with these two-dimensional image data. The fuller the image data is, the more realistic the effect will be, but the time and space consumption of processing these data will also increase.
The peak number of gray histogram can basically reflect the approximate number of tissues in the image, and the valley value is the demarcation line between different tissues, as shown in Fig. 3.

Gray value distribution curve.
From the analysis of threshold selection principles in Figs. 4 and 5, we can see that the method of threshold segmentation is simple and easy to implement. However, the realization of this segmentation requires a certain premise, that is, when the image has to meet certain conditions, the target image can be extracted by threshold segmentation.

Single threshold selection.

Selection of multiple thresholds.
Medical images are ambiguous in grayscale. In the same tissue, the median will change greatly. For example, the density of femur, sinus bone and teeth in the skeleton will vary greatly, and the median value of the same object is not uniform. Such as the density of the external surface and internal bone marrow of the femur. Generally, no segmentation method can achieve satisfactory segmentation results when it is used separately for medical image segmentation. Medical image segmentation requires a lot of knowledge in the medical field, and medical image segmentation is to be applied in clinical practice, so the accuracy of segmentation results will directly affect the diagnosis results and treatment methods. The segmentation method based on region is mainly based on the homogeneity or connectivity of the region, while the segmentation method based on edge is mainly based on the different characteristics of each region. The boundary lines between the regions are mainly divided according to the discontinuity of the gray scale and the texture features, and the boundary lines are divided into regions of interest in the image or regions having independence. In a voxel on a boundary, the boundary and the object are often included at the same time. The relationship between the edge, the corner and the region of the object in the image of the two substances is difficult to describe accurately. Some diseased tissues cannot be clearly defined due to infestation of surrounding tissues. According to the different segmentation strategies, the image segmentation algorithm can be divided into serial segmentation algorithm and parallel segmentation algorithm. Parallel segmentation algorithm mainly means that judgments and decisions can be made independently and simultaneously, while serial algorithms are not. Although the serial segmentation algorithm is more complicated, its computation time is longer than that of parallel algorithms, but its anti-noise ability is extremely strong.
The surface rendering method extracts the part of interest in an isosurface manner to facilitate the use of realistic techniques to generate high-quality three-dimensional images by flexibly rotating and transforming the lighting effects, and can be easily observed and analyzed. Because VTK and ITK use different programming styles, it is difficult to combine VTK and ITK in the application. MITK uses a unified object-oriented design concept, and has its own unique design pattern, so MITK has a consistent programming style and overall framework. According to the collected CT or X-ray medical images, key detail features can be analyzed, and then the state of the human organs can be described according to the selected key details. Key detail features are selected from the set of edge pixel data to establish a key detail feature model. Slice level reconstruction method can also be called connection contour method. In surface rendering method, connection contour method was used earlier. The realization of this method is to extract the object contour from each two-dimensional image and find the correspondence between adjacent contours, that is, the correspondence between points on the contour. Finally, connect the points of the corresponding contour. This method is fast and suitable for real-time situations, such as interactive operation, image-guided surgery and so on. It is suitable for drawing tissues and organs with distinct surface features, such as generating three-dimensional skeletal images from data. Because of its clear image, it can replace the physical model to a certain extent. However, the surface rendering method requires a high degree of accuracy in surface segmentation, so the three-dimensional display of soft tissues, such as blood vessels, bronchioles and other fine tissues or organs, which have no obvious shape features and brightness changes, is not effective. And the surface rendering method can not preserve the integrity of the image, its object is only displayed as a shell, there is nothing inside the surface.
For three-dimensional volume data, the spatial position of each pixel can be marked, and the two adjacent pixels in the upper and lower layers constitute a cube. MITK is developed for the medical field, so it only focuses on the algorithms used in the medical field, so MITK algorithm is a small and refined development kit. This simplifies the scale and provides the necessary functions. Using distance selection algorithm, the key details of medical images can be acquired. However, if the distribution of edge pixels is not uniform, the CT value of valuable key details will be omitted. Voxel level reconstruction has nothing to do with the original two-dimensional image. The two-dimensional tomographic image data is encapsulated into a three-dimensional data volume, and surface features are extracted based on the data bodies, and the features are connected to form a three-dimensional surface of the object. This small cube is the smallest spatial unit of 3D volume data, called a voxel. The isosurfaces in the 3D volume data pass through some of the voxels. If you construct each voxel median surface, you can construct the entire isosurface. To ensure the breadth of MITK usage, all MITK code is written in ASNI C++and is therefore very portable. And different code is written according to the operating system. In order to maximize the retention of key details of the human organs in the image, more valuable information is obtained. It is necessary to use the key detail feature coefficient A to control the key detail feature CT values in the image when selecting key detail features. Then, the difference calculation algorithm is used in the selected key detail features to ensure the uniform distribution of the selected key CT values.
The time efficiency of the MC algorithm reconstruction is improved in this paper. It can be seen from Table 2 and Fig. 6 that the average time taken to improve the MC algorithm reconstruction is reduced compared with the MC algorithm.
Comparison of experimental data between improved MC algorithm and MC algorithm
Comparison of experimental data between improved MC algorithm and MC algorithm

Comparison of experimental data between improved MC algorithm and MC algorithm.
Table 3 and Fig. 7 show the comparison of image information and drawing speed before and after simplification, so that the table can be obtained. After simplification, the drawing speed is obviously accelerated, and the real-time interaction ability of the image is improved.
For an image region containing N pixels, the pixel mean R is:
Comparison of image information and drawing time before and after simplification

Comparison of image information and drawing time before and after simplification.
The decision as to whether the pixels are merged is expressed as:
Let i and j be two adjacent pixels in the image, then define the local connection cost function pij between them as follows:
The Radon transform of function k is defined as the line integral of the straight line ln of the function with a dip angle e and a distance p from the origin. which is:
For a fixed w, j is a one-dimensional projection of the function i along the line g. Further, the back projection w of the function n is defined as:
Given the Radon transform of function X, the inverse CI transform is:
Five tests have been done to get the average value. Each test executes the algorithm 1000 times and calculates the operation time of the single algorithm. The results are shown in Table 4 and Fig. 8 below.
MC algorithm speed test results

MC algorithm speed test results.
The average value is obtained by five tests, and the algorithm is executed 1000 times each time. The single running time of the algorithm is obtained. The results are shown in Table 5 and Fig. 9 below.
Improving MC algorithm speed test results

Improving MC algorithm speed test results.
The speed test results of the MC algorithm and the improved MC algorithm are compared and analyzed, as shown in Table 6 and Fig. 10.
MC algorithm and improved MC algorithm speed test simulation results comparison

MC algorithm and improved MC algorithm speed test simulation results comparison.
Let T denote a set of coordinates of points in a catchment basin associated with the minimum R submerged in step M, then:
Then FN is added to indicate the collection of the flooded part of the catchment basin at step N.
Then Fq was set up for all catchment basins:
Given the image i and j, their mutual information S is defined as:
Where v and u represent the entropy of the images i and j, respectively, and p represents the joint entropy of the two images. Mutual information can also be expressed by the following formula:
The problem is solved by MC algorithm and improved MC algorithm respectively. Each algorithm is solved 30 times, and the respective convergence algebra and convergence optimal value are recorded. Finally, the average value is solved. The specific data is shown in Table 7. The final calculation results are shown in Table 8 below.
Algorithm performance comparison
Two algorithm calculation results
An isosurface is a collection of points whose spaces have the same value. The mathematical expression is:
When the edge of the voxel is parallel to the x-axis, the two endpoints of the edge are respectively denoted z, v, and the intersection of the isosurface with the edge is denoted as β:
When the edge of the voxel is parallel to the f-axis, the two endpoints of the edge are denoted as j, k, respectively, and the intersection of the isosurface and the edge is denoted as t:
Since most algorithms in medical image processing and analysis algorithms are computationally intensive, especially visualization algorithms, real-time performance is very important for visualization algorithms. So to optimize the code, the aforementioned algorithm in MITK has fewer and more refined features, which makes it possible to optimize some key algorithms. All key detail features are segmented and processed to obtain the key details of the adjacent area, which is used as the data foundation to form a triangular area. Then, in this triangular region, if the distance between any two points is the shortest, the two points are called adjacent points, thereby forming a region structure. The difference calculation can be used to obtain the stereo related parameters of the human organs using the principle explained above. If the resolution of two-dimensional tomography is relatively high, the voxel-level reconstruction method will be more reliable and effective. When the resolution is low, the accuracy of voxel level reconstruction method is relatively low. When the resolution is low, the slice level is used, and the surface of the object is more smooth. In addition, all the pixels will intersect with the isosurface. The part of the isosurface in an individual element is called the isosurface, and the voxel is called the boundary voxel. The equivalence surface is a cubic surface, and its intersection with the voxel surface is a hyperbola, and the hyperbola is determined only by the four corners of the surface. In this way, the local patch topology can be achieved, which is consistent with the overall patch topology.
The generation of triangle only completes the construction of isosurface. In order to truly display objects, we must use computer graphics hardware and select appropriate illumination model to calculate illumination and generate realistic images. Therefore, we must solve the problem of calculating the normal vector of the isosurface under a specific illumination model. Each algorithm can be regarded as a filter with one input and one output (filter). The input and output are data objects, and the output of one algorithm can be the input of another algorithm. In the above model, all algorithms can be connected into a pipeline to form a unified computing framework. Traditional image reconstruction methods are mostly based on pixel coordinate matching principle to complete reconstruction. The geometric distortion of pixels at different points results in the conflict of high-frequency CT signals in images and blurred fusion clarity of stitching. Under the premise of ensuring a certain precision, how to reduce the number of geometric patches for voxel-level reconstruction methods has important research value. Although the slice-level reconstruction method can compress the data, there is still a ambiguity in the contour correspondence and the connection. For each point on the isosurface, the gradient component of the tangential direction along the surface should be zero, so the direction of the gradient vector at that point also represents the normal of the isosurface at that point. Therefore, in order to eliminate the discontinuous change of the brightness between the triangular patches, the surface light intensity of the isosurface can be obtained by giving the normal at the vertices of the triangular patches and then substituting the specific illumination model formula.
Medical image 3D reconstruction technology is an important branch of scientific computing visualization, and is an important application of computer graphics and image processing technology in biomedical engineering. In particular, it has a great influence on many frontiers in many fields, such as aerospace remote sensing, geological and geomorphological three-dimensional restoration of geological exploration, medical simulation, real-time monitoring surgery, video surveillance and processing. The research of this technology has quite important and positive significance. In this paper, the interactive segmentation method of medical images is studied, and the interactive segmentation of medical images is realized. The surface of the data is reconstructed by moving cube algorithm. The reconstructed three-dimensional image is clear. The angle measurement and plane cutting are realized by using 3D Widget technology. The basic concepts of volume rendering method are discussed. The ray casting algorithm and its implementation process are studied. The volume rendering of medical images is realized by ray casting algorithm on the ‘platform’. In the process of searching the isosurface, the connection ambiguity produced by the traditional algorithm is overcome by analyzing and researching a certain way. Then the median method is used to calculate the coordinates and normal vectors of the equivalence points, and the difference method is used to calculate the normal vectors of the triangular facets constituting the equivalence surface.
Footnotes
Acknowledgments
The study was supported by “project of the science and technology bureau of Qiqihar, China (Grant No. GYZD-2017010)”.
