Fiducial Registration Educational Demonstration

Logo try fred

GitHub Actions CI status Test coverage Documentation Status The SciKit-SurgeryFRED paper DOI - Zenodo Our SPIE 2021 Talk Video Demonstration on YouTube Video Demonstration of Game on YouTube Follow scikit_surgery on twitter

Author: Stephen Thompson

This is the Fiducial Registration Educational Demonstration (SciKit-SurgeryFRED), part of the SciKit-Surgery software project, developed at the Wellcome EPSRC Centre for Interventional and Surgical Sciences, part of University College London (UCL).

Fiducial Registration Educational Demonstration is intended to be used as part of an online tutorial in using fiducial based registration. The tutorial covers the basic theory of fiducial based registration, which is used widely in image guided interventions. The tutorial aims to help the students develop an intuitive understanding of key concepts in fiducial based registration, including Fiducial Localisation Error, Fiducial Registration Error, and Target Registration Error.

Citing

If you use SciKit-SurgeryFRED in your research or teaching please cite our paper:

Stephen Thompson, Tom Dowrick, Mian Ahmad, Jeremy Opie, and Matthew J. Clarkson “Are fiducial registration error and target registration error correlated? SciKit-SurgeryFRED for teaching and research”, Proc. SPIE 11598, Medical Imaging 2021: Image-Guided Procedures, Robotic Interventions, and Modeling, 115980U (15 February 2021); https://doi.org/10.1117/12.2580159

Specific releases can be cited via the Zenodo tag.

SciKit-Surgery can also be cited as:

Thompson S, Dowrick T, Ahmad M, et al. “SciKit-Surgery: compact libraries for surgical navigation.” International Journal of Computer Assisted Radiology and Surgery. 2020 May. https://doi.org/10.1007/s11548-020-02180-5

Developing

Cloning

You can clone the repository using the following command:

git clone https://github.com/SciKit-Surgery/scikit-surgeryfred

Contributing

Please see the contributing guidelines.

Acknowledgements

Supported by Wellcome and EPSRC.

Dependency Graph

digraph prof {
	ratio = fill;
	node [style=filled];
	"SciKit-SurgeryFRED" -> "NumPy";
	"SciKit-SurgeryFRED" -> "SciKit-SurgeryCore" [color="0.515 0.762 0.762"];
	"SciKit-SurgeryFRED" -> "Flask";
	"SciKit-SurgeryFRED" -> "Google Cloud Firestore API";
	"SciKit-SurgeryFRED" -> "Chart.js";
	
	"SciKit-SurgeryCore" -> "NumPy";

"SciKit-SurgeryFRED" [color="0.515 0.762 0.762"];
"SciKit-SurgeryCore"[color="0.515 0.762 0.762"];
}

SciKit-SurgeryFRED’s Dependencies

latest

get_results module

main module

Module to handle communication between client (static/main.js) and sksurgeryfred server

main.addhighscore()[source]

add your score to the high scores

main.calculatescore()[source]

Delegates to sksurgery.alogorithms.score to calculate an ablation score.

main.correlation()[source]

Takes in 2d array, and does linear fit and correlation for each column against the first returns slope, intercept and correlation coefficient if there are less than 4 data points it returns false.

main.defaultcontour()[source]

Returns a pre-calculated contour image to represent the intraoperative image.

main.favicon()[source]

returns the icon

main.getfle()[source]

Returns values for fiducial localisation errors Values are randomly selected from a uniform distribution from 0.5 to 5.0 pixels

main.gethighscores()[source]

return the sorted high scores, the ranking and the ref to the lowest score

main.gettarget()[source]

Returns a target point for the simulated intervention

main.index()[source]

returns the main page, template/index.html

main.initdatabase()[source]

here we will create a new document in collection results and return the name of the document. Write some stuff about the date and the versions of fred, core, and fredweb. Create a sub collection of results within the document

main.placefiducial()[source]

Returns the location of a fiducial marker on the pre- and intra-operative images. FLE is added to each marker location.

main.register()[source]

Performs point based registration and returns registration data as json.

main.startfred()[source]

returns the fred page

main.writegameresults()[source]

write the game results to a firestore database

main.writeresults()[source]

write the results to a firestore database

sksurgeryfred package

Subpackages
sksurgeryfred.algorithms package
Submodules
sksurgeryfred.algorithms.errors module

Functions for point based registration using Orthogonal Procrustes.

sksurgeryfred.algorithms.errors.expected_absolute_value(std_devs)[source]

Returns the expected absolute value of a normal distribution with mean 0 and standard deviations std_dev

