2D/3D Registration with Rigid Alignment of the Pelvic Bone for Assisting in Total Hip Arthroplasty Preoperative Planning

In Total Hip Arthroplasty preoperative planning requires the definition of medical parameters that help during the intraoperative process; these parameters must be allocated with accuracy to make an implant to the patient. Currently, preoperative planning carries out with different methods. It can be by using a prosthesis template (2D) projected on xray images or by using a computed tomography (CT) in order to set a 3D prosthesis. We propose an alternative developing preoperative planning through reconstructed 3D models using 2D x-ray images, which help to get the same precise information such as a CT. On this paper it has proposed to test the framework from the authors Bertelsen A and Borro D, it is an ITKBased Framework for 2D-3D Registration between x-ray images and a computed tomography. We used the approach of this paper using two fixed images (reference images) and one moving image (image to transform) to do a intensity registration. This method uses a ray casting interpolator to generate a Digitally Reconstructed Radiograph (DRR) or virtual x-ray. We also applied a normalized gradient correlation for comparing the patient x-ray image and the virtual x-ray image optimized by a nonlinear conjugate gradient, both metric and optimizer are useful to update rigid transformation parameters which have an additional scale parameter which produced better results such as 0.01855mm on the alignment of relocated reference volume and 15.5915mm on the alignment of deformed and relocated reference volume of Hausdorff distance between both models (reference volume and transformed volumetric template). Keywords—Digitally Reconstructed Radiograph (DRR); intensity registration; rigid transformation; 3D models; Total Hip Arthroplasty (THA); preoperative planning; Computed Tomography (CT)

Abstract-In Total Hip Arthroplasty preoperative planning requires the definition of medical parameters that help during the intraoperative process; these parameters must be allocated with accuracy to make an implant to the patient. Currently, preoperative planning carries out with different methods. It can be by using a prosthesis template (2D) projected on xray images or by using a computed tomography (CT) in order to set a 3D prosthesis. We propose an alternative developing preoperative planning through reconstructed 3D models using 2D x-ray images, which help to get the same precise information such as a CT. On this paper it has proposed to test the framework from the authors Bertelsen A and Borro D, it is an ITK-Based Framework for 2D-3D Registration between x-ray images and a computed tomography. We used the approach of this paper using two fixed images (reference images) and one moving image (image to transform) to do a intensity registration. This method uses a ray casting interpolator to generate a Digitally Reconstructed Radiograph (DRR) or virtual x-ray. We also applied a normalized gradient correlation for comparing the patient x-ray image and the virtual x-ray image optimized by a nonlinear conjugate gradient, both metric and optimizer are useful to update rigid transformation parameters which have an additional scale parameter which produced better results such as 0.01855mm on the alignment of relocated reference volume and 15.5915mm on the alignment of deformed and relocated reference volume of Hausdorff distance between both models (reference volume and transformed volumetric template).

