Gamma index for 1D data

MC and film to Simon.xlsx (51.8 KB)
Hi Simon,

Thanks a lot for replying.
I here attached a spreadsheet containing a group of Monte Carlo calculated dose data and film measurement data. Film data have a higher resolution.
Any suggestions to do gamma analysis for these data?

Thank you so much again!


@nko41 has just recently been doing some great work with the gamma tooling within PyMedPhys. He might be able to help you on this one :slight_smile:.

So Nice!
Thank you Simmon and @nko41.
Yes, I have read the posts by you and nko41.

I have also successfully implemented the example you provided.
It’s a really helpful tool :+1: :+1:
BTW, I have some comments and suggestions about this example.
I will post them later.



Hi Fada,

From what I have done, I would suggest that you keep your coordinates for both film data and MC dose data the same, I assume that you are evaluating the film data against the MC dose data? Maybe you can try expanding your MC dose data so that each dose data matches each point in the film data. So for example, for the coordinate -49.5 in the MC dose data, you could expand that from -49.5 to -48.6 and use the original value (5.68E-06) in the MC dose data for all those points. You could do this for all the points in your MC dose data and evaluate your film dose data against the reference dose data or vice versa.



Thank you so much for the instruction, Nevin.
I will do some data interpolation and then do the analysis.
I will keep you posted.



Actually, I would recommend to not do the interpolation yourself, instead, individually provide the different coordinate systems into their respective coordinate argument values.

Internally, the gamma code interpolates between the values you provide it in order to do its own searching. To get the most accurate gamma result I would recommend leaving the interpolation to the gamma internals.

Hi Simon,
I like the idea to leave the interpolation job to your gamma calculation code :slight_smile:


1D gamma (154.7 KB)

Hi Simon and Nevin,

In the attached zip file, you can find a script I just made to implement PyMedPhys gamma calculation function for 1D gamma analysis and the results.

It works pretty well.

Thanks a lot to both of you again!


1 Like

here, ax[0,0].set_ylabel(‘z (mm)’)

I guess the label should be ‘y (mm)’


Yup, that makes sense. I suspect I was thinking in “world coordinates” when I did those axes. But patient coordinates makes far more sense in that case.

Might you be willing to make the fix yourself? You can open up the file in GitHub over at pymedphys/from-dicom.ipynb at main · pymedphys/pymedphys · GitHub and then it is possible to download the notebook file, make the changes, and then re-upload the file within a pull request for approval.

It’s a bit of work to give it a shot, but the more hands on deck building PyMedPhys together the better PyMedPhys becomes for everyone :slight_smile:

That’s great. I will be happy to do that.

I also made some other changes.
For example, the current script always shows the title of the gamma figures with “local gamma” disregarding the value of gamma_options[‘local_gamma’]
I fixed the figure titles to make them consistent with this gamma_options[‘local_gamma’]

I also fixed the labels overlapping issue between the two lower sub plots.

That’s awesome :slight_smile:.

If you’re comfortable using git here are the “getting started to contribute” guides for each os:

The gist is the following:

  • Install Python (if you haven’t already)
  • Install Poetry
  • Clone the PyMedPhys git repo
  • Run poetry install -E dev within the root of the repo
  • Run poetry run pre-commit install
  • Install pandoc via your package manager

Let me read through these instructions and I will keep you posted.

Hi @guanfada and @nko41,

Might either of you be able in a position to help out @David98989898 over at the following GitHub issue: