Morphological Analysis of Medullary Cavity for Designing Personalized Femoral Stem

: To improve the quality and efficiency of femoral stem prosthesis design, a Monte Carlo method based on femoral bone marrow cavity analysis is proposed to measure morphological parameters using anatomical semantics. The region of interest is the femur, which includes the medullary cavity and cortical region. After this region is extracted, the size of the cavity and region is simulated using the Monte Carlo method. Finally, based on clinical needs, the morphological parameters are calculated and analyzed based on the size of the region of interest. From the perspective of the probability model, the non-random problem of solving the cross-section area of the femoral marrow cavity is transformed into one having a random nature so that a probability model can be used. The experimental results show that this method is simple, flexible, and efficient. It provides a new and reasonable scientific method for comprehensively understanding the anatomical morphological changes of the femoral marrow cavity. The measurement and analysis of the morphological parameters of the femoral bone marrow cavity in this paper provide the necessary scientific theoretical support for improved morphologic research, design, and clinical selection of femoral stem prostheses and has important significance and application value in clinical practice.


Introduction
Hip arthroplasty [1] is a surgical procedure in which the hip joint is replaced with a prosthesis to restore the movement of the hip joint.With the global development of the social economy, the many improvements to standards of living, and the rapid development of computer-assisted orthopedic surgery, an increasing number of patients are receiving artificial hip replacements [2][3] .A prosthetic hip joint is mainly modeled from the human hip structure.By inserting the femoral stem prosthesis into the femoral marrow cavity of the patient, pain can be relieved while restoring range of motion and function.
Fig. 1 shows the prosthesis.The femoral stem [4] is a crucial part of the prosthesis.Good matching and correct sizing of the femoral stem and medullary cavity are beneficial to reducing the shearing force in the isthmus when applying vertical pressure to the proximal surface of the femur.Accuracy of this nature effectively avoids early loosening of the prosthesis and postoperative sequelae.Morphological characteristics of femoral marrow cavities in Chinese people, especially in terms of age, gender, and region, differ from other populations [5] .As such, the existing specifications and types of femoral stems are limited and cannot cover 100% of the patients.Even with customized femoral stems, cases of insufficient anatomical matching to the recipient bone are frequently clinically observed.Hence, improving the matching degree of the femoral stem and medullary cavity has become an urgent problem that needs to be solved for hip joint surgery.The morphological parameters of the femoral marrow cavity are crucial to the design of the femoral stem [6][7] .Studies have shown that the accurate measurement of the femoral marrow cavity's morphological parameters can improve the adaptability, stability, and durability of femoral stem prostheses while reducing iatrogenic injuries [8][9] .Moreover, the measurement results directly affect the long-term survival of the prosthesis [10] .However, as shown in Figs.2(a) and (b), with current measurement procedures [11][12][13][14][15] , the research has mainly focused on the coronal and sagittal axes, and the other axes have been ignored.In CT images, the normal anatomical morphology of the femoral marrow cavity decreases from proximal to distal and is irregular like a trumpet rather than a regular round shape.Therefore, only considering the measurement along coronal or sagittal axes can neither fully nor accurately reflect the true morphology.Additionally, the mark of only a few geometrical reference elements of the femur, especially anatomical markers, as shown in Fig. 2(c), can be automated [16][17] .Most anatomical markers rely too much on experienced doctors, which risks human error.This problem has become an important factor that has restricted the development of China's orthopedic medical equipment manufacturing.
With the increasing maturity of hip arthroplasty technology and the progress of the localization of hip prostheses, practitioners urgently need to better and more quickly comprehend the anatomical morphologies of individual femoral marrow cavities.Therefore, it is urgent to find a more comprehensive morphological description method.
Monte Carlo is a computerized numerical calculation method based on statistical sampling theory that estimates and describes the statistics of functions and provides approximate solutions to problems via statistical sampling or random simulation of variables [18] .To solve a problem, we establish an appropriate probability model or a random process, set its parameters equal to the solution to the problem, and repeat sampling experiments until we obtain statistical analysis of the results.Then, we calculate the parameters to obtain an approximate solution of the problem.This method has been applied in many fields because of its simple program structure, flexible simulation process, lack of problem conditions, and adaptability when solving multi-dimensional problems.In clinical medicine, its application to radiation-dose calculation has been reported in the literature [19] .Kirby et al. [20] used the Monte Carlo method to generate a representative digital model to simulate the microstructure characteristics of bone trabeculae.The work of [21] established a musculoskeletal simulation model based on kinematics data without injury and used the Monte Carlo method to simulate a non-contact anterior cruciate ligament injury of the knee.As shown in Fig. 2(d), The color contrast between dense and cancellous femur bone was strong, and the boundary between the two was clearly visible, making it easy to extract the lateral cortical core and medullary cavity boundary curves while providing a prerequisite for the Monte Carlo method.It is a reasonable tool for calculating the size of a region of interest (ROI), which can then be used as a basic unit to describe the morphology of the transverse section of the femoral marrow cavity.On the basis of years of research results obtained by our working group [22][23][24] , this paper presents a morphological characteristic analysis method for the femoral marrow cavity design of a femoral stem.The main work includes the extraction of the femoral ROI, Monte Carlo ROI simulation, and calculation and analysis of femoral marrow cavity morphology.Our method provides a more scientific and reasonable way to comprehensively understand the anatomical morphological changes of the femoral marrow cavity, and it will be of great significance to improving the matching between femoral stem prosthesis and the femoral marrow cavity.

