Creating a hole/cavity in vowelised phantom geometry

I have a spherical surface radiation source. I want to put it inside a hole created in a voxelized human phantom as in the image below.


Currently, the hole is defined as air (spherical hole). However, when I put my source inside the hole, the result is lower than expected. I suspected this because of the overlapping between my source and the hole.

Is there any way to make the voxel/material of the hole not disturbing the source?

1 Like

If you’re creating the “hole” by placing a volume of air as a daughter of your phantom, then you should in turn place your source as a daughter of that air volume. If you place the source as a daughter of the phantom (or place it in the world), then you will, as you suspect, end up with volume overlaps.

Placing the source as a daughter of the air sphere does mean that you will need to use the sphere’s coordinate system for the source placement (at (0,0,0), I guess).

If you don’t need your source to actually be an “object” (a volume with material, like a source capsule), you could just throw your primaries from the right coordinate position in your PrimaryGeneratorAction.

I am interested in this!
In my case I have a G4Box voxelized using a three-level G4VNestedParameterisation. I would like to cut some bits off the G4Box, and therefore some voxels would end up outside the parent logical volume.

Are we talking about the same thing?

You may have a look at the extended/medical/DICOM example. You have an example of building a phantom that only includes the intersection with a volume.

in my case, I want to do subtraction of the phantom voxels. Currently, I did that mostly based on the DICOM example as you mentioned. The different is that instead of intersection, I do the subtraction. I create the hole using this. So the hole is actually some phantom voxels that I assinged as air. This is why I have the verlapping problem.

Regarding the DICOM example (partial volume/intersection), I am a bit confused on how to see the intersection volume. I did try the example and activate DICOM_PARTIAL_PARAM=1, but the only volume I see is 2 circles (phantom was intersected with a tube). How to see the intersected phantom?. Did I miss something?

how do you cut some of your Box voxels?. Do you mean subtraction?. What I wan to to do is subtraction of the phantom volume.

Maybe this image could simplify what I want to do (subtraction).


I do not think the Geant4 visualization can see the hole in a phantom, except the ray tracing. You may simply do a /tracking/verbose 1 to check if the particles origin are in the phantom or not

Yes, I meant subtraction.

The code includes voxels within the intersection with the defined volume. If you want subtraction just define the “opposite” volume.