Gamma Index¶
Summary¶
A range of functions for calculating the gamma index. Available functions include:
>>> from pymedphys.gamma import (
... gamma_shell,
... gamma_filter_numpy)
Note that all of these functions are still in the process of verification and refinement. The gamma shell function is the most mature.
API¶

pymedphys.gamma.
gamma_shell
(axes_reference, dose_reference, axes_evaluation, dose_evaluation, dose_percent_threshold, distance_mm_threshold, lower_percent_dose_cutoff=20, interp_fraction=10, max_gamma=inf, local_gamma=False, global_normalisation=None, skip_once_passed=False, random_subset=None, ram_available=1610612736, quiet=False)[source]¶ Compare two dose grids with the gamma index.
Parameters:  axes_reference (tuple) – The reference coordinates.
 dose_reference (np.array) – The reference dose grid. Each point in the reference grid becomes the centre of a Gamma ellipsoid. For each point of the reference, nearby evaluation points are searched at increasing distances.
 axes_evaluation (tuple) – The evaluation coordinates.
 dose_evaluation (np.array) – The evaluation dose grid. Evaluation here is defined as the grid which is interpolated and searched over at increasing distances away from each reference point.
 dose_percent_threshold (float) – The percent dose threshold
 distance_mm_threshold (float) – The gamma distance threshold. Units must match of the coordinates given.
 lower_percent_dose_cutoff (float, optional) – The percent lower dose cutoff below which gamma will not be calculated. This is only applied to the reference grid.
 interp_fraction (float, optional) – The fraction which gamma distance threshold is divided into for interpolation. Defaults to 10 as recommended within <http://dx.doi.org/10.1118/1.2721657>. If a 3 mm distance threshold is chosen this default value would mean that the evaluation grid is interpolated at a step size of 0.3 mm.
 max_gamma (float, optional) – The maximum gamma searched for. This can be used to speed up
calculation, once a search distance is reached that would give gamma
values larger than this parameter, the search stops. Defaults to
np.inf
 local_gamma – Designates local gamma should be used instead of global. Defaults to False.
 global_normalisation (float, optional) – The dose normalisation value that the percent inputs calculate from.
Defaults to the maximum value of
dose_reference
.  random_subset (int, optional) – Used to only calculate a random subset of the reference grid. The number chosen is how many random points to calculate.
 ram_available (int, optional) – The number of bytes of RAM available for use by this function. Defaults to 0.8 times your total RAM as determined by psutil.
 quiet (bool, optional) – Used to quiet informational printing during function usage. Defaults to False.
Returns: gamma – The array of gamma values the same shape as that given by the reference coordinates and dose.
Return type: np.ndarray