Research framework
To obtain a more comprehensive understanding of femoral marrow cavity morphology and to improve the design quality and efficiency of customized femoral stems, a morphological parameter-analysis method based on Monte Carlo is proposed, as shown in Fig. 3.The main steps of this framework are as follows: Step 1: extract the ROI of the femur.The femoral marrow cavity and cortical bone region are extracted based on binarization, contour extraction, image subtraction, and other operations.
Step 2: calculate ROI statistics.According to the extracted medullary cavity and cortical bone, the statistics of medullary cavity and cortical bone are estimated based on Monte Carlo randomized dot experiment.
Step 3: calculate the morphological parameters of femoral marrow cavity.Taking the ROI as the basic unit and combining it with clinical needs, the morphological parameters of femoral marrow cavity are calculated.

ROI femur extraction
The ROI mentioned in this paper mainly refers to the cortical bone and medullary cavity areas on CT images.As CT images are formed by the post-decay of electromagnetic rays through the human body, resulting in the presence of isolated pixel points or blocks having strong visual effects, unclear edge contours, and sharp changes in regional gray levels.
Additionally, the gray level of femur CT images is relatively complex, which increases the difficulty of contour extraction.
For denoising, Gaussian filtering is adopted to convolve the 2D Gaussian kernel with the CT femur image so that the value of each pixel can be obtained from the weighted average of its own and other pixel values in the neighborhood.Gaussian filtering uses the product of two 1D Gaussian functions, x and y, and their respective standard deviations, σx and σy, on the two dimensions are equal to each other.The formula is as follows: On the basis of removing noise, the pixel value greater than the threshold is retained, and that less than the threshold, T0, is set to zero, as follows: Owing to the complexity of femoral CT images and the great influence of noise, by comparing the pixel value, contrast size, and actual characteristic information of different CT images in the femoral part, based on the precondition of ensuring the anti-noise effect and information integrity, the final window is selected as 7×7, σ is 3, and T0 is 117.As shown in Fig. 5, the result of image denoising followed by binarization is obviously better than binarization without denoising.The effect of binary processing used in Fig.

Monte Carlo Principle
The Monte Carlo statistical test method originated in the US during WWII to help develop the atomic bomb during the Manhattan Project.When questioning the probability of an event or the expected value of a random variable, it is thought to be solvable using an experimental method.Moreover, when finding a solution in an irregular region, the Monte Carlo method has unique advantages.When random points are sprinkled across an image, for example, some fall into the target area and others do not.When these points conform to a random distribution, the number of points falling into the target region is proportional to the proportion of the size of the entire image.Thus, the size of the target region (Starget) is expressed as arg arg .
where Sfull represents the size of the entire image, Mfull represents the total number of random points, and Mtarget represents the number of random points falling into the target area.

