- Software
- Open access
- Published:

# THR Simulator – the software for generating radiographs of THR prosthesis

*BMC Musculoskeletal Disorders*
**volume 10**, Article number: 8 (2009)

## Abstract

### Background

Measuring the orientation of acetabular cup after total hip arthroplasty is important for prognosis. The verification of these measurement methods will be easier and more feasible if we can synthesize prosthesis radiographs in each simulated condition. One reported method used an expensive mechanical device with an indeterminable precision. We thus develop a program, *THR Simulator*, to directly synthesize digital radiographs of prostheses for further analysis.

Under Windows platform and using Borland C++ Builder programming tool, we developed the *THR Simulator*. We first built a mathematical model of acetabulum and femoral head. The data of the real dimension of prosthesis was adopted to generate the radiograph of hip prosthesis. Then with the ray tracing algorithm, we calculated the thickness each X-ray beam passed, and then transformed to grey scale by mapping function which was derived by fitting the exponential function from the phantom image. Finally we could generate a simulated radiograph for further analysis.

### Results

Using *THR Simulator*, the users can incorporate many parameters together for radiograph synthesis. These parameters include thickness, film size, tube distance, film distance, anteversion, abduction, upper wear, medial wear, and posterior wear. These parameters are adequate for any radiographic measurement research. This *THR Simulator* has been used in two studies, and the errors are within 2° for anteversion and 0.2 mm for wearing measurement.

### Conclusion

We design a program, *THR Simulator* that can synthesize prosthesis radiographs. Such a program can be applied in future studies for further analysis and validation of measurement of various parameters of pelvis after total hip arthroplasty.

## Background

Measuring the orientation of acetabulum cup and the wearing of insert on plain radiograph of patients who underwent total hip arthroplasty is important for prognosis[1]. Verifying the orientation measurement [1–6] and wearing [7–14] methods are both important, which may require a simulator to mimic every situation for such an analysis[1]. Mechanical simulator has once been reported in a study to measure the wearing of acetabular insert [7]. Although such a mechanical device is straightforward, there are disadvantages including expensive price, undetermined precision, as well as requiring image processing from radiograph to digital form. Every processing step may cause error and interfere with the final precision.

We thus developed our own *THR Simulator* [Figure 1] by designing a software program that can be used to generate digital radiographs directly. The early edition of *THR Simulator* software has been used to simulate 45 radiographs of total hip arthroplasties with 15 different anteversions ranging from 15°–29°, and then to verify the protractor which was designed to measure the anteversion of acetabular cup [1]. We have corrected some mistakes and incorporated some new features in the latest edition. We hope this program can provide researchers an easy instrument to develop further measuring methods that can be applied in plain radiograph.

## Implementation

Many reported methods used Fourier transformation to fasten the process in generating the radiographs from computed tomography data [15, 16]. However, Fourier transformation may decrease the precision, which is the first priority in the measurement analysis on plain radiographs. On the other hand, ray tracing, which is popular in computer game, may be suitable for this transformation. Unfortunately, current built libraries only provide reflection images instead of transparent images that are needed in our analysis. Therefore we have to build up our whole software program before practical application in the plain radiographs.

Another problem is physics, i.e., once X-rays beam pass through the prosthesis, they then generate the image on the radiogram film. The grey scale on the radiogram film is determined by the amount of the X-ray passed that is dependent on the thickness of the metal in the pathway. Such condition follows Beer-Lambert law.

Penetration = e^{-kbc}

*k*: molar absorbability

*b*: path length

*c*: concentration

The parameter *k* is different among various metals and radiation energy (*kv* in X-ray). In real X-ray machine, the distribution of *kv* follows the rule of normal distribution, which is different among various X-ray machines. After calculating the amount of X-rays passed, we need another formula to transfer them to grey scale.

Because too many parameters needed to be controlled to build up the software program, we tried another solution. We first took X-ray (63 kv, 17 mas) on the step-wedge phantom, made of titanium, which has 5 steps with an increment of 1 mm thickness from 1 to 5 mm [Figure 2]. Such a step-wedge phantom film was scanned. The grey levels on this X-ray radiogram were mapped as the optical density values. We measured the optical density of each of the 5 wedges as well as that of the film background. The mapping function, from metal width to greyscale, is fit by exponential function. The mapping function is shown in Figure 2.

Our goal is to build a simulated total hip prosthesis. Virtually, femoral head equals to a ball.

*x*
^{2}+*y*
^{2}+*z*
^{2}<*r*
_{
f
}
^{2}

(*x*, *y*, *z*) is the point of the simulated three-dimensional Cartesian coordinate system. *r*
_{
f
}is the radius of femoral head.

