CalibrateDSX: Correcting Images and 3D Calibration

From Software Product Documentation
Jump to navigation Jump to search
Language:  English  • français • italiano • português • español 

This is the general procedure for correcting the calibration X-ray images and using them to calculate the 3D configuration of the X-ray hardware. It can be used with nearly all types of grid and calibration objects. The following steps assume that you have already configured your subject file with all of the unprocessed data files for the calibration and subject trials, but have not corrected any of the trial images yet:

Optimize Image Correction Parameters
  1. Load the subject file containing the uncorrected trial images (calibration trials as well as static and dynamic trials of the subject).
  2. Select the session and configuration that you want to process.
  3. Select a dynamic trial of the subject. Before performing any image correction or calibration, you will first determine the contrast enhancement, smoothing, and resizing parameters that will optimize the corrected images for DRR-based tracking in X4D. If you will be performing bead-based tracking in Locate3D instead, then determination of these correction parameters is less important. Choose a trial that is representative of the configuration so that the correction parameters that you determine for it will also work well for the other trials. Because this trial has not been corrected yet, CalibrateDSX will display a dialog box with several options. Select the Load Raw option.
  4. Open the Image Preview widget. This widget contains four filters that can be applied during image correction (contrast stretching, histogram equalization, smoothing, and resizing) and two filters that can be used to help visualize the effects of the other four (inversion and edge detection). Start by checking the Show Preview box so that the X-ray windows will show the results of the image filters. Then experiment with the various filter parameters to create the best images for DRR-based tracking, which relies heavily on the visible edges of the object being tracked. Each filter is described in the Image Preview widget wiki page. To activate a filter, check the box next to its name and then change its parameter values, observing the effects in the X-ray windows.
  5. Once you have determined the best filter parameter values for your images, click on Copy Parameters to Image Correction to copy the values to the Image Correction widget so they can be applied during image correction.
Correct Calibration Trial Images
  1. Select the intensity trial. You will be prompted to correct them and save the subject file. Correction of intensity images involves removing outliers (image slices whose average intensity is more than two standard deviations from the overall average) and then averaging the remaining slices. CalibrateDSX will save the corrected intensity images to TIFF files in the same folder as the uncorrected images. Note: white images and intensity correction are optional; if you do not have them you can skip this step and the next. In this case the other trial images will simply be inverted instead of uniformity corrected.
  2. Open the Image Correction widget. In the Intensity Trial section, check the Preview box so that the processed images will be shown in the X-ray windows. Change the White Threshold values for each view so that the pixels outside the field of view are red while all the pixels inside the field of view are preserved. All subsequently corrected X-ray images (grid, calibration, and motion trials) will be thresholded in the same way; that is, all pixels that are red in the white image will be set to 0 in the images being corrected.
  3. Select the grid trial. You will be prompted to correct them and save the subject file. CalibrateDSX will correct the grid images for both views using the intensity images, then save them to TIFF files in the same folder as the uncorrected images. Note: grid images and distortion correction are optional. If you do not have grid images you can skip this step and the next.
  4. In the Grid Trial section of the Image Correction widget, check the Preview box so that the processed grid images will be shown in the X-ray windows. The grid images will be displayed in black, red, and cyan. Black means the pixel is below the Grid Bead Threshold for that view. A region of red pixels means that region is either too large or too small to be considered a grid bead/hole and will be ignored during distortion correction. A region of cyan pixels means that region is a valid grid bead/hole. You should first adjust the Grid Bead Threshold value for each view until all the beads/holes are separated from each other, then adjust Grid Centroid Size Range to exclude regions that are not valid beads/holes (e.g., small pieces of a grid hole at the image boundaries). When you are done, all of the beads/holes that you want to use for distortion correction should be colored cyan and all other portions of the images should be red or black. Grid Min Num Centroids specifies the minimum number of bead/hole centroids allowable in each grid image. If fewer than this number are found, the image is not used for distortion correction. The exact value of this parameter is not important, but you should set it high enough to catch obvious errors in processing (e.g., bad thresholding that leads to fewer than 50 or 100 grid points). Note: only the first frame of data for each view is used from the grid trial, so the grid parameters should be adjusted to work with these initial frames.
