1 Introduction

Recently, our team is developing a robot surgery system for the reduction of lower limb fractures. The fracture CT images segmentation and reconstruction are the foundation for preoperative planning in robotic surgery systems [1,2,3]. At present, bone fragment segmentation in CT images is usually segmented manually by doctors. This increases the workload of doctors and results in low efficiency of segmentation and reconstruction. The segmentation accuracy is also affected by subjective factors of doctors [4, 5]. Therefore, incorporating bone fragments segmentation and reconstruction algorithms into the surgical system to guide surgeons in selecting the optimal parameters to automatically complete image processing tasks is an effective method to solve these problems.

Using computer algorithms to segment bones has always been a research hotspot in the medical image processing field. Most of the fracture image segmentation algorithms currently studied focus on complete bone segmentation [6,7,8]. However, the position and posture of bone fragments demonstrate specificity and randomness under the muscle traction after fracture [9]. If the bone fragments are separated from each other, we could segment the bone fragments using these algorithms [10, 11]. If the bone fragments are staggered and conglutinated with each other, because the density of bone fragments is almost the same, these bone fragments in the CT images are mostly integrated, as shown in Fig. 1. Which poses a significant challenge to the segmentation algorithms.

Fig. 1
figure 1

Perspective view of fracture area. The figure shows the crisscross and fit situation of the bone fragments in 3D and 2D spaces after fracture

At present, there are few studies on the segmentation of conglutinated bone fragments. For example, Liu et al. [12] introduced a system for assessing the degree of injury in tibia comminuted fractures. The system can segment the conglutinated bone fragments at the tibia joints and calculate the surface area of the bone fragments to determine the degree of fracture. Zhang et al. [13] proposed a bone fragments segmentation algorithm. The algorithm divides the bone fragments from the conglutination region based on erosion and expansion operations and improves computing efficiency through GPU acceleration technology. Shadid and Willis [14, 15] proposed an improved watershed algorithm. The algorithm segments cortical bone and cancellous bone from surrounding tissues by setting the prior pixel value threshold. The remaining bone pixels are classified into corresponding fragments according to the probability function. This algorithm can separate conglutinated bone fragments from most fracture images. However, for some special fracture states, such as the case where cortical bones of bone fragments conglutinate together, the segmentation results may be incorrect.

Through communication with orthopedic experts and literature review, we can find that orthopedic doctors often combine clinical experience with the shape of bone fragments in fracture images to determine different areas of bone fragment [16, 17]. This is similar to the target segmentation process of image recognition technology in the engineering field [18]. In this process, the pixels are labeled to segment targets in images by morphological methods: pixel classification and clustering [19, 20]. In addition, concave point detection is often used to segment conglutinated targets in many fields, such as biological field [21], mining field [22], and industrial manufacturing field [23]. In the medical field, this method is used to segment cells and organs [24, 25]. Therefore, pixels classification and clustering method as well as concave point detection method are the feasible approach to segment conglutinated bone fragments in fracture images.

Based on the study above, this paper proposes an automatic segmentation algorithm for bone fragments segmentation in lower limb fracture cases. In order to facilitate the system operation of fracture image processing by doctors, the algorithm guides users to obtain the optimal image processing parameters through several simple steps, thereby achieving automatic segmentation and reconstruction of preoperative images of patients. Therefore, this algorithm enables clinical doctors without image processing technology and computer programming foundation to complete complex image processing tasks.

2 Methods

The morphological segmentation algorithm proposed in this paper achieves the extraction of bone fragment targets by filtering and classifying pixel points in CT images. This overcomes the drawback of traditional segmentation algorithms relying solely on pixel values for object recognition. To achieve this goal, the algorithm processes the pixels in the image in four steps.

In the first step, the pixels in original images are classified into different point sets based on their pixel values and positions. In the second step, the bone fragments boundary is formed by detecting and connecting concave points in the bone fragments conglutination area. In the third step, the pixels within the boundary are divided into proximal bone fragment pixels and distal bone fragment pixels through the region filling. In the fourth step, the pixel points on the boundary are collected into the proximal and distal bone fragments through pixel clustering, and the bone fragments segmentation task is completed. The implementation process of this algorithm is shown in Fig. 2.

Fig. 2
figure 2

The processing flow of the morphological segmentation algorithm. The algorithm completes the bone fragment segmentation task through four steps: pixel classification in the original CT image, concave points detection and connection, filling the bone fragments area and pixel clustering

