Gamma Analysis In-depth Explanation

Dear Simon,

My name is Nevin, I am a M.Sc Medical Physics student at the University of Canterbury, New Zealand. I am currently using Pymedphys, specifically the Gamma function to calculate the gamma from DICOM images. However, I have some questions I was hoping you could answer.

Firstly, from the “Gamma from DICOM” How-to guide (Gamma from DICOM — PyMedPhys). I noticed that when using the provided logfiles, there were several gamma evaluation/reference, dose difference and local gamma images generated. I was a bit confused about this as when I did the same for my DICOM images, I only got one set of gamma evaluation/reference, dose difference and local gamma images generated. I was wondering what the difference is between the various sets of images?

Secondly, I was hoping you could explain what the set of images with the gamma evaluation/reference, dose difference and local gamma images meant? I have been able to generate the images using the provided code but both me and my supervisor are unsure as to what the images specifically mean. For example, in this image

Does the blue coloured part of the Local Gamma image show where the gamma analysis fails for the evaluation against the reference image? If so, why does the dose difference not align with this particular image?

For reference, I have also attached the particular images I am using for my project, these are TOPAS generated DICOM images.

Thanks you so much,

P.S Big fan of your work on pymedphys

Kind regards,

Nevin Koshy

Rotation 1 degree Percentage Pass

Hi Nevin,

Thanks for posting this within the PyMedPhys community forums :slightly_smiling_face:.

At first glance I notice that you have very small numbers in use:
image

Would you be able to start by finding the slice where you have the most dose, plotting the evaluation and reference for that slice and see if it makes sense?

There’s a bit going on in your post, before addressing the other points it’d be helpful to get on top of what data we’re working with.

Also, the following how-to guide shows the calculation of gamma from a bit more first principles:

Once you have a slice pulled from your eval dataset, and a slice pulled from your reference dataset would you be able to run gamma over them in a way similar to that second tutorial?

Also, here is the raw Gamma API reference, which might be helpful:

Also, some other discussions around Gamma:

Cheers,
Simon

Hi Simon,

The reference and evaluation images I posted were taken by following the second tutorial, from reading the code I assumed it was taking the highest dose slice from the evaluation and reference datasets. I am not sure as to how to take the highest dose slice from the reference and evaluation datasets and run gamma over them individually. Would you be able to help me with this?

Also, in regard to the type of data this is, this is a DICOM image generated in TOPAS from 100 histories on a 40x40x40 water phantom. The low dose may be due to the low number of histories taken for the evaluation and reference datasets.

Thanks,

Nevin

Yeah I suspect that might be a deal breaker. Are you in a position to get a more fully fleshed out dose distribution?

Yes, just running the simulations now. Hopefully that will show better results

Kk, will be interested to know how it goes. Keep me posted.

Figure 1

Hi Simon,

I have attached the simulations with 10 million histories, however the dose is still fairly low as it is still at a factor of 1e-17 Gy.

Thanks,

Nevin

Great, that looks much more like something where one can see “something” at least:

With your new images I’ll answer the following question:

So, the “pure white” section is the part of the gamma where the reference dose was < your cutoff point:

This defaults to 20% of the maximum dose.

The “Blue” within the gamma map is anything that has a Gamma < 1 (and therefore passing). Red is > 1, and therefore failing.

Hope that helps :slight_smile:,
Cheers,
Simon

Thank you so much, that does help a lot,

Kind regards,

Nevin

Glad I’ve been able to help. Also, if you happen to come up with a Notebook that you think others starting out like yourself might benefit from being able to read, let me know, I’ll put it up on the website :slight_smile:

Hi Simon,

I can definitely look into making a Notebook! Also, I was wondering why there are so many sets of graphs generated? Is each set to do with a specific depth of the phantom? Or is it the dose build up over time with the most recent one being the slice with the highest dose distribution?

Kind regards,

Nevin

Each image is a slice in the “z-direction” :slightly_smiling_face:

Hi Simon,

Thank you for that, sorry to bother you again but I have another question. Looking at the code and the image from the “Calculate and Display Gamma” section from “Gamma from DICOM” I noticed that the image below had no labels on the x or y axis. I assumed that the x axis was gamma and the y axis was pixels but I am not sure if the y axis are pixels. I was also a bit confused because the title suggests the DD and DTA are 0.5% and 0.5mm but the input values are 1% and 1 mm.
image
Could you please clarify this?

Thanks,

Nevin

Yup, that’s awkward. The plot isn’t pulling from the variables:

Thanks for flagging that, fixed in Fix Gamma title by SimonBiggs · Pull Request #1506 · pymedphys/pymedphys · GitHub

No problem, just to clarify what exactly is being measured on the y axis? Still not quite sure what exactly that is?

Actually, because the density=True parameter is utilised:

image

This results in the following details from the matplotlib docs coming into play:

image

So, essentially the y-axis is normalised to be a discretised probability density.


If you want it to just be bin-count, then just set that parameter to False.

Ah thank you so much. That makes much more sense.

1 Like