nrc-cnrc / EGSnrc

Toolkit for Monte Carlo simulation of ionizing radiation — Trousse d'outils logiciels pour la simulation Monte Carlo du rayonnement ionisant
http://nrc-cnrc.github.io/EGSnrc
GNU Affero General Public License v3.0
214 stars 144 forks source link

Allow generation of .3ddose files for transformed EGS_XYZGeometry #1145

Open blakewalters opened 1 month ago

blakewalters commented 1 month ago

Is your feature request related to a problem? Please describe. Currently, egs++ supports reading a CT .egsphant file into a rectilinear EGS_XYZGeometry. Using EGS_DoseScoring, a .3ddose file can potentially be generated for a simulation using this EGS_XYZGeometry. However, if, as is almost always the case, the EGS_XYZGeometry created using CT data must be rotated/translated from "CT space" into the simulation coordinate system, a .3ddose file for the transformed geometry can no longer be generated.

Describe the solution you'd like It would be very useful to be able to generate a .3ddose file for CT data. By default, this data would be output in "CT space" and could be plotted atop the untransformed CT image. There may be a way to also transform the dose data into simulation space.

Alternatives I suppose one could build their simulation geometry around the original CT data, but this seems unnecessarily complicated and inflexible.

mchamberland commented 1 month ago

egs_brachy did it first.

😉

Though, this situation does not come up as often in brachytherapy simulations. Also, I have not handled converting the 3ddose file to "simulation space". It seemed too daunting to me at the time, but I admit I only thought about the problem for about 5 minutes before coming to that conclusion!

blakewalters commented 3 weeks ago

@mchamberland, I've been using a fix that undoes the transformations at the beginning of the run just to determine: 1) no. of voxels, 2) voxel boundaries, and 3) mapping of global dose region -> region no. in EGS_XYZGeometry. This seems to work okay...but it causes a crash in egs_view if the egs_dose ausgab object with the dose geometry isn't commented out before attempting to display.