Several user-defined parameters are required in the four steps: (1) Bone pixel prior threshold Tbone, (2) Secondary boundary point classification threshold TS-boundary, (3) Concave point detection radius Rconcave, (4) Concave point detection threshold Tconcave, (5) Concave point filtering radius RS-concave.

2.1 Pixels classification

In this step, the pixels in the original CT image are classified into boundary point set (B), background point set (BG), secondary boundary point set (S) and interior point set (I) by the algorithm based on threshold Tbone and TS-boundary. This step includes three stages. Firstly, the bone pixels in the original CT image are filtered out based on the threshold Tbone. Then, the filtered bone pixels are classified into different pixels based on their pixel value and position. Finally, secondary boundary points are filtered out based on the threshold TS-boundary.

In the first stage, the value of Tbone is estimated by the prior distribution of bone pixel value. The prior distribution of human bone and non-bone tissue as shown in Fig. 3. Bone pixels have higher pixel values than non-bone tissue in CT images. Thus, bone pixels can be filtered out from non-bone tissue by setting an appropriate threshold value. If the value of the pixel is greater than Tbone, it is classified as a bone pixel. If the value of the pixel is less than Tbone, it is classified as a background pixel and the value of the pixel is set to 0.

Fig. 3
figure 3

Fracture CT image segmentation and pixel value histogram. Figure (a) is the image segmentation result. Figure (b) is the pixel value histogram of the fracture CT image. When the blue line in Figure (a) passes through the bone fragment twice, two peaks are clearly visible in Figure (b)

In the second stage, the 8-neighborhood connection value is calculated to determine the position of the bone pixel as shown in Eq. (1). And classify the pixel into the following categories based on its connection value.

$${N}_{c}^{\left(8\right)}\left(x\right)=\sum_{k\in M}\left[\overline{I }\left({x}_{k}\right)-\overline{I }\left({x}_{k}\right)\overline{I }\left({x}_{k+1}\right)\overline{I }\left({x}_{k+2}\right)\right]$$
(1)

where \({N}_{c}^{\left(8\right)}\left(x\right)\) is the 8-neighborhood connection value of the x-position pixel, k is the number of pixels around the x-position pixel in 8-neighborhood, M = [0, 2, 4, 6], \(\overline{I }\left(x\right)=1-I\left(x\right)\).when k + 2 = 8, x8 = x0.

  • (1) Isolated point: If the connection value of a pixel \({N}_{c}^{\left(8\right)}\left(x\right)=0\) and pixels’ value in 8-neighborhood are all 0, the pixel should be called isolated point. Its pixel value is set to 0.

  • (2) Interior point (I): If the connection value of a pixel \({N}_{c}^{\left(8\right)}\left(x\right)=0\) and pixels’ value in 8-neighborhood are all 1, the pixel is classified as the interior point.

  • (3) Boundary point (B): If the connection value of a pixel \(1\le {N}_{c}^{\left(8\right)}\left(x\right)\le 4\), the pixel is classified as the boundary point.

In the third stage, secondary boundary points are filtered out from the point set I according to TS-boundary. The number of interior points in 8-neighborhood around the pixel is used to determine whether the pixel is a second boundary point. If the number of boundary points in the 8-neighborhood is greater than or equal to TS-boundary the point should be called second boundary point and classified into the point set S.

After this step, non-bone tissue pixels in the original CT image are removed, and bone pixels are classified into boundary points, secondary boundary points, and interior points. And the boundary lines formed by the boundary point set and the secondary boundary point set can segment bone fragments that are separated or slightly conglutinated (The width of the conglutination area is only four pixels) to each other. But for bone fragments with severe conglutination, the next steps of concave point detection and connection are required.

2.2 Concave point detection and connection

For CT images with severe bone fragment conglutination, only identifying the boundary points and secondary boundary points of the bone fragment is not sufficient to form the bone fragment boundary. Moreover, repeated boundary detection is not conducive to the recognition and segmentation of slender and small bone fragments. Through communication with orthopedic doctors, they judge the boundary of bone fragments through experience, and the boundary of bone fragments is often on the connecting line of concave points. Therefore, this algorithm is used to search for concave points on bone boundaries through concave point detection. And the concave point connection is used to connect two concave points to form the bone fragment boundary. This step includes three stages. Firstly, the concave points on the bone boundary (point set S) are detected according to the search radius Rconcave and threshold Tconcave. Then, correct concave points are filtered out based on the search radius RS-concave. Finally, the correct concave points are connected to form bone fragment boundaries.

Compared with the other points in the point set S, the number of background pixels in the area centered on the concave point is much smaller than that of other points, as shown in Fig. 4. Therefore, in the first stage, the number of background points is counted in the area with a radius of Rconcave and centered on the point in the point set S. If the number of background points is less than Tconcave, the pixel will be classified into the concave point set (C). On account of the broken edge of the bone fragments, there are much interference concave points are detected, as shown in Fig. 5. These interference points will hinder the correct concave points connection. Thus, these points should be filtered out.

Fig. 4
figure 4

The principle of concave point detection. The number of interior points in the area centered around the concave point is much higher than that in the area centered around the boundary point

Fig. 5
figure 5

The fracture image after concave point detection. The white points are concave points, the concave points marked by black circles are correct concave points, and the rest are interference concave points. Due to the unsmooth boundary of the bone fragment, some of the detected concave points are not on the boundary of the bone fragment conglutination area

In the second stage, any other concave points are detected in the area with radius RS-concave to determine whether the center point is a correct concave point. If there is, the point is correct concave point and retained in the point set C; If there is not, the point is classified to the point set S. Due to the different fracture situations of different patients, the value of RS-concave needs to be adjusted according to the specific circumstances.

In the third stage, the 4-path connecting the concave points are searched in the point set I by the 4-neighborhood search method, the pathfinding method as shown in Fig. 6. This method includes 8 search directions. Due to the long program, the figure only shows the starting point located at the bottom left of the target point as an example. The pixels on the path are classified into point set S.

Fig. 6
figure 6

The 4-path pathfinding method and algorithm. Figure (a) shows the pathfinding program diagram. Due to the long program, one of the cases is used as an example. Figure (b) shows the schematic diagram of path finding, the red arrow indicating the calculated 4-path

After this step, boundaries have been formed between the conglutinated bone areas in the original CT image. But currently, the bone areas in the image are all interior points. These interior points need to be classified into proximal bone fragment and distal bone fragment.

2.3 Closed area filling

Through the above two steps, the bone area in the CT image can be divided into two enclosed areas. This step uses flood filling method to classify the pixels in the two enclosed areas into proximal fragment point set (P) and distal fragment point set (D) based on the proximal and distal bone fragment seed points.

This step starts from the seed point and searches for interior points in the 6-neighborhood around the pixel, as shown in Fig. 7, and classifies the searched interior points into point set P or point set D. Then use these points as the starting points to continue the search operation, until all the interior points in the images are classified into point set P or point set D.

Fig. 7
figure 7

The 6-neighborhood layout, the red point is seed point, the black points are adjacent points of the seed point. When calculating, start with the red point and search for interior points within the surrounding 6 black points

After this step, the bone area in the original CT image has been preliminarily divided into proximal and distal bone fragments. Only the pixels in the boundary point set and secondary boundary point set in the image have not been classified.

2.4 Boundary points and secondary boundary points clustering

After the above three steps, the pixels in the image are classified into boundary point set, secondary boundary point set, proximal bone fragment point set and distal bone fragment point set. This step classifies the points in the boundary point set and secondary boundary point set into the proximal bone fragment point set and the distal bone fragment point set by calculating the distance between the points in the proximal and distal bone fragments separately.

In this step, the pixels in the point set B and point set S are classified according to the minimum Euclidean distance between the pixels and the bone fragment areas, as shown in Fig. 8. The calculation rule is shown in Eq. (2). If the minimum Euclidean distance between the pixel and the proximal bone fragment area is less than that of the distal bone fragment area, the pixel is classified into point set P. Conversely, the pixel is classified into point set D. After this step, the bone pixels in the original CT image are divided into proximal and distal bone fragments.