sksurgeryfred.algorithms.fle module

Functions for adding fiducial localisation error

class sksurgeryfred.algorithms.fle.FLE(independent_fle=None, ind_fle_function=None, systematic_fle=None, sys_fle_function=None, dimension=3)[source]

Bases: object

Provides methods to add Fiducial Localisation Error to a point

Parameters
  • independent_fle – the magnitude(s) of the independent FLE’s, used for the default ind_fle_function. Do not use if using your own ind_fle_function. A single float will yield isotropic error, or an array can be passed for anisotropic errors.

  • ind_fle_function – the function to use for sampling the independent fle. Defaults to numpy.random.normal

  • systematic_fle – the magnitude(s) of the systematic FLE’s, used for the default sys_fle_function. Do not use if using your own sys_fle_function. A single float will yield isotropic error, or an array can be passed for anisotropic errors.

  • sys_fle_function – the function to use for sampling the independent fle. Defaults to numpy.add

  • dimension – the dimensions to use, defaults to 3.

Raises
  • ValueError – If independent_fle is not single value or array of length dimension.

  • ValueError – If both fle function and fle value are set.

  • TypeError – If either error function is invalid.

perturb_fiducial(fiducial_marker)[source]

Adds the FLE to the marker position

Parameters

fiducial_marker – the true position of the marker.

Returns

The perturbed position of the marker

sksurgeryfred.algorithms.fred module

Functions to support MedPhys Taught Module workshop on calibration and tracking

sksurgeryfred.algorithms.fred.is_valid_fiducial(fiducial_location)[source]

Checks the x, y, and z location of a fiducial :returns: true if a valid fiducial

sksurgeryfred.algorithms.fred.make_target_point(outline, edge_buffer=0.9)[source]

returns a target point, that should lie within the outline.

sksurgeryfred.algorithms.point_based_reg module

Functions to support MedPhys Taught Module workshop on calibration and tracking

class sksurgeryfred.algorithms.point_based_reg.PointBasedRegistration(target, fixed_fle_esv, moving_fle_esv)[source]

Bases: object

Does the registration and assoctiated measures

get_transformed_target()[source]

Returns transformed target and status

register(fixed_points, moving_points)[source]

Does the registration

reinit(target, fixed_fle_esv, moving_fle_esv)[source]

reinitiatilses the target and errors

sksurgeryfred.algorithms.scores module

Functions for calculating the score for ablation game

sksurgeryfred.algorithms.scores.calculate_score(target_centre, est_target_centre, target_radius, margin)[source]

Calculates the score for a given simulated ablation :params target_centre: The known target position :params est_target_centre: The target centre estimated by registration :target_radius: The radius of the target :margin: The margin to add (treatment radius = target_radius + margin :returns: the score

sksurgeryfred.algorithms.scores.sphere_volume(radius)[source]
Returns

the volume of a sphere of radius

sksurgeryfred.algorithms.scores.two_sphere_overlap_volume(centre0, centre1, radius0, radius1)[source]

Calculates the overlapping volume of two spheres from https://math.stackexchange.com/questions/297751/overlapping-spheres :param: centre0 centre of sphere0 (1x3) :param: centre1 centre of sphere1 (1x3) :param: radius0 radius of sphere0 (1) :param: radius1 radius of sphere1 (1)

Module contents
sksurgeryfred.utilities package
Submodules
sksurgeryfred.utilities.get_results module

Script to download and parse results from firestore

sksurgeryfred.utilities.get_results.get_results(testing=False)[source]

Function to download results from our results database and parse them ready for analysis

sksurgeryfred.utilities.results_database module

Utilities to enable testing of FRED’s firestore databases

class sksurgeryfred.utilities.results_database.ResultsDatabase(teststring)[source]

Bases: object

Stands in as a fake database for testing purposes

class sksurgeryfred.utilities.results_database.TestAddSet[source]

Bases: object

implements a get function for testing purposes

class sksurgeryfred.utilities.results_database.TestCollection(teststring)[source]

Bases: object

A pretend collection for testing purposes

class sksurgeryfred.utilities.results_database.TestDoc[source]

Bases: object

implements a document for testing purposes

class sksurgeryfred.utilities.results_database.TestGet(teststring)[source]

Bases: object

implements a get function for testing purposes

class sksurgeryfred.utilities.results_database.TestScore(name, score, ref)[source]

Bases: object

stores a name and a score plus implements to_dict for testing

to_dict()[source]

returns a dictionary containing name and score

Module contents
Module contents

FiducialRegistrationEducationalDemonstration