[Gate-users] Confining heart source within tessalated STL body - loop 100000 errors.

maxime maxime.chauvin at inserm.fr
Wed May 20 12:21:45 CEST 2020


Hi Steve,

Ok I see, my best guess is that you have a problem of placement due to different frames of reference.

You need to double check the following:
- the placement and volume of your ‘body’ in the world coordinates
- be sure your ‘heart’ STL is correctly placed in the ‘body’ frame of reference, with no overlaps
- then calculate where to place your source para or sphere, depending on which frame of reference it belongs:
if you attach it to nothing, those coordinates correspond to the world, 
if you attach it to the ‘heart’ it corresponds to the ‘heart’ coordinates within the ‘body’ coordinates… This can get complicated.

The confine works only if the coordinates of ‘heart’ are completely within your box or sphere from what you draw random positions,
and the heart does not overlap with another volume.

If these conditions do not meet, you get the error message you have seen and the confinement is not taken into account.

Good luck !
  Maxime Chauvin

> On 19 May 2020, at 22:23, Steven Marsh <steven.marsh at canterbury.ac.nz> wrote:
> 
> Hi Maxime
>  
> Thanks for the reply.
>  
> When I place the heart within a simple volume – in this case a box - all runs well.  When I place the heart within the more complicated geometry (tessellated body) I get the loop exception errors – i.e. Gate is unable to find a point inside body which is also within the heart – it prints to the screen the following exception which indicates it has failed after 100,000 attempts to do this.
>  
> -------- WWWW ------- G4Exception-START -------- WWWW -------
> *** G4Exception : G4GPS001
>       issued by : G4SPSPosDistribution::GenerateOne()
> LoopCount = 100000
> Either the source distribution >> confinement
> or any confining volume may not overlap with
> the source distribution or any confining volumes
> may not exist
>  
> If you have set confine then this will be ignored
> for this event.
>  
>  
> *** This is just a warning message. ***
>  
> It appears that use of the tessellated volume is causing the problem. This could be due to the surface being tessellated – or more likely, it could be that I am not correctly placing the src_Heart Para volume – the one which gets confined to heart -  within the body coordinate-system. 
>  
> It is not clear to me whether the src_Heart Para volume is located with respect to the body  or world coordinate systems – and the only way to try and visualise the Para volume is to visualise the dots representing decay events with (in my case) /gate/source/src_Heart/visualize 500 yellow 4 – which I do.
>  
> So, my problem is that when I use the tessellated body.stl file to define body it is as though I no longer correctly place the Para volume around it – visualising  the decay locations results in only a few semi-sporadic yellow dots which are sometimes not within the true heart volume (I don’t understand how locations outside of heart could be identified) and I of course get the loop 100000 exceptions.  
>  
> I need to better visualise my src_heart Para volume somehow – or pseudo-randomly walk my Para box around within the body to see if I can better place it to reduce these exceptions.
>  
> I hope this is a better explanation – and thanks again for the help.
>  
> Cheers
> Steve
>  
>  
>  
> From: maxime <maxime.chauvin at inserm.fr> 
> Sent: Tuesday, 19 May 2020 10:57 PM
> To: Steven Marsh <steven.marsh at canterbury.ac.nz>
> Cc: gate-users at lists.opengatecollaboration.org
> Subject: Re: [Gate-users] Confining heart source within tessalated STL body - loop 100000 errors.
>  
> Hi Steven,
>  
> can you tell us more about the errors you get ?
>  
>   Maxime
> 
> 
> On 19 May 2020, at 10:19, Steven Marsh <steven.marsh at canterbury.ac.nz <mailto:steven.marsh at canterbury.ac.nz>> wrote:
>  
> Hi Gate users…
>  
> I have successfully confined a STL defined volume source (heart) containing Tc-99m and I can place that within a body (src_Heart in code below) so long as “body” is a simple shape( a box in macro1). When I attempt to place the same confined src_Heart  within a “body” described by a tessellated surface, I get loop 100000 errors and I can visualise dots indicating the source positions for decay are not located within the heart (macro2). Below I include the important parts of my macros which attempt to do this – note for any run I only attempt to run either macro2 OR macro2 – not both.
>  
> Is it possible to encapsulate a confined source volume within a tessalated surface (body in my case)?
>  
> Any ideas much appreciated
>  
> Best wishes
> Steve
> -----------------------------------------------------------------------------------------------------------------------
> Macro1)  This works well…body is a simple box
> gate/world/daughters/name body
> /gate/world/daughters/insert box
> /gate/body/geometry/setXLength 20 cm
> /gate/body/geometry/setYLength 20 cm
> /gate/body/geometry/setZLength 20 cm
> /gate/body/vis/setColor blue
> /gate/body/vis/forceWireframe
> /gate/body/setMaterial Air
>  
> ## ---IMPORT STL FOR HEART AND POSITION IN BODY
> /gate/body/daughters/name heart
> /gate/body/daughters/insert tessellated
> /gate/heart/geometry/setPathToSTLFile data/patientData/STLFiles/Heart_Only.stl
> /gate/heart/setMaterial        Heart
>  
> --------------------------------------------------------------------------------------------------------------------------- END Macro1
> Macro2)  This doesn’t work – body is a tessalated surface
> gate/world/daughters/name body
> /gate/world/daughters/insert tessellated
> /gate/body/geometry/setPathToSTLFile data/patientData/STLFiles/Body.stl
> /gate/body/setMaterial        Body
>  
> #-----IMPORT STL FOR HEART AND POSITION IN BODY 
> /gate/body/daughters/name heart
> /gate/body/daughters/insert tessellated
> /gate/heart/geometry/setPathToSTLFile data/patientData/STLFiles/Heart_Only.stl
> #/gate/heart/geometry/setPathToSTLFile data/patientData/STLFiles/Heart.stl
> /gate/heart/setMaterial       Heart
> ----------------------------------------------------------------------------------------------------------------------------- End Macro2
> Macro3) the following is used for either of the above to confine the src_Heart volume to the heart STL shape
> /gate/source/addSource src_Heart gps
> /gate/source/src_Heart/gps/particle gamma
> /gate/source/src_Heart/gps/pos/type Volume
> /gate/source/src_Heart/gps/pos/shape Para
> /gate/source/src_Heart/gps/pos/centre 0 0 0 cm 
> /gate/source/src_Heart/gps/pos/halfx 10 cm  
> /gate/source/src_Heart/gps/pos/halfy 10 cm  
> /gate/source/src_Heart/gps/pos/halfz 10 cm 
> /gate/source/src_Heart/gps/ang/type iso
> #Define the source as a Tc99m source
> /gate/source/src_Heart/gps/energytype UserSpectrum
> /gate/source/src_Heart/gps/setSpectrumFile data/energy_spectrum_Tc99m.txt
> /gate/source/src_Heart/setForcedHalfLife  21624.12 s  #6.0 hrs
> /gate/source/src_Heart/setForcedUnstableFlag true
> /gate/source/src_Heart/setForcedHalfLife 21624.12 s
> /gate/source/src_Heart/setActivity {ACTIVITY} MBq
> # Now confine src_Heart to the shape of the heart.  
> /gate/source/src_Heart/gps/pos/confine heart
> ----------------------------------------------------------------------------------------------------------------------------- End Macro3
>  
> _______________________________________________
> Gate-users mailing list
> Gate-users at lists.opengatecollaboration.org <mailto:Gate-users at lists.opengatecollaboration.org>
> http://lists.opengatecollaboration.org/mailman/listinfo/gate-users <http://lists.opengatecollaboration.org/mailman/listinfo/gate-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20200520/4d553699/attachment-0001.html>


More information about the Gate-users mailing list