Radiation Hazard Sign irradiation pattern
Purpose: to show usage of python preparser with meta-input code.
Note how to programmatically build a complex rtplan.
Meta-input file
# create a 'radiation hazard' irradiation pattern
# use many spots with gaussian cross-section (programmatically build an rtplan)
# use typical interspot spacing for uniform irradiation
nprim = 1e3
def: R = 3
def: side = 6*R*2
def: spotSize = R/3
func: thSpacing(r) = spotSize/r/3
region: phantom ; L=[$side,$side,1] ; voxels = [200,200,1]
field: 1; O=[0,0,-100] ; L=[40,40,10]
pbmaster: 1 ; Xsec = gauss; FWHM=$spotSize ; T = 100; columns = [P.x,P.y]
# build rtplan
def: ipb = 0 # spot (i.e. pencil beam) index
# central disc
for(r in np.arange(0,R,spotSize/3))<
for(th in np.linspace(0,2*pi,int(2*pi/thSpacing(r)),endpoint=False))<
def: x = r*cos(th)
def: y = r*sin(th)
pb: $ipb 1 $x $y
def: ipb = ipb+1
for>
for>
# sectors
for(i in range(3))< # sector index
for(r in np.arange(1.5*R,5*R,spotSize/3))<
for(th in np.linspace(0,pi/3,int(pi/3/thSpacing(r))))<
def: x = r*cos(th+pi/3+2*pi/3*i)
def: y = r*sin(th+pi/3+2*pi/3*i)
pb: $ipb 1 $x $y
def: ipb = ipb+1
for>
for>
for>
deliver: all
The python preparser generates the following input file (look into out/log/run.inp
):
nprim = 1e3
region: phantom ; L=[36,36,1] ; voxels = [200,200,1]
field: 1; O=[0,0,-100] ; L=[40,40,10]
pbmaster: 1 ; Xsec = gauss; FWHM=1 ; T = 100; columns = [P.x,P.y]
pb: 0 1 0.333333 0
pb: 1 1 0.166667 0.288675
pb: 2 1 -0.166667 0.288675
pb: 3 1 -0.333333 4.08216e-17
pb: 4 1 -0.166667 -0.288675
pb: 5 1 0.166667 -0.288675
pb: 6 1 0.666667 0
pb: 7 1 0.57735 0.333333
pb: 8 1 0.333333 0.57735
pb: 9 1 4.08216e-17 0.666667
pb: 10 1 -0.333333 0.57735
...
...
...
pb: 3089 1 14.7972 -1.03472
pb: 3090 1 14.8173 -0.690125
pb: 3091 1 14.8293 -0.345156
pb: 3092 1 14.8333 -3.63312e-15
deliver: all
Results:
The generated rtplan has a few thousands spot.
The resulting irradiation pattern on the phantom looks like: