Excessive RAM use with complex phantom visualization

Dear all,

I’m new to geant4 and trying to import a phantom. The phantom is 380x992x208 voxels and I’m having issues visualizing it. I’m running geant4.10.06 through linux mint.
I followed an example I’d found through stanford’s MD anderson tutorial event (https://www.slac.stanford.edu/xorg/geant4/MDA2018/HandsOn3B/) which explained building the phantom through parameterization. The simulation runs fine in batch mode without visualization and visualization works when i lower the number of voxels (150x150x150 has worked). When i attempt to visualize the complete phantom, it reaches my drawVolume command, my memory use exceeds 30 GiB, and the program kills itself. I’ve tried openGL by itself, openGL with a QT interface, and DAWN to see if it was just a driver issue but all failed. For comparison i tried modifying the example i was following to have more voxels and it had the same issue.
Is the number of voxels just too high, or is there anyway around this?

Hi Eric

380x992x208 - that’s a big ask of any graphics system - 74M items. The G4 Vis system is pretty simple minded. It generates a G4Box for each voxel. The OpenGL “stored” driver creates a “display list” for each one (or at least a transformation matrix for each one). In addition, Qt tries to create a “scene tree”. Best option might be to try the OpenGL “immediate” mode, “/vis/open OGLI”, which does not create display lists, or even “/vis/open OGLIX” to avoid Qt. It might be slow.

Another option might be to write your own vis action (see examples/extended/visualization/userVisAction) which draws in some smart way. Maybe just the outline? Maybe a sort-of ray-traced image with each pixel an accumulation of pixels. (Has anyone out there tried that?)

Come to think of it, try “/vis/open RayTracerX”.

Or dump it to file and draw it offline with some smart app?

Have a look at the G4 Application Developers Guide, Visualization, Debugging geometry with vis, for tips on how to be specific about how to limit the volumes drawn.

Medical physicists: please advise. How do you view big phantoms?