I. INTRODUCTION
The Total Hip Arthroplasty (THA) surgery is applied mostly to older people, which has some pains in joints, commonly in the hip, and it is the part most affected of the body. THA surgery requires accurate data from the patient to set correct prosthesis location and size. Another type of data is a preoperative digital x-ray image (2D Planning), which uses specialized software, for instance, "Orthocad", which is a tool where established the correct size of a prosthesis. There exists a planning tool using CTs, where the measures are more precise, and it creates a 3D prosthesis on the volume generated from the CTs. As mentioned Sariali in [1], there exists some assessment where he made a comparing between planning in 2D using radiographs and 3D templates using CT scans. It fixes position parameters such as femoral offset, the center of head femur, distances from great trochanter to the center of the femoral head, and distance from lesser trochanter to the neck osteotomy. These parameters let us set the size and the position of the prosthesis. So Sariali shows that 3D planning is better in 96% than 2D plan, which only gets 16% of accuracy to establish stem and cup. In 2d planning, the hip anatomy is not accurate because of the torsion, and bone hardness does not exist on the 2d plan, and Surgeons need it to avoid lower limb discrepancy.
There exist different works in order to use conventional x-ray images in order to establish precisely data of prosthesis, building a volume with a volumetric template and the x-ray images with intensity registration technique [2], [3], [4], [5], [6], [7], [8], [9], [10], it results in less cost and not exposure radiation to the patient [11]. Exist another type of reconstruction using characteristics or landmarks [12], [13], [14], [15], [16], [17] this work required previous manual segmentation of the evaluated structured. In the case of using the intensity information, it doesn't require a previous segmentation, the image is entered in original form so it is an advantage in order to establish a correct volume.
It is crucial to know what types of views of the patient's x-ray images are suitable for this job, so specialists required some kinds of x-ray in a total hip arthroplasty, depending on the symptoms required in different views in order to recognize the illness condition. There exist multiples views [18]; for instance, important views are Anteroposterior, Outlet, Inlet, Alar, and Obturator view. In this case, it needs to know the correct angle of the selected view in order to generate the virtual x-ray; these were analyzed on [19]. There exist another impressive view, which is a lateral view using in THA preoperative planning in [20]. In some cases, the Judet view or antero-posterior view (AP view) the specialist doesn't view fractured of the acetabulum. In the posterior column of the pelvis, there exist some displacements or discontinuity. It only requires setting up the patient in the lateral decubitus position with the affected side toward the x-ray cassette. The x-ray centers in the posterior of the hip. In the case of surgeries components, the patient can be rotated 10 to 20 degrees away from the right lateral. So the lateral view (LT view) is easy to obtain, and we use this configuration to generate the virtual (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 11, No. 5, 2020 x-ray. Nevertheless, it could have sensitive changes on tilt and rotation parameters, as mentioned Tannast in in [21].
It tested two implementations, which make 2d-3d registration. This work was from ITK journal publications 1 .
The first paper is called: ITK-based implementation of two Projection 2D-3D Registration Method with an application in patient setup for external Beam Radiotherapy by Jian Wu [22]. It talks about radiotherapy using registration process between preoperative patient volume and the current volume in radiation process with the aim to adapts rays to the tumor form applying transformations made with a C-ARM tomography.
The second paper is by Bertelsen and Borro [23]. It uses a medical linear accelerator, which is a type of machine that produces CT (anthropomorphic cranial phantom). It appends to the base of ITK registration some approaches. The first approach is the metric, which is the Normalized Gradient Correlation from two images to one image. Nevertheless, it only uses the value metric, and it does not use derivative value. Another important point in the generation of digitally reconstructed radiographs (DRR), this method includes image orientation, which is essential to generate virtual images in any direction; this new interpolator was called Patched Ray Cast. It used a Euler transformation, but in this case, we used a similarity transformation to include scale parameter.
The paper is organized as follows: Section 2 presents the methods with subsections of the preparing the virtual x-rays and the volumetric template and the general properties that is used for registration process. In Section 3, we present the two experiments with relocated volume and deformed relocated volume. The validating process on 3d model, transformation parameters, and cost function is showed in Section 4. Finally in Section 5 gives the conclusions.

II. METHODS AND PROCEDURES
The whole process is following the new scheme of work based on Bertelsen A., Borro D work which is an ITK-Based Framework for 2D-3D Registration with Multiple Fixed Images.
The first process consists of deformed and alignment with a volumetric template, which obtains from the Visible Human Project from the Iowa University (moving image) [24] with the x-ray image (fixed image). The model should transform in a 2d image, this image interpolates using ray casting interpolation to produce a virtual x-ray, in other work such as "simulating x-ray images from deformable shape and intensity models on the GPU" by Moritz Ehlke [25], using statistically shape and intensity model (SSIM) [26]. They applied ray-casting by using some intensity volume which contains intensity information in the tetrahedral faces from the volume. In this work, it uses the interpolator with the method "Siddon Jacobs Ray Tracing" by Filip Jacobs in [27].
The second process registers the moving image to the fixed image through the intensity registration process. It gets neighbor intensities from the current pixel evaluated to establish the closest intensity value to achieve the intensity of the fixed image, there exist some works which use intensity registration 1 http:insight-journal.org such as [28] where use registration on fluoroscopic images in order to set the hip joint kinematics or using non rigid registration which use b-splines method [29].
To insert the criteria of an image comparing it requires a metric value, in this case, it uses a normalized gradient correlation (NGC) using a neighborhood operator called Sobel operator applying in every axis or dimensions of the images, such as mentioned Penney on this work [30] the NGC metric filters soft tissues and focuses only on bones data. Nevertheless, this metric does not avoid the high intensities such as surgery instruments on x-ray images.
It is encapsulated by the optimization process, which with a cost function called Fletcher-Reeves-Polak-Ribiere optimizer [31], it gets the correct transformation parameters using the derivatives or changes between every pixel of the images. The optimization has the number of iterations, the step length, and the step tolerance, which allows establishing boundary conditions to stop the optimization and return the actual transformation parameters.
This process is iterative in the work of getting the best transformation parameters, the type of transformation used is a Similarity Transformation [32] where use a versor form on rotation parameters [33] (which avoid a gimbal lock) and isometric scale parameter (which is equal in all axis), and these parameters transformed the volumetric template, interpolating the 3d image with these parameters. It generated a new DRR in every resolution and made the same process until achieving the minimum threshold error or until complete the number of iterations.

A. Establishing the Virtual X-ray Fixed Images
To establish the DRR, we use an interpolator with a ray casting method [27]. It consists of traverse a ray into the volume, then integrates the different intensity values which intersect the current ray, it is saved on the 2d virtual image and use a correct threshold to work only with the specific data (bones) of the volume data.
Parameters were the next: Pixel Spacing, Dimension output, Distance of ray source, Translation and Rotation Parameter of the camera, 2d projection normal position, the center rotation relative to the center of volume and threshold.
In order to get a virtual x-ray with specific data, the volumetric template needs preparing its label map obtained by the semiautomatic segmentation process by the "3D slicer" tool, it used arithmetic filter for multiplying label map with the whole original volume. So it gets a segmented volume with only the region of interest, in this case, the pelvic without sacrum but with the intensity information. The result could be observed in Fig. 1.

B. Selected Properties in Registration Process
For virtual x-ray image generation it used an isocenter which sometimes is equals to the center of the volume. So according to the size of the "Test Volume", every axis were divide in two parts so the result is the center of the volume. As size of volume is (333, 181, 245)vx so the center is configured in (166, 90, -122)vx but there exist some displacement in order to project the image and center is modified according to the  Fig. 1a Simulated X-ray from Volumetric Template. It has a size of (333,245) mm, resolution of (1,1) mm, Focal Point (0,-1000,0) mm, Distance from Volumetric Template to Simulated X-ray (-124) mm and Orientation (90, 0, 0) degrees. In Fig. 1b. Simulated X-ray from Volumetric Template. It has a size of (181,245) mm, Resolution of (1,1)mm, Focal Point (-1000,0,0) mm, Distance from Volumetric Template to Simulated X-ray (200) mm and Orientation (90, 90, 0) degrees angle of projection. In case of AP view It used 'Y' axis so in keeps its original value and the isocenter for AP view is (166, -124, -122)vx. In the other hand, in case of LT view, 'X' axis was used given an isocenter (-200, 90, -122)vx. So It compared with the original projection on 2D plane with the 3D render in order to view the same image before applying the registration process. It has different focal distance because in every projection because the input volume has different number of voxels in every dimension. 200mm for AP view and -124mm for LT view.
In the AP view the first value is the corner (166mm) on x axis, the second (-124mm) is the corner on y axis (is the depth with respect the volume) and last (-122mm) is the corner on z axis. In the LT view (-200) is the depth and (90, -122) are the y and z axis.
In generation of virtual images there exist different parameters in order such as size, resolution(spacing), center of the image (2dcx), distance from source to the center of the volume (SCD), center of the volume(isocenter) and the projection angle (RP). There exist other important parameter which is the distance from volume to x-ray plane. the relation according to default example was 200mm from volume to the image and 1000mm from volume to the source. So the virtual fixed images resulted were translated 200mm from the volume for both views AP and LT initially.
The AP view was separated from the template volume 200 mm of the internal center. Its origin has LIA orientation so it is located in left inferior anterior corner to the volume. The origin is given by (166 -124 -122)mm. The pixels quantity is (333, 245)px with an spacing (1,1)mm. The result image will be only one slice in sagittal view. The focal point where the observer or the ray begins will be in order to project the virtual image is located in (0, -1000, 0) The LT view is separated 124mm from the center left to the template volume. It considering the angle of projection 90 positive degrees. It also has and origin with PIL orientation. This center is located in the posterior inferior left corner. So the origin was located in (-200 90 -122)mm. The number of pixels on the image is (181,245)px with spacing of (1 1)mm. The result was only one slice in coronal view. The focal point where the observer or the ray begins will be in order to project the virtual image is located in (-1000, 0, 0) Many times, It was established a general setting for x-ray image generation for 2 views, but it is necessary a particular setting for every view, it is due to different projection, it sometimes will be close or so far to the volume because the volume has different size in every axis which gives this unbalancing in the metric.
In order to solve this problem, it varied the distance from the source to the center of volume, it could be observed better in Fig. 2, this correction is applied in the AP view because this view has a little contribution to the metric, the variation is limited when the distance from the source to last slice of volume will be the same. In this case the difference is 109mm and 33.5mm for every view respectively, it uses the minimum difference 33.5mm (LT view) and replies in the AP view. If it adds half distance in the axis 'y' to minimum difference, it will give 124mm from source to the isocenter.
The first criteria is doing this balancing according to the cost function. Furthermore the histogram which helps to view the intensity values from different views.
Fix distance from source to isocenter  In these experiments, it tests sensibility checking the difference of seven transformation parameters between the reference volume and the volumetric template. It analyzes the error difference of every transformation parameter. Finally, it checks the final volumes comparing its overlapping and getting the Hausdorff distance between them.

A. Registration Test with Reference Relocated Volume
This test gives a close view than how well the registration process is developing because it used the same information for the fixed and moving image. It only transformed the volumetric template to obtain a reference relocated volume. It chooses the worst registration (18th registration) of the set of registrations (20 in total) to analyze the bounds of the registration process.
The reference relocated volume could be observed in Fig.  3. This volume compared with the volumetric template is rotated -6.12°to the left side, -7.92°rotated in its z-axis, -5.44°r otated forward, In translation it was translated -7.68mm away from the origin, 7mm up to the origin, 8.57mm translated to the left, the scale was reduced 1.18mm.
The difference or subtraction between projected volumetric template in gray color and projected reference volume in white color could be observed in Fig. 4, in the middle of the first row on the left.
After the registration process, it observed in Fig. 4, in the middle of the second row on the left, the difference between the projection of the volumetric template and relocated reference volume, as it can see, the subtraction shows perfectly the overlapping between both volumes. Further, it obtained 0.0230085 of Hausdorff distance. When it considered the 20 tests, an average value Hausdorff distance of 0.01855mm was obtained.
It also shows the respective error values in Table I. It shows the most difference in translation Y, but with close values, the target was 7.01mm. Meanwhile, the register value was 6.89mm. Finally, it could observe the final overlapping between the transformed volumetric template and the relocated reference volume in Fig. 4, in the middle of the last row on the left.

B. Registration Test with Reference Deformed and Relocated Volume
It has chosen a test that has a vast amount of error to describe what conditions produce this and how to resolve the problem. This test was the eleventh test between 20 tests. All of these tests are crucial because they have extra information (femur and sacrum bone) on the fixed images.
The input volume or "Reference Volume" was deformed in an interval [-11,11]mm with a random BSpline transform, and it was relocated for the volumetric template, as observed in Fig. 3 in the second row. The new position is in rotation [0.0006º, -0.04º, 0.02º] for x,y,z-axis respectively. It was translated with [2.77, 0.44, -2.28]mm, and it is scaled with 1.03 units of the original size volumetric template.
The difference between fixed images and the moving image could be observed in Fig. 4 in the middle of the first row on the right, the darkest part is for the volumetric template, and the brightest part is for reference volume.
When the registration process completes, it can observe those final subtractions between reference volume and volumetric template in Fig. 4 in the middle of the second row on the right, which has bright areas that are not covered for the volumetric template. It is due to the volumetric template is entirely different from the reference volume by initial deformation. If the reference volume were only deformed, it would show the initial difference, which does not allow the complete superposition.
The metric with the same information moving and fixed images could achieve as maximum value 2.0, but when the metric works with different information images with fewer parts or structures (sacrum, left, and right femur), it reduces the metric, so it achieves as maximum value 1.0. This value was observed in the experiments. So if the metric is closed to 1.0 is a useful metric.
It could be observed that there are more errors in rotation 'Y' and 'Z' and in translation 'Y' and translation 'Z' and www.ijacsa.thesai.org slightly in rest parameters. It could be observed error values in Table I. Finally, a comparative between volumes is made by using superposition, which is observed in Fig. 4, in the middle of the last row on the right. it obtained 17.39mm of Hausdorff distance on this particular test but when it considered the 20 tests, an average value Hausdorff distance were 15.5915mm was obtained.

A. 3D Models Validation
To compare the difference between the two volumes, it used the Hausdorff distance. It helps to set the appropriate metric for registration accuracy.
It could be observed in Fig. 5, the Hausdorff distance of every registration using the relocated reference volume and volumetric template, as it can see, the best registration process was the 4th registration with 0.015mm of accuracy and the worst registration was the 18th registration with 0.023mm of accuracy. The average Hausdorff distance in this set was 0.01855mm On the other hand, in Fig. 5, the second set of registration, using the relocated and deformed reference volume and volumetric template, the best registration was 12th registration with 14.31mm of accuracy, and the worst registration was 11th registration with 17.39mm of accuracy. The Hausdorff distance average in this set was 15.5915mm.

B. Transform Parameters Validation
In Fig. 6, it shows the difference of transformation values, according to the deformed and relocated reference volume. The least quantity of error distribution was for rotation and scale parameter. In the case of rotations, for X rotation, its Hausdorff Distance(mm)  egrees, it has a balanced distribution. In Y rotation, its median was 0.27°degrees and a maximum value of 0.68°d egrees, its distribution is very close to X rotation, and its distribution is more frequent below the median. In the case of Z rotation, it gives more error quantity. The maximum error achieves 75% of all data was 1.75°degrees, and its median was 1.49°degrees. It has an outlier of 2.59°degrees.
Similarly, the translation had more error, it was Z translation with a maximum error of 1.57mm, and its median was 1.18mm, it has a compact distribution because from its median to 75% of data. In the case of Y translation, its median was 0.62mm and a maximum error of 1.64mm, which is another outlier, but with 0.77mm because it is more probable distribution. In the case of X translation, it has a median of 0.40mm and a maximum error of 1.12mm. It has a distribution more probable below its median, and it achieves 25% of data the error of 0.22mm.
The last option, in scale parameter, represents the less www.ijacsa.thesai.org

C. Cost Function Validating
After registration process, it is possible to analyze the value of metric varying the value of transformation parameter, it is alter with interval of transformation values, it also applied a step size and view the contribution for every fixed image or combine views (AP and LT views). The contribution varying one transformation parameter on 11th Registration using Relocated Volume could be observed in the next Fig. 7a, 7b.
In every diagram it established the metric value of registered volume and metric value of reference volume. It can be observed that in the translation 'y' and 'z' and rotation 'z' there is a wide error because metric value of reference volume is far from metric value of registered volume. In the rest of parameters are good because both metric values are similar.
As mentioned before, this difference is due to exchange of roles between scale and translation, when the registration updating the seven parameters it updates equally these parameters according to the metric, but sometimes there exist some issues with scale and translation because there exists a competition between them. If some of the translation parameters achieve faster its optimal value after scale parameter, it produces a big error because changes in translation on the 'z' or 'y' axis are right changes because it decreases the size of the projected image and the scale takes other wrong value. If change optimizer parameters or increase the number of iterations in order to achieve a right value of the scale, it will be in vain, the scale parameter never achieves its right value because of the translation parameters already have its right value before the scale.
So the correct form to use the similarity transformation is that scale has the right value more quickly than the translation parameter, It is achieved by making the scale have more variation of change in the initial scale parameters and so the scale achieves its value more quickly than rest of parameters.

V. CONCLUSIONS
The present work shows that rigid registration is basic in order to initial alignment because it not always our template will be in the correct magnification or center in the center according to the center of the radiographic. This article helps to give a guide in what parameters are required on fixed images when it uses synthetic data. It set the relation between template volume (moving image) and the x-ray images (fixed images) by establishing a correct focal point. Also, the dataset and the new framework can be evaluated from here: https://github.com/chiconasa3000/2D-3D-RegistrationTool. The rigid process was used with CPU on Workstation Intel Xeon E5-2643 v3 (30 MB Cache, 3.40 GHz), and it lasted 579.64 seconds or 9.66 minutes for 11th registration.  Fig. 7a the Rotation z has a Considerable difference it is because of the Initial difference between Deformed and Relocated Volume it always appears even if the Registration was Developing well. In Fig. 7b. Translation 'Y' and 'Z' also shows a Big difference due to Exchange of Roles between Scale and Translation.