clrp-code / egs_brachy

egs_brachy is an application for doing Monte Carlo brachytherapy simulations based on EGSnrc/egs++.
Other
17 stars 14 forks source link

The XYZ dose is normalized by number of histories instead of source fluence #65

Open rtownson opened 2 weeks ago

rtownson commented 2 weeks ago

The offending code for normalizing dose to phantom I found here: https://github.com/clrp-code/egs_brachy/blob/main/egs_brachy/phantom.cpp#L349

Since sources return their own fluence for normalization (which most cases is just the number of histories), you should use that as the normalization factor instead. See here: https://github.com/nrc-cnrc/EGSnrc/blob/master/HEN_HOUSE/egs%2B%2B/ausgab_objects/egs_dose_scoring/egs_dose_scoring.cpp#L313

I believe this will only cause problems for egs_collimated_source.

MartinMartinov commented 2 weeks ago

Haven't looked in a while, but I think egs_radionuclide_source also returns number of decays for it's fluence, rather than the number of histories.

rtownson commented 2 weeks ago

You're right, the code is depending on current_case which uses the return value from getNextParticle. Currently, for egs_radionuclide_source it returns just the number of source particles, but this will be changing to the number of decays in:

https://github.com/nrc-cnrc/EGSnrc/pull/910

which would solve the issue.

mchamberland commented 2 weeks ago

This is where we calculate effective histories for the purpose of normalization.

So, last_case should be changed to source->getFluence()?

I'm a little shaky on the whole normalization and am hesitant touching anything in this part of the code. Would this change be compatible with the recycle options immediately below that line?

rtownson commented 2 weeks ago

Since source->getFluence() source just returns the same value as current_case for all sources except egs_collimated_source and egs_radionuclide_source, it should be safe. It probably should have at least been current_case and not last_case (but that's just an off-by-one problem). But since people use the radionuclide source a lot for egs_brachy, I would test it and be careful of course - maybe it is already accounted for some other way.

In any case, once https://github.com/nrc-cnrc/EGSnrc/pull/910 is merged in, the current method will give a different answer for the radionuclide source!

mchamberland commented 2 weeks ago

The radionuclide source did not exist when egs_brachy was being developed, so we definitely did not account for that type.

I wonder what application requires people to use the radionuclide source? Novel applications or some fundamental research?

I think I need to work on more beginner-friendly documentation and tips & tricks... or maybe hold an egs_brachy webinar...

rtownson commented 2 weeks ago

I'm not sure which clinical applications require one to use the radionuclide source, but any where the mixture of decay products like the beta particles matter. Or perhaps if they wanted to look at different nuclides that egs_brachy doesn't provide a spectrum for. In any case, users will certainly do it, regardless of whether it's needed, so best to ensure it works.