In our program, we make the ball move to simulate wearing of insert.

(*x*-*d*
_{
x
})^{2}+(*y*-*d*
_{
y
})^{2}+(*z*-*d*
_{
z
})^{2}<*r*
_{
f
}
^{2}

*d*
_{
x
}, *d*
_{
y
}, *d*
_{
z
}are femoral head movement in three directions.

Virtually, acetabulum is composed of two balls and one plane.

*x*
^{2}+*y*
^{2}+*z*
^{2}<*r*
_{
ao
}
^{2}

*x*
^{2}+*y*
^{2}+*z*
^{2}>*r*
_{
io
}
^{2}

*ax*+*by*+*cz*>0

*r*
_{
ao
}means radius of acetabulum's outer shell, *r*
_{
io
}means radius of acetabulum's inner shell, (*a*, *b*, *c*) means the normal vector of the acetabulum which can be derived from inclination and anteversion of acetabulum. Liaw et al. derived the following formula for this process.[17]

(*a*, *b*, *c*) = (sin*φ* × cos*θ*, -cos*φ* × cos*θ*, sin*θ*)

Vector (*a*, *b*, *c*) means the normal vector of the acetabulum, *φ* means the inclination of acetabulum, *θ* means the anteversion of acetabulum, positive *θ* means anteversion, and negative *θ* means retroversion.

Theoretically, the X-ray source is set at (0,0,-*d*
_{
t
}). *d*
_{
t
}means tube distance (the X-ray tube to the acetabulum center). The points at film are (*x*
_{
f
}, *y*
_{
f
}, *d*
_{
f
}). (*x*
_{
f
}, *y*
_{
f
}) means point at film. *d*
_{
f
}means distance from film to the acetabulum center.

(*x*, *y*, *z*) = (*t x*
_{
f
}, *t y*
_{
f
}, *t*(*d*
_{
f
}+*d*
_{
t
})-*d*
_{
t
}) 0<*t* <1

The ray-tracing algorithm means calculating every ray from X-ray source to film. We used formula (7), simulating every X-ray from source to film. We then determined the total length the X-ray beam passed through femoral head by calculating the length between the two extreme solutions of formulas (3) and (7). Finally, we came out at the total length the X-ray beam passed through acetabulum by calculating length between the two extreme solutions of formulas (4), (5), (6), and (7). We use analytical mathematics for these calculations. The detailed process is illustrated in Appendix section.

In summary, we first built a mathematical model of acetabulum and femoral head, formulas (3) to (7). The real dimension data was adopted to generate the proper prosthesis figure. Then we calculated the total thickness of metal the X-ray beams passed by the ray-tracing algorithm, and then transformed these digital data to grey scale by mapping function. Finally, the gray scale generated for the prosthesis was shifted according to the aforementioned method. We could generate various radiographs according to the different parameters used.

The functional parameters in the *THR Simulator* include the following:

Thickness: refers to the thickness of the acetabulum shell.

Film size: refers to the X-ray film size it simulates.

Tube distance: refers to the distance from X-ray tube to the acetabulum center.

Film distance: refers to the distance from X-ray film to the acetabulum center.

Anteversion: refers to the version of the acetabular cup. The user can choose either version (anatomical, radiological, or operational) to simulate. Negative value means retroversion.

Abduction: refers to the abduction (or inclination) of the acetabular cup.

Upper movement: refers to the femoral head moving upward.

Medial movement: refers to the femoral head moving medially.

Posterior movement: refers to the femoral head moving posteriorly.

Picture size: refers to the size of picture file to simulate.

## Results and discussion

Under Windows platform and using Borland C++ Builder programming tool, we developed the *THR Simulator* shown in Figure 1. In the *THR Simulator*, the user can incorporate many parameters before generating a simulated radiograph, i.e., with different parameters adopted, we can generate different radiographs. These can be used for further analysis.

As shown in Figures 1 and 3, we can obtain different simulated radiographs according to the parameters used. Thus we can demonstrate the function of such software, *Simulator*, in the application of the parameters.

Previously reported methods for measurement of acetabular cup orientation include mechanical simulator used for verifying insert wearing measuring methods [7], as well as other methods adopting Fourier transformation algorithm [15, 16]. These methods have their own disadvantages. The mechanical simulator can be used to generate radiographs directly but has some inherent problems. The simulation process takes much time, about 50 seconds with Pentium III 500 MHz notebook. On the other hand, other methods using Fourier transformation algorithm can do it in real time [15, 16] at the expense of lower precision. Thus we abandoned Fourier transformation algorithm and developed our own precise algorithm.

