Question about local/global gamma

I am just familiarizing with the gamma calculations. I understand that local gamma is calculated relative to dose at each point, and the global gamma is calculated relative to the maximum dose in the measurement plane. So when someone states that " The gamma calculation search radius was set to 1.0 cm" does it mean that local gamma was calculated ? In the pymedphys code I can see that gamma options for local is only True or False.

Thank you very much for your knowledge,

Hi @Alexander_S welcome to PyMedPhys.
@SimonBiggs is the author of the code, and when he comes back (well earned time off :slight_smile: ) he can probably give you a more definitive answer, but…
Short answer: No, specification of a search radius does not imply local gamma calculation.

Longer answer:
The search radius is set and used independently of whether it is local or global gamma being calculated. The pymedphys code (pymedphys/ at ae9c2bc7e1da09855bff60c10504dd8e389ab032 · pymedphys/pymedphys · GitHub) references: and the abstract discusses the search radius as a tuning parameter for the tradeoff of speed vs. accuracy of the computation which is as far as I can tell is quite independent of whether one is doing a local vs. global calculation.

Further (and separate from the PyMedPhys code itself)…
If you look at MICE Toolkit they define the search radius:

Sets the radius of the sphere around each evaluated voxel to evaluate the gamma index for. If the user desires a pass/fail gamma evaluation, the Search Radius can be set equal to Distance Criteria. If a more thorough evaluation is desired, set the Search Radius to at least 3 times the Distance Criteria. Increasing the search radius increases the computation time.

If you think the documentation might benefit from a clearer explanation, we’d be very happy for your help in making it more understandable, especially to those just getting familiar with the calculations and their use. I think the online documentation now offers the ability to comment in place in a way that becomes immediately useful to others and makes it straight forward for us to incorporate those comments in to the documentation itself (or you can go straight to the source of the documentation and create a Pull Request).

Hope this helps,


Thanks a lot for your explanation.

May I ask (and sorry if I missed this information in the references you provided), what is the actual default search radius in the PyMedPhys code?

In that paper I can see that for the most examples the chosen search radius was 1.0 cm.



Hi @Alexander_S

I’m afraid I don’t know the answer regarding the default search radius.
@SimonBiggs should be able to answer that.

My best read of the code is that there isn’t one, or alternatively that the search is not limited by radius (which is presumably expensive computationally).

seems to be the variable defining the value you are asking about, and it appears to get set to np.inf (infinity) if the value is not passed in as a named parameter.
However, if one sets a maximum gamma value then that can drive setting of a limit:

Sorry I can’t be more certain…

Hi @Alexander_S welcome to the PyMedPhys Discourse :slight_smile: :balloon:

I’m still on leave so likely to not be that responsive, but nevertheless I can answer a little here.

Could you give some context to that statement? What other things are they also saying about their gamma calculation?

There’s a neat property of the gamma function that given a distance threshold of d, for a given radius x any distance larger than that radius x cannot have a gamma value smaller than x/d. Therefore, if you search for gamma in progressively larger sphere surfaces you can disregard points if a gamma value found is smaller than the current search radius / distance threshold.

By default PyMedPhys’ gamma algorithm defaults to prioritising accuracy over speed. You can however limit the gamma to a maximum value which will stop it searching at a given radius, you can also make it only calculate a random subset of points which will approximate a similar pass rate, one can also make the points stop searching if any point is found to pass which means individual gamma values may be higher that what could be possibly found be found, but if only a pass rate is desired this is sufficient.

If you can provide the reference where your original quote is from hopefully I can help further.


Hi Simon,

Thank you very much. I found such statement in the following article: Borca VC, Pasquino M, Russo G, Grosso P, Cante D, Sciacero P, et al. Dosimetric characterization and use of GAFCHROMIC EBT3 film for IMRT dose verification. J Appl Clin Med Phys 2013. doi:10.1120/jacmp.v14i2.4111.


Hi Alex,

They have reported using the following software:

“RIT 113 analysis software”

I suspect that might be an option within that software. I’m not familiar with that software myself though so I can’t say for sure what it is referring to. However I do suspect that for a 3%/2mm Gamma criterion that may be similar to setting the max gamma parameter to 5 as @sjswerdloff investigated above.

Hi Simon,

Thanks. I was unable to find the description of the gamma parameters of pymedphys.

I thought ‘max gamma’ parameter was just about that if gamma value is above then it is just shown as max value, i.e. if gamma is calculated as 2.5, and max gamma 2.0, so it will show it as 2.0 . So I was incorrect.

I actually don’t understand “random_subset” and “quiet” parameters as well. Sorry to bother you, but maybe you could quickly explain them? Thank you very much.

Otherwise it is a great program. I am finishing a paper where I used this module for my gamma value calculations, it worked great.



I’m glad it was able to be helpful :slight_smile:. I’ll jump in an explain them at some point next week. Once I’ve done so, would you be willing to write up a bit of a tutorial for others that we can put within the documentation? I find people who are fresh using a tool and have recently struggled with its sharp edges can give the best feedback and guidance… I’d appreciate that if you were able :slight_smile:


Hi Simon,

I certainly can write about my approach how I done it, having no initial understanding about it.

The 90% info I got from here: and I think the basis here serves as a perfect tutorial for beginners, if some additional questions would be answered.

However , to name my experience as tutorial for someone would be too arrogant as I am certainly no expert in this specific field, and my English is not native. But I can describe in the simple English how I used this program to compare the dosemaps between scanned films and mc simulation IF that information will be double-checked and corrected by an expert (but most of that info will be repeated as from the link above).



Have you seen the following API reference:

It certainly is terse, and could use some improvement. The text for that Gamma reference document is over at:

Would you be in a position to use the GitHub edit button to adjust that text to something that you would have found more helpful?

Does the description within the documentation help?

Thanks, I somehow missed this,


Also, the pymedphys docs are indexed pretty well in Google. Typing the following into Google gets you there:

pymedphys gamma api

Also, typing the following will also bring up those docs:

In [1]: import pymedphys

In [2]: help(pymedphys.gamma)


Just to understand better, what kind of tutorial you would like me to write? I can write only about how to compare two 2D dose pictures with gamma index using python in a simple way. I think such tutorial could be put here:

I am not sure if such tutorials should be in the technical github documentation (?). In addition, I don’t really have a good skill here.


I think that sounds perfect :relaxed:. Have you used Jupyter Notebooks before? If you have, if you create the tutorial as a Jupyter Notebook I can help you sort out the git side of things.


Do you have any channel I could contact you for some quick questions, i.e. zoom, etc?


Hi @Alexander_S,

We could try using the following meeting link for discussions:

When is a good time for you?