ROI coefficient calculation
In this paper, a probability model is established to describe the ROI in the form of statistics, and its estimated value is obtained via experimental simulation and mathematical statistics.As shown in Fig. 10, considering the medullary cavity area, sm, and the cortical area, sc, of a cross section of the diaphysis region, the main steps are as follows: Step 1: set a rectangle of the same size as the femur CT image.The long side of the rectangle, a, is used as the x-axis, and the short side, b, is used as the y-axis to establish a Cartesian system.The intersection point of the long and short sides is the origin, o, of the coordinate system.
Step 2: conduct a simulation experiment.Random points having a uniform distribution of X and Y on [0, a] and [0, b], respectively, are generated in the rectangular region.The number of points falling into the area contained in the lateral boundary curve of the cortical bone (white area in Fig. 10a) is m1, and the number of points falling into the non-cortical bone area (non-black area) is m2.Thus, the number of points falling into the non-black cortical bone area in Fig. 10b and the white medullary cavity area in Fig. 10c are m-m2 and m1-(m-m2), respectively.Assuming that the proportion of the femoral region to the rectangular region is α, the proportion of cortical bone region to rectangular region, αc, and the proportion of medullary cavity region to rectangular region, αc, are calculated as follows: Step 3: the estimated values of the cortical bone region, sc, and the medullary cavity region, sm, in the transverse section of the femur are calculated as follows:

Parameter setting of medullary cavity morphology
According to the requirements of the femoral prosthesis stem design, combined clinical experience and data analysis is needed to determine the range of CT data as well as the symbolic cross section.These mainly include the transverse section of midpoint of the lesser trochanter (the most outstanding point of the proximal femur cross-sectional, Cm0), the cross According to the Noble classification system [25], the canal-flare index (CFI) of the proximal femoral medullary cavity is an important parameter that reflects the morphology of the femoral medullary cavity.CFI refers to the ratio of the inner diameter of the medullary cavity 20-mm above the midpoint of the lesser trochanter to the inner diameter of the femoral isthmus.According to the CFI value, the proximal femoral medullary cavity can be divided into chimney (CFI<3.0),normal (3.0≤CFI<4.7),and champagne types (4.7≤CFI<6.5).However, the morphological parameters that are based on the single dimension of the coronal diameter ignore the sagittal diameter and other axial measurements, resulting in a mismatch between the femoral stem prosthesis and the medullary cavity.Therefore, according to the existing design requirements of the femoral stem prosthesis, the morphological parameters described in Table 1 were added to the ROI as its basic unit.
These parameters mainly included the ratio of the medullary cavity to the femoral region, q1; the ratio of medullary cavity to the cortical bone, q2; the growth rate of medullary cavity of the lesser trochanter, r1; and the growth rate of the medullary cavity of the upper femoral shaft, r2.These parameters can be used to comprehensively examine all the dimensions of the femoral cross section and can reveal the change rule of the femoral marrow cavity from proximal to distal ends in a more comprehensive, detailed, and vivid way.Growth rate of medullary cavity region at h2, defined as height between Cm1 and Cm0+20

Examples and analysis
The femoral CT data of a 50-year-old Han male patient having a height of 175 cm admitted to Changzhou First People's Hospital in 2015 were selected.Light Speed VCT helix scanning, produced by GE, was used.The main parameters were as follows: tube voltage 120 kV; tube current 300 mA; layer thickness 0.6 mm; layer spacing 5.0 mm; scanning time 1.5 s; display field of view 26.9×26.9cm; and CT matrix 512×512.According to the design requirements of the femoral stem prosthesis, 492 DICOM format images (Fig. 11(a)) were selected as experimental data.A Monte Carlo point experiment was implemented using Python v3.3 on a Windows-10 platform.The number of random points was 230,400 (four times the size of the 240×240 image), and its X and Y coordinates were integers between 0 and 239.Some of the parameters were measured using Mimics v15.0 software.The processor was an Intel® Core™ i7-950H processor at 2.60 GHz, and the memory was 8 GB.SPSS v24.0 statistical software was used for statistical processing of the experimental data.0.05 was considered to be statistically significant.

Verification of the ROI estimated by Monte Carlo
To verify the accuracy of the Monte Carlo method, it was compared to the traversal method.The statistical descriptions of αm and αc using the Monte Carlo and traversal methods are shown in Table 2. Fig. 12 shows the changes of αm and αc on different layers calculated by these methods.As can be seen from Table 2 and Fig. 12, the results obtained by the Monte Carlo method were basically the same as those obtained by the traversal method.To further verify the correctness of this conclusion, a single-factor ANOVA test was adopted, and the results are shown in Table 3.As can be seen, the significance of αm and αc obtained by the Monte Carlo and traversal methods was 0.999 and 0.996, respectively, when the significance level of 0.05 was selected.However, the results do not meet this condition, indicating that there was no significant difference between the two datasets.Therefore, using the Monte Carlo method to calculate ROI is reliable and feasible.

