[Gate-users] Problems/inconsistencies calculating dose uncertainty

Matthew Strugari matthew.strugari at dal.ca
Thu Feb 6 19:59:37 CET 2020

Hi all,

I am in need of assistance when calculating the dose uncertainty using output from the dose actor. I would like to merge multiple dose point kernel outputs from the dose actor to speed up my overall simulation time. Using the output from a single simulation to verify the calculation of the uncertainty, my results are ~1% different from the reference GATE output on average with a >8000% difference at the origin. I am using the formula found in GateDoseActor.cc:
      double std_dose = sqrt( (1.0/(N-1))*(sq_dose/N - pow(dose/N, 2)) )/(dose/N);
      if( dose == 0.0 || N == 1 || sq_dose == 0 )
        std_dose = 1.0;

Here, the corresponding image data (attached in doseActorOutput.zip) are assigned as dose = Dose.mhd, sq_dose = Dose-Squared.mhd, and N = NbOfHits.mhd and then element-wise operations are performed. My approach is slightly different as I mask the matrices to avoid nan/inf results:
        N = np.ma.masked_equal(N, 0)
        N = np.ma.masked_equal(N, 1)
        dose = np.ma.masked_equal(dose, 0.0)
        sq_dose = np.ma.masked_equal(sq_dose,0)

        # calculate uncertainty using formula from GateDoseActor.cc
        std_dose = np.sqrt( (1.0/(N-1))*(sq_dose/N - pow(dose/N, 2)) )/(dose/N)
        std_dose = np.ma.filled(std_dose, 1.0).astype(np.float32)

Some/very few of the calculated std_dose values are greater than one (1.0000001 so I am not sure if this is indicative of an error or if I should just normalize std_dose before filling the masked values with 1. Also, the Dose-Uncertainty.mhd images appear identical in ImageJ but the actual values appear to be scaled differently (see attached doseKernel.zip).

Please correct me in my calculation or provide any information on the correct way to calculate the uncertainty using the Dose, Dose-Squared, and NbOfHits files.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20200206/bffafe29/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: doseKernel.zip
Type: application/zip
Size: 537345 bytes
Desc: doseKernel.zip
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20200206/bffafe29/attachment-0002.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: doseActorOutput.zip
Type: application/zip
Size: 2436793 bytes
Desc: doseActorOutput.zip
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20200206/bffafe29/attachment-0003.zip>

More information about the Gate-users mailing list