Matching X-ray and DRR Images
The process of matching the DRR images to the X-ray images is sensitive to the image processing parameters in the //X-ray/DRR Settings// widget. Once the DRR images have been generated for a particular set of bone poses the DRR images and the X-ray images are processed (using an identical method) and then compared to each other. The algorithm used to compare them, called the //image metric//, can be selected in the //Object Tracking// widget.
The processing method consists of:
- performing a Sobel edge detection on the image,
- thresholding the edge-detection image (which is controlled by the Edge Capping values in the //X-ray and DRR Settings// widget),
- multiplying the edge-detection image by a weighting factor (which is controlled by the Edge/Intensity Merge value in the |//X-ray and DRR Settings// widget) and adding it to the original image, and
- thresholding the merged image
Pixels in the edge image whose values are greater than the Edge Capping maximum are set to zero. Very bright pixels (sharp edges) are usually inorganic objects like EMG electrodes or metal plates or wires. They can be removed from the edge image by lowering the Edge Capping maximum from 100%.
Every pixel in the edge image whose value is above the Edge Capping minimum is set to the Edge Capping minimum. This effectively strengthens weaker edges (those below the Edge Capping minimum) because the entire image is scaled later. For example, if the Edge Capping values are set to 5% and 30%, every pixel in the edge image with an intensity that is greater than 30% of the total image intensity range is set to 0. Every pixel with an intensity that is between 5% and 30% of the intensity range is given an intensity of 5%. The resulting edge image has all pixels between 0 and 5% of the intensity range of the original edge image, with many of the edges of interest set to a value of 5% of the intensity range, making them all equally strong.
After the edge image has been weighted and added to the original image, the result is thresholded using the Image Threshold values. All pixels above the Image Threshold maximum are set to the maximum, and all pixels below the Image Threshold minimum are set to 0. Much of the time these thresholds should be left at 100% and 0%. However, there are times when it is useful to raise the minimum above zero to mask soft tissue regions, and lower the maximum from 100% to remove artificial edges, such as the end of a CT bone that is within the X-ray image.
The success of the bone tracking algorithm is particularly sensitive to the Edge Capping minimum for the X-ray images. A change in this value of 2 or 3 (percent) can make a big difference in the solution found by the optimization. If you find that the optimization is locking into a bad pose with the edge capping minimum set to 10%, try lowering the minimum to 7% or 8% (or even 5%) and try again.
When you start processing a new data set, it can take some trial and error to figure out the set of image processing parameters that produce the best results. It is recommended that you start by tracking the bones (individually) in a single frame, trying different parameter values until the optimization algorithm can lock onto the correct pose for each bone. Then try solving a few adjacent frames to see if the same parameter values work on those.