!----------------------Radiochromic Film Ruler Generator------------------------- ! ! Copyright 2013-2015 Henry Ford Health System ! ! This file is free to use and distribute, and should not be sold ! This program is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this script. If not, see . ! ! Author Information: ! Nicholas Bevins, Ph.D. ! !-------------------------------------------------------------------------------- ! ! This script is used to generate a ruler array to be printed on radiochromic ! film. To compile the script, the freely-available program GLE is required. ! For a description of commands and options, see the GLE documentation. ! Once downloaded, launch the script within GLE and then export the result in ! pdf format. Send this pdf file to a standard laser printer loaded with the ! blank sheets of radiochromic film. It is a good idea to print a test sheet of ! rulers on a standard sheet of paper that has been cut to the same dimension. ! Be sure that the sheet is loaded to print on the correct side, and that it ! won't get caught in the printer rollers. ! ! Current version: 1.0 (post AAPM 2015 release) ! 1.0 Release notes (7/21/2015): ! - Added file header with description and directions ! - Improved annotations within script for interpretation of code ! - Removed extraneous code that wasn't being used ! - Introduced version numbers (officially non-beta?) ! - Fixed the printer margins for both the horizontal and vertical direction ! - Generalized the script for any modality, adding in/out option and ! fluoro option. The fluoro option offsets the number labels so there is ! less strip in the beam. This minimizes the amount of wasted strip ! for each test (only interested in radiation outside the FOV). ! !-------------------------------------------------------------------------------- ! Define the size of the sheet in cm (the film size is 10" x 12") size 25.4 15.24 ! Cut film ! size 25.4 30.48 ! Full film ! Assign the total height and width variables (must be the same as the sheet size) tw=25.4; th=15.24; ! Set an offset for printer margins (to account for non-zero printer margin at the edge of the sheet) ofst=0.5; ! Set how many strips you'd like in each direction ! Fluoro: 40x10; Mammo: 40x6; CT: 40x4 numw=25; numh=3; ! Declare if you want the strips labeled with In/Out directions (1 yes, 0 no) inout=0; ! Declare if you want the offset "0" for fluoro testing (not desired for mammo or CT) (1 for offset, 0 for none) flro=0; ! w and h are the width and height of the strips. Shorten each strip to account for the printer offset. w=(tw-2*ofst)/numw; h=(th-2*ofst)/numh; ! mi and mj are the minor and major mark spacings on the rulers (in cm), respectively ! (the script is only really set up for mj=1 or 0.5, other numbers may result in a goofy-looking ruler) mi=0.1; mj=0.5; ! nummj and nummi are the total major and minor marks on each ruler (this should auto calculate) nummj=h/mj-1; nummi=h/mi-1; ! Set the text height (use smaller text for ins/outs) theight=0.3; stheight=0.15; ! Set the line width (cm) and style (2 is dotted) for the cut marks set lwidth 0.01 set lstyle 2 ! Draw the vertical cut marks for i=1 to numw-1 amove ofst+0+i*w th rline 0 -th next i ! Draw the horizontal cut marks for i=1 to numh-1 amove 0 -ofst+th-i*h rline tw 0 next i ! Set the line width (cm) and style (1 is solid) for the ruler marks set lwidth 0.015 set lstyle 1 ! Draw the major ruler ticks with labels ! The current major ticks are 1/2 the width of the ruler set just CC set hei theight for k=0 to numw-1 for j=0 to numh-1 amove ofst+0+k*w -ofst+th-j*h-(fix(mj/2)+1)/2 !fix rounds toward 0 for i=0 to nummj rline w/2 0 rmove w/4 0 if mj=1 then !This first if statement is for the zero mark write i-int(h/2)+flro else if 2*i=4*fix(i/2) then !The second if statement is for the other numerals write i/2-int(h/2)+flro else end if end if rmove -3*w/4 -mj next i next j next k if inout=1 then ! Label the Ins and Outs ("In" for inside the radiation field, "Out" for outside) set just CC set hei stheight for k=0 to numw-1 for j=0 to numh-1 amove ofst+0+k*w -ofst+th-j*h rmove 3*w/4 -stheight text In rmove 0 -h+2*stheight text Out next j next k else end if ! Draw the minor ruler ticks ! The current minor ticks are 1/3 the width of the ruler for k=0 to numw-1 for j=0 to numh-1 amove ofst+0+k*w -ofst+th-j*h for i=0 to nummi rline w/3 0 rmove -w/3 -mi next i next j next k