Skip to content

Measuring targeting accuracy

Kimberly Meechan edited this page Jun 29, 2024 · 2 revisions

Crosshair has some built-in features to allow measurement of targeting accuracy - this is entirely optional!
In order to do this, you will have to X-ray your block again after the targeting process (with the same settings as the original X-ray scan).

This workflow only supports BigDataViewer style file formats i.e. HDF5 or N5. If your images are not in this format, you can convert them in Fiji using the command Plugins > BigDataViewer > Export Current Image as XML/HDF5 or Export Current Image as XML/N5.
Currently, I would recommend using N5, as there are some existing issues with using HDF5 with RegistrationTree.

Registering your X-ray scans

You will need to register your after X-ray to your before X-ray so they can be compared. To do this, use the RegistrationTree plugin which is a wrapper around the registration softwares: elastix and BigWarp. Follow the installation instructions / wiki on the RegistrationTree github to register your images.

It usually works best to use the before scan as your moving image, and the after scan as your fixed. Then use BigWarp to do a rough alignment (Rotation transform type), followed by refinement with elastix (Euler transformation type). The default elastix settings are usually sufficient, and you can crop/downsample if your images are very large. Once you are happy with your registration, export to bdv xml in the MOVING space (if this was your before scan). This will give you an xml file containing the required transformations.

Start measure targeting accuracy

Click the command under Plugins > Crosshair > Analysis > Measure Targeting Accuracy.

You will need to provide the xml for your before targeting X-ray scan (HDF5 or N5 format), the registered after targeting X-ray scan xml (from RegistrationTree), and the settings and solution json files from your Crosshair run. This will open up the usual Crosshair interface, but now show both X-ray scans in the viewer.

The user interface now contains rows for three planes: before target (the target plane from the before scan), before block (the block plane from the before scan), and after block (the block plane from the after scan i.e. the plane you actually reached in your targeting run).

Fitting the after block plane

Now, you must fit a plane to the after block surface. This can be done in exactly the same way as the original block surface - by placing a series of points and clicking 'Fit To Points' (follow the 'Setting up planes' tutorial - fitting to points section).

This can be made easier by hiding the before scan image. If you hover over the right side of the 2D viewer, a blue arrow will appear. Clicking that blue arrow will open a menu where you can toggle the 'before' or 'after' images by clicking the checkboxes in the 'active' column.

Placing the before target plane vertex

For the point to plane distance measure, we need to add a point on the before target plane near to the centre of our region of interest. This can be done by clicking the GO TO button on the 'before target' row, then right clicking in the viewer and selecting Toggle Target Vertex Mode. Now left clicking in the viewer will place a vertex, and clicking an existing vertex will remove it. Make sure you only add one vertex!
Then select Toggle Target Vertex Mode again, to prevent adding more vertices.

Accuracy measures

At this point, you can click Save Settings to save a json file containing all the settings of your new planes and points. Save it separately to your original crosshair settings file - as this contains different data!

Now you can click Save Measures to save a small json file containing the calculated accuracy measures. This file contains 3 measures:

  • Angle error: the angle between the normals of your before target plane and your after block plane.
  • Solution distance error: given the orientation of your after block, this tries to infer how far you actually cut (assuming you touched the same point first, and your knife angle was the same as the one in the solution file). The error is then this distance minus the distance given in the solution. It is therefore a measure of how close you were to cutting the solution distance.
  • Target point to plane distance error: shortest distance between your before target vertex and the after block plane.