# X4D HowTo Optimize Xray DRR Settings

Language: |
English
• français • italiano • português • español |
---|

To make it easier to find the best set of parameter values for a particular trial, the *Image Optimization* widget performs a simulated annealing optimization on the 15 parameters. To use it, follow these steps:

- Select a single object for which to optimize the image settings.
- Choose an X-ray frame in which the object is fairly easy to see.
- Manually move the object into the correct pose as best you can.
- In the
*Object Tracking*widget, select the desired image metric and perform a quick optimization (about 1000 iterations with ranges of 1 mm and 1 deg) to fine-tune the pose. If this optimization makes the pose worse, go back to the manually adjusted pose. - Set the tracking optimization ranges to larger values (e.g., 3 mm and 3 deg) and keep the number of iterations at about 1000.
- In the Image Optimization widget, set the max iterations value. A value between 200 and 500 is recommended. This is the number of tracking optimizations that will be performed on the current object in the current frame. Each of these optimizations will use a different set of image processing parameters and will run for the number of iterations specified in the
*Object Tracking*widget. Use the time needed to perform the optimization in step 4 to calculate how long the image optimization will take for a given number of iterations, then set max iterations to as high a number as you want to wait. - Set the ranges of the image processing parameters (the X-ray and DRR settings as well as the image metric parameters) to values appropriate for the current frame. You may want to experiment with the X-ray and DRR settings in the
*Xray/DRR Settings*widget to get a sense of how they affect the images. For parameters that have a large effect on the images (e.g., X-ray Min Edge), set their ranges smaller so that the optimizer focuses more on the optimal region. - Press
*Optimize*to start the optimization. For each iteration, a simulated annealing algorithm will randomly choose values for the parameters within the ranges you specified, then perform a tracking optimization starting from the bone pose you specified at the start. The goal is to find a set of parameter values such that the initial pose is the optimal solution of the image metric function. - When the optimization is finished, the image processing parameters will be set to their optimal values-- the values that caused the tracking optimization to lock-in on a pose closest to the initial pose. The object will be returned to its initial pose, but the output window will show how close the "optimal" pose was to the initial pose (sum of the squares of the DOF differences). If the optimal pose is not close enough, you can try changing the parameter ranges and/or the image metric and performing another image optimization. If the pose is close enough you should perform a tracking optimization with more than 1000 iterations (and possibly larger DOF ranges) to make sure the parameter values work well in more situations.

**Note**: For any given X-ray frame and object, there is no guarantee that there exists a set of image processing parameters such that the correct pose is the global minimum pose. This is because of the inherent differences between the X-ray and DRR images and the quality and extent of the CT data. There is also no guarantee that the optimal parameters for one frame will work on any other frame. However, image optimization is still often useful for finding a neighborhood of parameter values that improve the performance of the tracking optimization.