$$\left\{X_{image}\left|x\in B\cup S\right.\right\}=\left\{\begin{array}{c}x\in P\;L\left(x,\;P\right)\leq L\left(x,\;D\right)\\x\in T\;L\left(x,\;P\right)>L\left(x,\;D\right)\end{array}\right.$$
(2)

where L (x, P) is the minimum Euclidean distance between the pixel x and the proximal bone fragment area, L (x, D) is the minimum Euclidean distance between the pixel x and the distal bone fragment area. The calculation of the two is shown in Eqs. (3) and (4).

$$L\left({x}_{i},{P}_{j}\right)=\begin{array}{c}\begin{array}{c}{\text{min}}\\ \forall {x}_{i}\in B\cup S\end{array}\\ {\forall p}_{j}\in P\end{array}\left\{\sqrt{{\left({x}_{i}-{x}_{pj}\right)}^{2}+{\left({y}_{i}-{y}_{pj}\right)}^{2}}\right\}$$
(3)
$$L\left({x}_{i},{D}_{j}\right)=\begin{array}{c}\begin{array}{c}{\text{min}}\\ \forall {x}_{i}\in B\cup S\end{array}\\ {\forall d}_{j}\in P\end{array}\left\{\sqrt{{\left({x}_{i}-{x}_{dj}\right)}^{2}+{\left({y}_{i}-{y}_{dj}\right)}^{2}}\right\}$$
(4)

where xpj and ypj are the coordinate of pixel in the point set P, xdj and ydj are the coordinate of pixel in the point set D.

Fig. 8
figure 8

An example of how to classify the pixels in point set B and S. Calculate the distance between the point and all pixels in the area, and take the minimum value to represent the minimum distance between the point and the area. Determine the classification of the point by comparing its minimum distance from two areas

3 Results

The clinical datasets used in the experiment are provided by the Department of Traumatology and Orthopedics, Affiliated Hospital of Shandong University of Traditional Chinese Medicine. CT data was obtained using a GE Revolution CT scanner. Each volume dataset consisted of 657–809 axial slices, with a thickness of 0.5–0.625mm and a scanning interval of 0.625mm. Each case image included images of fractured and unfractured limbs. The dataset used in the experiment included three sets of fracture cases, which were from a 33-year-old male with tibial fractures, a 33-year-old male with fibular fractures, and a 66-year-old female with femoral fractures. These fracture cases are quite representative. In dataset 1, the fractured ends of adult male fibula fractures are relatively fragmented, and the small cross-sectional area of the fibula poses a great challenge for segmentation of fractured bone targets. In dataset 2, the tibia of adult males is relatively thick, and after a fracture, there is a different degree of conglutination between the two ends of the fractured bone, which can represent a typical adult male long bone fracture. In dataset 3, adult female femur fractures occurred near the trochanter. Due to the thin bone mass at the trochanter and the patient's age, the fractured bone image at the fracture site is very slender, with only two pixels at the thinnest area, which is very challenging for segmentation of fractured bone targets.

C +  + program is designed for segmentation algorithm implementation and model visualization based on the Insight Segmentation and Registration Toolkit (ITK) and the Visualization Toolkit (VTK). The ‘ground truth’ data set is set to compare and evaluate the accuracy of segmentation results generated by segmentation algorithm and this dataset is segmented manually by orthopedic experts. As two commonly used segmentation algorithms, Otsu threshold segmentation algorithm and watershed segmentation algorithm are used as a comparison of morphology segmentation algorithms in experiments [26, 27]. The segmentation parameters of different segmentation algorithms for three datasets are shown in Table 1. The prior bone threshold Tbone is set to segment the bone areas according to the study reported by Inacio and Kranioti et al. [28, 29].

Table 1 The segmentation parameters of different segmentation algssorithms for three datasets

The segmentation results generated by different algorithms are shown in Figs. 9, 10 and 11. It is shown in these figures that the segmentation results generated by morphological algorithm are most similar to ‘ground truth’. In the segmentation results generated by the watershed algorithm, over-segmentation appears at the edge of the bone fragments. And in the segmentation result of the fibula image, error-segmentation appears at the distal bone fragment. In the segmentation results generated by the Otsu threshold algorithm, serious over-segmentation appears at the bone fragments. And in the segmentation result of the fibula image, error-segmentation appears at the proximal bone fragment.

Fig. 9
figure 9

The segmentation results of fibula fracture dataset using different algorithms. Taking the 426th, 442nd and 455th slice as examples. The segmentation results of morphological algorithms are closest to ground truth. The segmentation results of other two algorithms have corrosion and incorrect segmentation problems

Fig. 10
figure 10

The segmentation results of tibia fracture dataset using different algorithms. Taking the 247th, 256nd and 266th slice as examples. The segmentation results of morphological algorithms are closest to ground truth. The segmentation results of watershed algorithm have incorrect segmentation problem, and the segmentation results of threshold algorithm have severe corrosion problems in the cancellous bone area

Fig. 11
figure 11

The segmentation results of femur fracture dataset using different algorithms. Taking the 304th, 319nd and 354th slice as examples. The segmentation results of morphological algorithms are closest to ground truth. The segmentation results of watershed algorithm have incorrect segmentation and corrosion problems. The segmentation results of threshold algorithm have more serious corrosion problems, even resulting in bone area loss

Several evaluation metrics are used to evaluate the segmentation effect of different algorithms. The metrics include the Hausdorff Distance (HD) [30], Region Rank metric (RR) [15], and four evaluation metrics based on the error matrix: Accuracy, Sensitivity (Recall) Dice coefficient (F1 coefficient), MIoU and Precision [31]. The values of these evaluation metrics for different algorithms are shown in Tables 2, 3 and 4. By comparing the evaluation metric scores, the same conclusion can be drawn as above. The segmentation results generated by the morphological algorithm are closest to ‘ground truth’.

Table 2 The value of metric scores based on the error matrix
Table 3 The value of the RR metric (%) of three segmentation algorithms
Table 4 The value of HD metric (mm) of three automatic segmentation algorithms. The smaller the metric value, the more similar the segmentation result is to ‘ground truth’

Figure 12 shows the relative error distribution of three CT image segmentation results using different segmentation algorithms. When segmenting the conglutination area and the two ends area of the fractured bone, the Otsu threshold algorithm and the watershed algorithm obviously have higher segmentation error. However, the morphological algorithm has less error in these two segmentation cases.

Fig. 12
figure 12

The relative error distribution of segmentation results for three CT datasets using different segmentation algorithms. Where (a) is data set 1, (b) is data set 2, (c) is data set 3. The accuracy of the three segmentation algorithms for images with fractured bone sections has decreased when segmenting bone fragments in the fracture area, especially in the bone fragments conglutination area. The difference between the segmentation results of morphological algorithms and ground truth is minimal, especially at the ends of bone fragment, the segmentation results of the other two algorithms show significant deviations

Figure 13 shows the reconstruction models of the segmentation results of three fracture image datasets by different segmentation algorithms. Through the 3D models, the advantages of morphological algorithm in bone segmentation can be further demonstrated compared with the other two algorithms. The models segmented by morphological algorithm have smooth surface and no bone pixels loss. However, the models segmented by the watershed algorithm have many surface defects and serious bone pixels loss in the joint head areas. And the models segmented by the threshold algorithm have serious bone pixels loss. This causes the bone fragment models to become transparent and even the joint head areas are lost.

Fig. 13
figure 13

3D reconstruction models of segmentation results of three CT datasets using different segmentation algorithms. Where (a) is the tibia data set, (b) is the fibula data set, (c) is the femur data set. The model segmented by morphological algorithms is smooth and complete. The watershed algorithm model shows partial bone pixels loss at the joint head and shaft. The threshold algorithm model has severe bone pixels loss

In addition, the morphological algorithm segmentation results and ‘ground truth’ are reconstructed in 3D space to compare the segmentation results of the algorithm comprehensively. Figures 14, 15 and 16 show the reconstruction model of the algorithm segmentation results and ‘ground truth’ in different directions. The bone fragments models generated based on the morphological algorithm segmentation results are displayed on top of the corresponding bone fragments in ‘ground truth’, respectively shown in Figure c and Figure d. And the RR metric values and HD metric values of the morphological algorithm segmentation are shown in Table 5. Comparing the values of HD metric, it can be found that the algorithm has the highest segmentation accuracy for tibia fracture images, followed by fibula, and femur is the worst. The same conclusion can be drawn by comparing the models of three fracture datasets. The segmentation result of the tibia fracture dataset is almost the same as ‘ground truth’. In the fibula fracture dataset, a little over-segmentation appears at the edge of the distal bone fragment. In the femur fracture dataset, some over-segmentation appears at the end of the proximal bone fragment. These problems will be discussed in detail in the next section.

Fig. 14
figure 14

3D reconstruction models based on the segmentation result of fibula dataset. Each model is observed from the sagittal, coronal and cross-sectional directions. (a) displays the morphological segmentation algorithm result. (b) displays the ‘ground truth’. (c) displays the proximal bone fragment. (d) displays the distal bone fragment

Fig. 15
figure 15

3D reconstruction models based on the segmentation result of tibia. Each model is observed from the sagittal, coronal and cross-sectional directions. (a) displays the morphological segmentation algorithm result. (b) displays the ‘ground truth’. (c) displays the proximal bone fragment. (d) displays the distal bone fragment. The segmentation results of the morphological algorithm are almost consistent with the ground truth

Fig. 16
figure 16

3D reconstruction models based on the segmentation result of femur fracture images. Each model is observed from the sagittal, coronal and cross-sectional directions. (a) displays the morphological segmentation algorithm result. (b) displays the ‘ground truth’. (c) displays the proximal bone fragment. (d) displays the distal bone fragment. The segmentation results of morphological algorithms are mostly consistent with ground truth. But there are slight corrosion problems at the end of the bone fragments

Table 5 The value of RR and HD metric score of three datasets segmented by morphological segmentation algorithm

4 Discussion

The segmentation experimental results demonstrate that the morphological algorithm proposed in this paper has higher accuracy in segmenting fracture datasets compared to two traditional algorithms. The Otsu threshold segmentation algorithm has the lowest accuracy among the three automatic segmentation algorithms. This is because the gray value of the bone conglutination area is close to the gray value of the bone fragments. In order to segment the bone fragments from the conglutination area, the threshold must be increased to filter out the area.This causes areas with low trabecular bone displacement density such as cancellous bone and joint head to be filtered out. As a result, the segmentation result has a serious over-segmentation problem. Therefore, the threshold algorithm has better segmentation accuracy for fracture images with completely separated bone fragments. However, for the case images of bone congratulation or osteoporosis, the segmentation accuracy will be greatly reduced.

The watershed algorithm also segments bone fragment areas based on the gray value of pixels. The algorithm is prone to segmentation errors when segmenting targets with small difference in pixel values. In the experiment of this paper, the watershed algorithm has a wrong segmentation of the conglutination area when the conglutinated bone fragments are segmented. In order to segment the conglutinated bone fragments, it is necessary to increase the filtering threshold of the algorithm. Similar to the threshold algorithm, this results in areas with lower bone density being filtered out. Therefore, this algorithm has high segmentation accuracy for targets with significant differences in pixel values between the target boundary pixels and interior pixels. However, this algorithm is prone to error-segmentation and over-segmentation problems when segmenting fracture images with conglutinated bone fragments.

However, in the morphological algorithm, the identity of the pixel is only related to its own location and its relative position with the surrounding pixels. All bone pixels in the dataset, regardless of their gray values, can be classified and clustered. In addition, the concave point detection method is used to segment the conglutination areas between bone fragments. Avoiding error-segmentation problems caused by the same gray value of the bone fragments conglutination area as the bone area, as shown in Fig. 17. Therefore, this algorithm will not encounter the problems of error-segmentation and over-segmentation like threshold algorithms and watershed algorithms.

Fig. 17
figure 17

Segmentation results calculated using and not using the concave point detection method. (a) is the 278th slice of the original tibia fracture CT image. (b) is segmentation result without concave points detection. (c) is segmentation result with concave points detection. (d) and (e) are the corresponding 3D models. The use of concave point detection method can accurately generate the boundaries of conglutinated bone fragments, which ensures the accuracy of 3D reconstruction

By comparing the 3D models, it can also be found that the morphological algorithm has high segmentation accuracy. The segmentation result of the algorithm for tibia fracture images is almost consistent with ‘ground truth’. However, some over-segmentation appears in the segmentation results of fibula fracture images and femur fracture images.

This is because that the cross section of fibula is small. In the fibula fracture case, the end face of bone fragments is broken after fracture. There are several small bone fragment areas in the slice image. These areas only have boundary points and second boundary points after pixel classification step and cannot be filling into proximal and distal bone fragments in the closed area filling step. Therefore, there are little over-segmentation problems in the segmentation results. In the femur fracture case, the fracture is located at the distal part of the femur near the ankle. The bone in this part is thinner than that in the shaft. In addition, bone loss in elderly patient makes the bone fragments in this part thinner than the general bone. The bone area presents a slender shape in the slice image. Some boundary points and second boundary points are clustered into the wrong bone fragment in the pixel clustering step. Therefore, there are some over-segmentation and error-segmentation problems in the segmentation results.

Through analyzing the problems mentioned above, it can be found that the morphological algorithm is prone to problems when segmenting small fragments and slender fragments. But these problems can be solved by optimizing algorithm parameters. For example, for the over-segmentation problem when segmenting small bone fragments, this problem can be solved by optimizing the parameters in the concave point detection stage to avoid mistakenly segmenting the bone fragment area into many small closed areas. For the error-segmentation problem when segmenting slender bone fragments, this problem can be solved by adding seed points in areas where segmentation problems appeared.

Therefore, for the complex fracture images segmentation, the values of the parameters in the morphological algorithm should be optimized and adjusted according to the segmentation result. And the segmentation accuracy of the algorithm can be improved by optimizing parameters. Take the femur fracture images used in the segmentation experiment as an example. In the segmentation results before optimizing the algorithm parameters, some over-segmentation and error-segmentation problems appear at the end of the proximal bone fragment, as shown in Fig. 18 (a). After optimizing the parameters by adding seed points in areas where segmentation problems appeared, the over-segmentation and error-segmentation problems in the segmentation results are well resolved, as shown in Fig. 18 (b).

Fig. 18
figure 18

Comparison of segmentation results of proximal fibular bone fragment before and after optimization of algorithm parameters. (a) displays the segmentation result before optimizing parameters, where the green area is the ‘ground truth’ mask. (b) displays the segmentation result after optimizing the parameters. By optimizing algorithm parameters and adding seed points, the corrosion problem of the algorithm can be effectively solved

From this perspective, there is uncertainty in the algorithm when segmenting small and slender bone fragments. The main problem is that the algorithm needs to classify the boundary points and secondary boundary points of the bone fragments in bone fragment segmentation to form the boundary of the proximal and distal bone fragments. But for small and slender bone fragments, the area of their ends in the image is very small, and after calculation, there are no interior points in this area. Therefore, during the third step of calculation, these areas were not filled. As a result, when calculating the distance between pixels and two bone fragments in the fourth step, the pixels that should belong to the proximal bone fragment are more distant from the proximal bone fragment than from the distal bone fragment. The same problem also occurs on the pixels of the distal fractured bone fragment. This resulted in incorrect classification of pixels in the boundary point set and secondary boundary point set. Thus, when segmenting small and slender bone fragments, seed points are added to the end image slices of the bone fragments. This can increase the number of interior points in the area where segmentation errors occur during the third step of the algorithm. At the same time, considering canceling the algorithm's secondary point boundary point detection step when processing similar images can also increase the number of interior points at the ends of small and slender bone fragments. This can avoid errors when calculating the distance in the fourth step and reduce segmentation errors.

5 Conclusion

A novel automatic bone fragment segmentation algorithm based on morphology is proposed in this paper to segment the lower limb fracture CT images. In this algorithm, pixels classification and clustering methods are designed to segment the bone fragments that are separated from each other and slightly conglutinated to each other. In addition, the concave point detection method is designed to segment the bone fragments with the conglutination area. These methods improved the adaptability of the algorithm for segmenting complex fracture images. This method determines the boundaries of different bone fragments through their morphology, improving the traditional object segmentation algorithm's approach of simply segmenting objects based on their pixel values. This avoids the shortcomings of traditional segmentation algorithms in fracture image segmentation and provides new ideas and research directions for clinical image target segmentation. Through the description in this paper, the parameters in the algorithm are easy to understand and control in the process of image segmentation, which makes the algorithm can be intuitively applied to orthopedic clinical images segmentation.

In the segmentation experiment, the three segmentation algorithms are used to segment the typical fracture CT datasets. The segmentation results are presented and quantitatively evaluated in 2D and 3D spaces. Through comparative analysis of segmentation experiment results, it is demonstrated that the segmentation algorithm proposed in this paper has more advantages than commonly used segmentation algorithms. The experimental results show that the algorithm can not only correctly segment the bone fragments but also have good segmentation accuracy in conglutinated bone fragments segmentation.

However, the algorithm also exposes some problems in the segmentation experiment. In the future, we will optimize the algorithm to improve the segmentation accuracy of the algorithm for small and slender targets. Through communication with clinicians, we learned that orthopedic surgeons often judge the boundary of bone fragments through context and clinical experience. The machine learning method is also based on the existing segmented datasets to accumulate experience, and then complete the segmentation task. And machine learning algorithms have been widely used in target segmentation of medical images. [32,33,34] Therefore, we will study machine learning fracture image segmentation algorithms and use doctors' manual segmentation of images as training samples to improve the segmentation accuracy of the algorithm.