Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8306385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:19:18+00:00 2026-06-08T18:19:18+00:00

In physics–especially medical physics–the gamma index is a criterion for comparing data from two

  • 0

In physics–especially medical physics–the gamma index is a criterion for comparing data from two particle detectors. More abstractly, the gamma index takes two 2D arrays (let’s say array1 and array2) and compares each element of array1 with spatially-nearby elements of array2.

There are hundreds of academic papers that use the gamma index in their analysis sections. These papers don’t seem to mention what tools/libraries they use to calculate the gamma index. It’s possible the authors implement their own gamma index calculations (it’s not that hard). However, I’m guessing that there are libraries/extensions/tools for calculating a gamma index.

Can anyone suggest a gamma index library to use in R or Python? (Other languages would be ok if there’s nothing off-the-shelf for Python or R.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:19:19+00:00Added an answer on June 8, 2026 at 6:19 pm

    I found basic MATLAB implementation of the 2D gamma index in Appendix A of this thesis.

    I copy/pasted the following code from the thesis, and I made a couple of simplifications for readability. I talked to the author and confirmed that my version of the code (below) is correct. Recently, I have been using this code in the analysis portion of a medical physics study that I’ll be publishing soon.

    The inputs A1 and A2 are 2D arrays (which, in practice, are dose maps or fluence maps). We let A1 serve as the reference data, and A2 is the data that is being evaluated. If we use a typical 2%, 2mm acceptance criterion, then we set distance to agreement as DTA=2mm, and we set the dose threshold dosed=0.02, which is 2%.

    In this simple implementation, we assume that the array indices are spaced in 1mm increments. If your data doesn’t use 1mm increments, then scale your dosed value accordingly (e.g. if your A1 and A2 are in 0.5mm increments, then use DTA=4 to get a 2mm criterion).

    The output, G, is a 2D array of gamma values.

    function G = gamma2d (A1, A2, DTA, dosed)
        size1=size (A1) ;
        size2=size (A2) ;
        dosed = dosed *  max(A1 ( : ) ) ; %scale dosed as a percent of the maximum dose
    
        G=zeros ( size1 ) ; %this will be the output
        Ga=zeros ( size1 ) ;
        if size1 == size2
            for i = 1 : size1( 1 )
                for j = 1 : size1( 2 )
                    for k = 1 : size1( 1 )
                        for l = 1 : size1( 2 )
                            r2 = ( i - k )^2 + (j - l) ^2 ; %distance (radius) squared
                            d2 = ( A1( i , j ) - A2( k , l ) )^2 ; %difference squared
                            Ga( k , l ) = sqrt(r2 / (DTA^2) + d2/ dosed ^ 2);
                        end
                    end
                    G( i , j )=min(min(Ga)) ;
                end
            end
        else
            fprintf=('matrices A1 and A2 are do not share the same dimensions! \n')
        end
    end
    

    To see an explanation of the gamma index in math notation, I recommend looking at this blog post.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine you are simulating particle physics. You, then, have a position vector for each
I'm playing around with the physics login form from Doug Mccune's blog I'm trying
I an a graduate student of nuclear physics currently working on a data analysis
Using AndEngine Physics Box2D i am trying to drag a body from side to
Im generating a plain txt file from Physics editor. It contains all the vertices
Background: We are designing a physics app, that will do a lot of data
My particle system's physics update function seems to be incorrect. I'm aiming for all
In physics library written in C# I have the following code: (in ContactManager.cs) public
I'm writing a physics simulating program, and found after() useful. I once would like
I have a physics simulation and it allows you to place area constraints, so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.