Our *THR Simulator* indeed improved the disadvantages of the above methods. The *THR Simulator* can incorporate several parameters for analysis at the same time. In practice, we can obtain the basic parameters from the prosthesis venders, i.e. shell diameter, shell thickness to generate simulated radiographs. Table 1 shows the parameters of total hip prostheses (U2, United Orthopedic Corp, Hsinchu, Taiwan).

To make simulated radiographs more real, users can superimpose the synthesized radiographs onto real radiographs. We do not routinely recommend doing so because this action may make users misread patient's position and thus confuse the standardization process[17].

The early edition of *THR Simulator* software has been used in two previous studies. One is to verify a new protractor in comparing with previous established mathematical method of measuring acetabulum[1]. We used the method in the earlier publication to simulate 45 radiographs of total hip arthroplasties with 15 different anteversions ranging from 15°–29°, and then verified the two methods of measuring anteversion of acetabular cup [1]. The mean errors of both measuring methods are within two degrees. Figure 4 shows how to measure the cup orientation with this invented method. The second study is to verify measuring insert wearing program. We use the earlier publication to simulate 64 radiographs with 2 different anteversion angles, 2 different abduction angles, 4 different superior wears, and 4 different medial wears. The errors are within 0.2 mm [18]. These results can also approve the precision of our *THR Simulator*. *THR Simulator* can provide researcher a new tool when developing their new device or new methods on measuring geometrical parameters of pelvis after total hip arthroplasty.

We use upper, medial, and posterior movements to indicate wearing of the three directions. Because femoral heads may not locate in the center of the acetabulum, the user should adjust these three vectors to fit every situation.

Our program can accommodate a three-dimensional wear vector by incorporating movements in the inferior-superior (upper), medial-lateral, and anterior-posterior directions. Inferior-superior and medial-lateral wears change the location of the femoral head relative to the cup while anterior-posterior wear changes the apparent size of the femoral head. However, the change in size is negligible.

Calculating wearing volume is another interesting issue. Kosak et al. has published a mathematical model to calculate it with the three wearing directions.[19]

## Conclusion

We designed new software *THR Simulator* that can generate radiographs after total hip arthroplasty. The strength is its accuracy and precision. The limitation is that it can not synthesize the details of the prosthesis and surrounding bone. We hope it can be used in future studies about measurements of geometrical parameters of pelvis after total hip arthroplasty.

## Appendix

Mathematical detail of calculating metal thickness

Equation (7) shows the line from X-ray source to the film.

We first change Formula (3) to Equation (3e).

(*x*-*d*
_{
x
})^{2}+(*y*-*d*
_{
y
})^{2}+(*z*-*d*
_{
z
})^{2} = *r*
_{
f
}
^{2}

Then we find the solution of *t* between Equations (7) and (3e). If there is no solution or only one solution, the thickness is zero, otherwise it means that the X-ray beam pass through it. From *t* we can calculate the real point using Formula (3), and then we can calculate the distance between the two points, which is the metal thickness the X-ray passed.

Similarly, we change Formula (4), (5), and (6) to Equations (4e), (5e), and (6e).

*x*
^{2}+*y*
^{2}+*z*
^{2} = *r*
_{
ao
}
^{2}

*x*
^{2}+*y*
^{2}+*z*
^{2} = *r*
_{
io
}
^{2}

*ax*+*by*+*cz* = 0

Then we find the solution of *t* between Equations (7) and (4e). If there is no solution or only one solution, the thickness is zero, otherwise it means that the X-ray beam pass through it. We keep the solutions of *t* in the solution set. Similarly, we find the solution of *t* from Equations (7) and (5e). Then we keep the solutions of *t* in the solution set if there are solutions.

We solve t from Equation (7) and Formula (6) and get the range of *t*, i.e. *t*>*rx* or *t*<*rx*, and *rx* is the solution of *t* from Equations (7) and (6e).

We exclude the solutions in the solution set outside the range of *t*. If the number of solutions in the solution set is odd, we append *rx* into the set.

Now we sort the solutions in the set, and pair the solutions with their neighborhood. We apply these paired *t* solutions to Equation (7) and get pairs of points.

Finally we add the distance of these pair points to we previously calculated distance intra-head. The sum is the total thickness the X-ray beam passed through the metal.

## References

Liaw CK, et al: A new tool for measuring cup orientation in total hip arthroplasties from plain radiographs. Clin Orthop Relat Res. 2006, 451: 134-9. 10.1097/01.blo.0000223988.41776.fa.

Fabeck L, et al: A method to measure acetabular cup anteversion after total hip replacement. Acta Orthop Belg. 1999, 65 (4): 485-91.