Calculate 3D Configuration
  1. Select the calibration object trial. CalibrateDSX will correct the calibration images for both views using the intensity images and the grid images. As with the grid images, it will write TIFF files in the same folder as the uncorrected images.
  2. Verify that distortion correction worked properly by pressing the G key in each X-ray window to display the "grid check" images. Every time CalibrateDSX distortion corrects a trial, it also corrects the grid images themselves. By viewing them you can confirm that all of the appropriate beads/holes were identified and adjusted properly into straight lines. If they were not, you will need to delete the corrected calibration trial images in xManager and go back to the grid trial to readjust the parameters. When done viewing the grid check images, press G again to return to the calibration object images.
  3. Open the Calibration Object widget. Digitize four or five beads (POIs) in each view. To digitize a POI, click on its name in the widget, then left-click on the POI in either or both views. When a POI is active, the cursor will change to a circle inside a square. The circle represents the expected size of the centroid for the POI. It is also the region that will be searched for the pixel that best represents the center of the bead centroid. The size of the circle is calculated from the physical size of the bead specified in the subject file and the POI Scale parameter. The square is the region that will be searched for pixels that should be considered part of the bead centroid. Once the POI has been digitized in both views, the current POI will automatically advance to the next one in the list that does not have locations defined for both views.
  4. If your calibration object contains tokens that you want to digitize (e.g., the pyramid, helix, dome, and jack in the Lego cube object designed by Brown University), these tokens should be listed as POIs in the object definition, and can be digitized similarly to beads. The only difference is that you should use Ctrl-left-click to digitize them. Holding down the Ctrl key while digitizing instructs the software to use the exact point digitized, instead of searching for a suitable centroid in the vicinity (which usually won't be found for these non-circular objects).
  5. Once you have digitized four or five beads or tokens, save their locations to text files. Use the command File→Save 2D POI Locations. The first time you save them you will be prompted to enter the names of the files (one for each view).
  6. Open the 3D Calibration widget. If the source to image parameters are not already set properly, type in the correct values. These are the manually measured distances between each X-ray source and its corresponding image intensifier or flat panel. These distances should be measured to within a couple of millimeters because the DLT calculations are sensitive to their initial values.
  7. You are now ready to have CalibrateDSX try to predict the locations of the undigitized beads in both views. Select Tools→Predict POI Locations. CalibrateDSX will perform a preliminary DLT on each view, using the beads and tokens already identified. It will then use the results to predict the locations of the remaining beads. If prediction does not work properly, there are two likely causes. First, make sure you are digitizing each token in the correct location, which is usually its geometric center but this depends on its XYZ coordinates in the subject file. Second, try manually identifying a few of the beads to make sure the POI parameters are correct. Don't worry about identifying them correctly; this is just to make sure the parameter values are right. After confirming that you can digitize them, deselect them and try predicting again using just the tokens.
  8. Check the digitized beads. Sometimes a few beads are not identified correctly, or identified at all. You can use the mouse wheel to zoom in and out of the images to check for errors (press 'r' in each window to reset the view). To re-digitize a bead, click on its name in the Calibration Object widget and then left-click on it in either or both windows.
  9. Once you are satisfied with the digitized bead locations, delete the points for any tokens that you do not want to include in the DLT calculations (e.g., the pyramid, jack, dome, and helix in the Lego cube). Then save the POI locations to files again.
  10. You now have a full set of calibration beads for the first X-ray image in each view. If your calibration object trial contains more than one time frame of X-ray data, you can have CalibrateDSX automatically identify the same beads in all of the other frames. Using multiple frames of beads can potentially improve the accuracy of the 3D calculations slightly because the bead locations will be averaged over all of the frames. Use the Tracking slider in the Calibration Object widget to specify the range of frames you want to include in the calculations, then run the command Tools→Propagate POIs. CalibrateDSX will use the bead locations in the first frame to predict where they should be in the other frames. It will then calculate the weighted centers of the bead centroids at those predicted locations. After scrolling through the frames to confirm that the propagated bead locations are correct, save the coordinates to files again with File→Save 2D POI Locations.
  11. Perform the DLT to compute the 3D configuration. Select Tools→Compute 3D Configuration. When the DLT for each view is complete, a dialog box will show the residuals for each bead. High residuals could indicate misidentified beads, or small errors in bead centers (e.g., if two beads partially overlap). Residuals that are more than one standard deviation above the mean are colored red, but this does not necessarily indicate that they are too high. Once the 3D configuration is computed, enabling the Tools→Show Perfect Calibration Beads option will display small Xs at the bead locations, calculated from this 3D configuration. If you want to re-digitize a bead, click on its name and digitize a new location. You can then compute the 3D setup again and compare the results.
  12. When you are satisfied with the residuals, select File→Save Subject to save the 3D configurations to the subject file.
Correct Static and Dynamic Trials
  1. To correct the trials of the DSX subject, use the command Tools→Correct All Trials in Configuration. This will correct all of the trials in the configuration that have not already been corrected. If you want to view any of these corrected trials, you can select them in the DSX configuration widget.
  2. Select File→Save Subject to save all of the corrected file names to the subject file.

If your subject file contains other sessions or configurations that you want to process, you can repeat this entire procedure for each one.

Retrieved from ""