Calculation and analysis of medullary cavity morphology parameters based on ROI
According to the existing morphological parameters of the medullary cavity [11][12][13][14][15] , the personalized parameters of patients were measured as shown in Table 4.The CFI of the 50-year-old Han male patient was 4.09, which is normal.The results of the customized morphological parameters of the femoral marrow cavity in this study are shown in Table 5. Combining Figs. 13 and 14, it can be seen that the size of the medullary cavity area, sm, generally showed a trend of first decreasing followed by increasing.Judging from the layer number at which the minimum value appeared, it was roughly at 0.247 of the length of the femur.According to the literature [12] , the position of the isthmus of the medullary cavity was 0.250.The results of this paper are basically consistent with those results.Because the isthmus plays an important role in limiting the placement of femoral prosthesis in clinical practice, immediate fixation and distal stabilization of the prosthesis is often performed to mark the farthest position of the femoral stem in its implantation of the medullary cavity.This suggests that, to ensure good fixation, it is preferable to select the femoral stem length to be approximately 1/4 of the length of the femur.Additionally, it can be seen from Fig. 15 that, from the near segment to the far end, q2 first presents a downward trend then an upward one after passing the lowest point, C. At B and D, the ratio of the medullary cavity to cortical bone is one, indicating that the area of the medullary cavity and cortical bone was of equal size.The medullary cavity was larger than the cortical bone area on AB and DE and smaller than the cortical bone area on BD.This indicates that the proximal femoral cortex was thin in the bone and relatively thick in the isthmus.This suggests that the AC interval should be considered in the design of femoral stem prostheses.In the AB region, the thickness of the cortical bone was relatively small, and the medullary cavity was relatively large.Therefore, attention should be paid to the size of the femoral stem prosthesis to prevent it from penetrating the cortical bone.The area near point C is the narrowest part of the medullary cavity.It is thus necessary to pay attention to the farthest accessible position and size of the distal end of the femoral stem prosthesis.
Parameter sc provides the clinician with an indication of the expanding medullary.Based on the size of the isthmus cortex, appropriate reaming can be used to stabilize the femoral stem prosthesis at both the proximal femur and the isthmus.
This can avoid femoral shaft fracturing caused by blind reaming for the simultaneous fixation of the proximal femoral isthmus.During clinical diagnosis, sc can be compared with a healthy femur on the symmetrical side.If sc is significantly lower than the healthy femur, the bone strength of the proximal femur is decreased.If q1 increases at the same time, indicating a tendency of medullary cavity enlargement, the risk of fracture will be significantly greater than that of normal healthy people.Particular attention should be paid to the ratio of the medullary cavity to the femoral region at the lesser trochanter (0.4812 in this case) and to the ratio of the medullary cavity to the femoral region at the isthmus (0.1186 in this case), if there are plenty of healthy femoral bone marrow cavity data.Hence, the average value of sc and q1 of healthy femur in the symbolic cross section was calculated to provide more powerful data support for clinical diagnosis.
In this example, the number of CT slices between cross sections Cm1 and Cm0+20 was 237.Because the layer spacing was 5 mm, and the layer thickness was 0.6 mm, h1 can be calculated as h1=(237+1)×5+237×0.6=1,332.In this paper, based on the measurement of morphological parameters of the femoral medullary cavity using anatomical semantics and practical application requirements of femoral stem prosthesis design as the standard, a Monte Carlo method for analyzing the morphological parameters of the medullary cavity is proposed.First, the ROI of the femur was extracted, including that of the medullary cavity and the cortical bone region.Second, the size of the medullary cavity and cortical bone region was simulated.Finally, according to clinical needs, the morphological parameters of the femoral marrow cavity were calculated and analyzed using ROI as the unit.In this paper, from the perspective of the probability model, the problem of solving the ROI without randomness was transformed into one with randomness.Then, the morphological parameters of the femoral marrow cavity were simply and quickly calculated.The proposed method was compared to existing methods, as shown in Table 6.It was found that the research method presented in this paper was characterized by high degree of automation, simplicity, flexibility, and efficiency, considering the multi-dimensional information.