Ackland MK, Bourne WB, Uhthoff HK: Anteversion of the acetabular cup. Measurement of angle after total hip replacement. J Bone Joint Surg Br. 1986, 68 (3): 409-13.

Pradhan R: Planar anteversion of the acetabular cup as determined from plain anteroposterior radiographs. J Bone Joint Surg Br. 1999, 81 (3): 431-5. 10.1302/0301-620X.81B3.9067.

Visser JD, Konings JG: A new method for measuring angles after total hip arthroplasty. A study of the acetabular cup and femoral component. J Bone Joint Surg Br. 1981, 63B (4): 556-9.

Widmer KH: A simplified method to determine acetabular cup anteversion from plain radiographs. J Arthroplasty. 2004, 19 (3): 387-90. 10.1016/j.arth.2003.10.016.

Ebramzadeh E, et al: Accuracy of measurement of polyethylene wear with use of radiographs of total hip replacements. J Bone Joint Surg Am. 2003, 85-A (12): 2378-84.

Livermore J, Ilstrup D, Morrey B: Effect of femoral head size on wear of the polyethylene acetabular component. J Bone Joint Surg Am. 1990, 72 (4): 518-28.

Hardinge K, et al: Measurement of hip prostheses using image analysis. The maxima hip technique. J Bone Joint Surg Br. 1991, 73 (5): 724-8.

Shaver SM, et al: Digital edge-detection measurement of polyethylene wear after total hip arthroplasty. J Bone Joint Surg Am. 1997, 79 (5): 690-700.

Martell JM, Berdia S: Determination of polyethylene wear in total hip replacements with use of digital radiographs. J Bone Joint Surg Am. 1997, 79 (11): 1635-41.

Collier MB, et al: Evaluation of contemporary software methods used to quantify polyethylene wear after total hip arthroplasty. J Bone Joint Surg Am. 2003, 85-A (12): 2410-8.

Devane PA: Measurement of polyethylene wear in metal-backed acetabular cups. I. Three-dimensional technique. Clin Orthop Relat Res. 1995, 303-16. 319

Geerdink CH, et al: The determination of linear and angular penetration of the femoral head into the acetabular component as an assessment of wear in total hip replacement: A COMPARISON OF FOUR COMPUTER-ASSISTED METHODS. J Bone Joint Surg Br. 2008, 90 (7): 839-46. 10.1302/0301-620X.90B7.20305.

Calhoun PS, et al: Three-dimensional volume rendering of spiral CT data: theory and method. Radiographics. 1999, 19 (3): 745-64.

Muniyandi M, et al: Real-time PC based X-ray simulation for interventional radiology training. Stud Health Technol Inform. 2003, 94: 233-9.

Liaw CK, et al: A simple mathematical standardized measurement of acetabulum anteversion after total hip arthroplasty. Computational and Mathematical Methods in Medicine. 2008, 9 (2): 105-119. 10.1080/17486700701865265.

Liaw CK, et al: Automatic digital PE wear measurement. AAOS annual meeting. Washington. 2005

Kosak R, et al: Polyethylene wear in total hip prostheses: the influence of direction of linear wear on volumetric wear determined from radiographic data. Skeletal Radiol. 2003, 32 (12): 679-86. 10.1007/s00256-003-0685-2.

### Pre-publication history

The pre-publication history for this paper can be accessed here:http://www.biomedcentral.com/1471-2474/10/8/prepub

## Acknowledgements

We thank United Orthopedic Corporation, Hsinchu, Taiwan for providing us technical data of U2 total hip arthroplasty.

This study was supported by the grant of NSC96-2320-B-087-001, Taiwan, ROC.

## Author information

### Authors and Affiliations

### Corresponding author

## Additional information

### Competing interests

The authors declare that they have no competing interests.

### Authors' contributions

TYW and RSY designed the study. TYW gathered the data. CKL, SMH and RSY analyzed the data. CSF wrote the initial drafts and CKL ensured the accuracy of the data and analysis.

## Electronic supplementary material

## Authors’ original submitted files for images

Below are the links to the authors’ original submitted files for images.

## Rights and permissions

**Open Access**
This article is published under license to BioMed Central Ltd. This is an Open Access article is distributed under the terms of the Creative Commons Attribution License (
https://creativecommons.org/licenses/by/2.0
), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

## About this article

### Cite this article

Wu, TY., Yang, RS., Fuh, CS. *et al.* THR Simulator – the software for generating radiographs of THR prosthesis.
*BMC Musculoskelet Disord* **10**, 8 (2009). https://doi.org/10.1186/1471-2474-10-8

Received:

Accepted:

Published:

DOI: https://doi.org/10.1186/1471-2474-10-8