## 2 Materials and Methods
Segmentation on mimics relies on thresholding, which plays a pivotal role in accurately distinguishing bone tissue from the surrounding structures within the CT images. An appropriate selection of the Hounsfield Unit (HU) threshold, typically within the lower end of the spectrum at around 400 HU, using Mimics' thresholding tool, was used for non-bone tissue elimination. This threshold value directly influences model quality, as it dictates the differentiation between bone and non-bone pixels. Striking a balance between  
Figure 1: [PERSON]’s tumor resection classification [22]. minimizing model noise and maximizing bone model completeness while preserving anatomical fidelity is crucial. An excessively low threshold can introduce unwanted noise, while an overly high threshold risks generating incomplete models with significant gaps. In every case, subsequent refining of the bone models is carried out. The bone-model refining process begins after forming a preliminary 3D bone model, with the next step being the isolation of individual bones, including the left and right pelvic girdles, left and right femurs, and the sacrum. To achieve this, the split mask tool is employed, which involves manually identifying the boundaries between adjacent bones on 2D CT slices across the frontal, sagittal, and transverse planes. This tool traces bone boundaries based on each pixel's HU value, guided by the manually marked lines. In cases where metal implants cause noise similar in intensity to the bone, as seen in areas like the acetabulum-femur head and pelvic girdle-sacrum regions, precise slice-by-slice boundary marking is essential for creating an accurate bone model. Figure 2: Radiological examination of two representative patients, one selected for a 3D-printed custom implant (**a**) and one for the bone graft implant (**b**). Pre-operative frontal radiograph (top images), post-operative frontal radiograph at 6 month follow-up (middle images), and CT scan (bottom images). Notice how the CT in (**a**) has a larger area of high signal intensity in the pelvis, which represents the massive pelvic implant compared to the CT in (**b**) with a smaller area of signal intensity representing the acetabular cup and bone graft in the pelvis. Once the bones are isolated, there may be gaps in the contour that need to be filled. For smaller gaps, the smart fill tool is used to automatically merge nearby pixels, with adjustments made based on the sharpness of the bone features. Sharper features, like the femur head, require a smaller-radius brush, while smoother areas need a larger-radius brush. More-complex gaps are filled with the edit mask tool, which operates on a slice-by-slice basis. The multi-slice edit tool is also employed for non-complex gaps, using interpolation across slices to close gaps while potentially overlooking intricate details. Typically, the multi-slice tool is used first for general modifications, followed by the edit mask tool for more precise refinements. Alternating between these tools helps ensure that both large and small features are preserved. However, as a result of the excess noise from the metal implant in the femur, which completely merges the noise with the surrounding bone, it is still impossible to segment the greater trochanter on Mimics innovation suite. That is why greater trochanter recreation is carried out on the side of the implant. Greater trochanter recreation makes use of the healthy femur and the feature-based alignment tool available from Geomagic Control 2014.3.0 (3D Systems, Rock Hill, SC, USA). First, a copy of the healthy femur is made and is mirrored, given the bilateral symmetric nature of the human anatomy. Then, the shaft of the femur is selected, and a best-fit cylinder is created. This built-in feature of the software uses a least-squares algorithm to ensure that the positioned cylinder is in the closest orientation to all of the points in the selected area.