Discussion and Conclusion
Accurate and effective use of anatomical information contained in femoral CT data is critical to improving the quality and efficiency of personalized femoral stem design.In view of the deficiencies related to obtaining medullary cavity morphological parameters based on the personalized design of femoral stem prostheses, a Monte Carlo method was proposed to measure the parameters of the femoral bone marrow cavity.Using this method, the problem of solving the ROI of the cross section of femoral marrow cavity without randomness was connected with a probability model to transform it into a problem of randomness.The results show that the proposed method was reliable and feasible, and it had the following advantages.It was simple and efficient to calculate the ROI of an irregular shape, and it was easy to solve high-dimensional problems with strong reliability.The method proposed in this paper provides the necessary scientific theoretical support for morphologic research, design, and selection of femoral stem prostheses in clinical practice, and it has important significance and application to clinical practice.This method also provides a reasonable and reliable method for the prediction of bone related such as osteoporosis.A limitation of this study is that the mapping relationship between the morphological parameters of the femoral marrow cavity and the prosthesis parameters of hip joint was not established, but this will be further developed in the future work.
Femoral stem prosthesis to be implanted during hip replacement surgery Current methods for measuring morphological parameters of the femoral marrow cavity Binary image of femur (samples were taken from proximal to distal sections at ve intervals) Transverse view of the femur External boundary contour of femur (in red) Figure 11 CT data and symbolic cross section of femur Variation of αc and αm with layer numbers Variation trend of s, sc, and sm at each layer Variation trend of q1 at each layer Variation trend of q2 at each layer

Fig. 1
Fig. 1 Femoral stem prosthesis to be implanted during hip replacement surgery

Fig. 2
Fig. 2 Current methods for measuring morphological parameters of the femoral marrow cavity Fig. 3 Research framework
Fig. 10 ROI simulation: the total number of random points is M; the number of points falling into the femoral region in (a) is m1; the number of points falling into the black region in (b) is m2; the number of points falling into the cortical bone in (b) is m-m2; and the number of points falling into the medullary cavity in Fig. (c) is m1-(m-m2).

section 20 -
Fig.11CT data and symbolic cross section of femur Medullary cavity growth rate of small trochanter (pixel/mm)r1Growth rate of medullary cavity region at h1, defined as height between Cm0-20 and Cm0+20Medullary cavity growth rate of upper femur (pixel/mm) r2 Fig. 12 Variation of αc and αm with layer numbersTable 3 ANOVA of αm and αc calculated by Monte Carlo and traversal methods, respectively Coefficient Sum of squares Degrees of freedom mean square Significant αm Intergroup 0 1 0 0.999 Intra-group 0 1 0 0.999 0.320 982 0 αc Intergroup 0 1 0 0.996 Intra-group 0 1 0 0.996 0.027 982 0 / 2 mm.Combine values of corresponding parameters in Fig.13, r1 can be calculated as r1=(3,313-2,948)/40=9.125pixels/mm.Among these, the distance between cross sections Cm0-20 and Cm0+20 was 40 mm.r2=(3,313-428)/132.2=2.166pixels/mm.r1 and r2 indicate that the changes to the medullary cavity were significant in the lesser trochanteric region, and it decreased in the narrowest part of the medullary cavity.During the design process of the femoral stem prosthesis, the narrowing of the femoral marrow cavity from proximal to distal should, therefore, be fully considered.

) 1 Fig. 14 2
Fig. 13 Variation trend of s, sc, and sm at each layer Figure 3

Table 1
Morphological parameters of femoral marrow cavity c..

Table 2
Statistical description of αm and αc calculated by Monte Carlo and traversal methods, respectively

Total layers Average Standard deviation 95% CI for the mean Minimum value Maximum Lower limit Upper limit αm Monte Carlo method
layer numbers (from the proximal end of the femur to the distal end) Value

Table 4
Commonly used single-axial morphological parameters of personalized femoral marrow cavity

Table 5
Morphological parameters of personalized femoral marrow cavity defined in this article

Table 6
Comparison between method presented and traditional method