Convert EPID Images
13 March 2008
Calibration, Deconvolution, In Air
Off Axis Ratio
Deconvolution Kernel and EPID
Response Variations
Program ConvertEPIDImages has been provided to read in images from the Varian and Elekta portal imaging systems and to convert them to fluence files for input to Dosimetry Check. For Elekta systems you must first run the IviewToDicom utility to convert to Dicom files. This program will read Varian files directly. For the Map Check and PTW 2D arrays, use the ConvertMapCheckImages and ConvertPTW2DImages executable versions of this program.
Images must be calibrated in a fluence unit, here defined to be the relative monitor unit (rmu), which is the intensity relative to the intensity on the central ray of a calibration field size, typically 10x10 cm.
The effect of scatter within the detector itself must be removed to convert the image back to a fluence image. A two dimensional deconvolution with the inverse of the point spread function is done to accomplish this.
The flood view correction for an EPID removes the off axis variation inherent in radiation fields due to things like the flattening filter. If removed, it must be restored. See note below on shifting the EPID or detector.
There are three options for the steps above:
Option 1:
This conversion consists of four steps:
Option 2:
Varian will multiple in off axis ratio data measured at dmax in water. The dmax curve is nearly the same as an in air curve. Therefore, one may use the field image as is and not multiple in the in air curve. Further, the user has the option of supplying their own data. Only steps 1 and 2 above would be performed. This would be the option to use for other devices that are not corrected by a flood view.
Option 3:
For the case where in water OCR has been multiplied in, first remove the in water off axis ratio data (at dmax) that the image was multiplied by. This should restore the integrated image to after correction by the flood view. Then after deconvolution, multiply in the in air data. This works slightly better but there is hardly any difference.
The method is set at the time the kernel is fitted (see below) and is passed in the kernel parameter file. The same kernel can be used for either option and the method could be switched by editing the kernel file.
These steps require data. The first step requires a calibration curve that can be generated from one or more images of a 10x10 cm field at different monitor units. This curve may have to be regenerated depending upon the stability of the imaging system. Note: if you calibrate your treatment machine to a different field size, use that field size. For integrating systems, one single calibration field (10x10 cm) should suffice.
The second step requires a deconvolution kernel, and the third in air off axis ratio data.
The third option requires the same in water off axis data that was used by the Varian EPID software.
The kernel generation for deconvolution is covered in a separate document: “Fitting Deconvolution Kernels for Electronic Portal Imaging Devices (EPID).” A link to the kernel fitting toolbar is provided in this program as shown below.
The in air off axis ratio curve that is part of the accelerator data base for a particular energy is used directly. This requires that the accelerator and energy be selected at the time of conversion. This curve is a circularly symmetric curve as a function of radius (equivalently as a function of angle with the central ray). It is measured with a detector in air but with a build up cap. We recommend you use something like brass instead of plastic. Generally you would scan the diagonals of a 40x40 field at any convenient distance, and take an average of each of the four legs.
The image files are written out in “Field Dose” format for direct input by Dosimetry Check (see the Dosimetry Check manual). In Dosimetry Check for each treatment portal (beam) the user must select the corresponding Field Dose file. Dosimetry Check will automatically select the files, adding them together if necessary, if the beam names are found within the converted file names. The field fluence is then stored separately under the beam name (in the beam’s directory under the plan in the patient’s directory).
The image files may here be converted as a group.
If the EPID or detector is calibrated with flood field, then fields should be integrated with the EPID or detector at the same location for the OCR to be properly restored.
When the flood correction is done in the calibration of the EPID, the individual pixel gains are adjusted to give the same value. However, the flood field is not flat, and so this calibration wipes out the "in air off center ratio effect (OCR) due to the effect of the flattening filter and other variations of intensity off axis. Hence that curve has to be restored and it is perfectly appropriated to simply multiply it back it since this is a fluence function.
What happens, however, if you move your EPID off axis, say for argument 5.0 cm? Let us look at some in air OCR data (measured on a Varian at 6x):
Tangent OCR where Tangent x 100 cm = distance cm from central axis at 100 cm
0.0000 1.0000
0.0050 1.0008
0.0100 1.0034
0.0150 1.0059
0.0200 1.0084
0.0250 1.0102
0.0300 1.0110
0.0350 1.0131
0.0400 1.0172
0.0450 1.0210
0.0500 1.0243
0.0550 1.0263
0.0600 1.0273
0.0650 1.0282
0.0700 1.0289
0.0750 1.0297
0.0800 1.0305
0.0850 1.0310
0.0900 1.0311
0.0950 1.0316
0.1000 1.0324
0.1050 1.0332
0.1100 1.0342
0.1150 1.0347
0.1200 1.0348
0.1250 1.0350
0.1300 1.0355
0.1350 1.0362
0.1400 1.0373
0.1450 1.0382
0.1500 1.0391
etc…
So let us assume that the gain of all the pixels are all the same (and we are
assuming circular symmetry). Further,
we will here assume that the in air OCR is multiplied in relative to the
central axis, not where the central axis was when the flood view correction was
done.
Pixel values for a flood view at 5 cm will be 1.0243 and at 10 cm will be 1.0324. So after the flood view correction a point 5 cm from the c.a. will be multiplied by 1/1.0243 and at 10.0 by 1/1.0324
Upon restoration of the curve, we once again have values of 1.0243 at 5 cm and 1.0324 at 10 cm. I.e., using pixel value = signal times flood view correction times in air OCR:
at 0: pixel value = 1.0 x 1/1.0 x 1.0 =
1.0
at 5: pixel value = 1.0243 x 1/1.0243 x
1.0243 = 1.0243
at 10: pixel value = 1.0324 x 1/1.0324 x 1.0324 =
1.0324
Suppose now however that the EPID is shifted 5 cm with the center of the EPID now at 5 cm in the above OCR table. Because we take the 10x10cm calibration field with the EPID at the same position we will get the correct rmu on the central axis of the radiation field. However, consider what happens to the values at + and - 5 cm closer and further from the machine along the direction of the shift:
Using again:
pixel value = signal times flood view correction times in
air OCR
at 0: (prior center of EPID) pixel value = 1.0243 x
1/1.0000 x 1.0243 = 1.0492
at 5: (central axis)
pixel value = 1.0000 x 1/1.0243 x 1.0000
= 0.9763
at
10:
pixel value = 1.0243 x 1/1.0324 x 1.0243 = 1.0163
Normalizing to the central axis (since we calibrate the field there) we will
have the final result:
0 cm 5 cm
10 cm
1.075
1.000
1.041
But correct values are:
1.0243 1.000
1.0243
At present, this program will restore the in air OCR relative to the position of the central axis and not the center of the imaging device.
This may be incorrect as shown immediately above. The Varian system will multiply in an OCR curve, in which case program ConvertEPIDImages should not also restore the OCR. Whether Varian takes into account any shift from the flood view position is not presently known to this author. The Varian system also allows for a shift in source image distance (SID). A change in SID results in a change in magnification of the OCR curve. Reapplying the OCR for a different magnification will also result in some distortion, although perhaps not as large an effect as a shift if the OCR has a nearly constant slope off axis. Hence the present recommendation that if flood view corrected, perform the flood view at the same center and SID that the EPID will be used acquiring data for Dosimetry Check.
The use must first select the accelerator and energy for which the images were obtained. The choose accelerator and energy toolbar is shown below:
![]()
Simply pick the accelerator from the pull down list and then the energy, and then hit the “Continue…” button.
The EPID toolbar is shown below:
![]()
The options pull down is shown:

We will cover each option below.
The patient must first be selected or a patient entry created. The other buttons on the pull down will be grayed out until a patient entry is defined. Resulting Field Dose files are written to the patient directory under the patient’s name in sub-directory FieldDose.d. The treatment plan and stacked image set should be stored under the same patient entry.
A patient entry is actually a directory name made out of the patient’s name in the patient directory. The patient directory is defined by the file PatientDirectory.loc in the program resources directory (which is in turn defined by the file rlresources.dir.loc in the current directory).
Use this option to convert images once a calibration curve and kernel is available. You will first get a file selection box to select the EPID files to be converted:

Select all the fields for the same machine and energy for the case. Then hit the OK button.
The default directory where the files selection box will start at is defined in the file NewEPIDImagesDirectory.loc in the program resources directory. This file can be edited to move that location. Files with the letters “cal” (case insensitive) in them are assumed to be calibration files rather than files of images to be converted. If only one such calibration file it will be assumed to be used for all files. If more than one and if the files to be converted are for different gantry angles, then the calibration files will be initially assigned to files with the same gantry angle. The user may change the assignments.
The selected files will then appear in the next popup:

There are two issues to be dealt with here, calibration and centering. Because the imaging device may be subject to sagging as the gantry rotates for some mounting systems, a provision is made here to allow each image to be centered and calibrated separately. Calibration would require a 10x10 cm field (assuming that is the calibration condition for the machine) with a known monitor unit exposure. This same field can be used to define where the central ray is at a particular gantry angle. You would not normally use the IMRT integrated image for centering because the field boundaries are not well defined relative to the central axis.
For each selected file to be converted, there are two rows with text fields and the Select Center/Calibration pull down menu. The file to be converted is shown in the first column first row text field. The current center coordinates are shown in the second column first row (blank is 0,0). The gantry angle, if known, and the source image distance (SID) is shown in the next text field. In the last column first row is the file name that will be used for the resultant Field Dose file that will be written into the particular patient’s directory. A Field Dose file holds the fluence image for a field. The user may change this file name. If the field dose file name includes the beam name (case insensitive), then Dosimetry Check will be able to automatically associate field dose files with treatment beams, adding the field fluence from more than one file if necessary in the case of an MLC carriage shift.
You can calibrate and find the central ray for each field file individually. If calibration files were not included in the original selected list, hit the “Center/Calibration” to select more files. The first text field on the second row displays the Center/Calibration file name, if one was selected, the next text field shows the signal value from the center-calibration image, and the last text field is where the monitor units are to be entered if images are to be individually calibrated. Enter a monitor unit value here followed by the enter key will enter that monitor unit in all the mu text fields that are below the one entered. If this is not desired, don’t hit the enter key after entering the number. The monitor units will also default to the value last used for the machine and energy selected.
Shown below is an example of individual calibration, where a calibration file has been selected for an individual file. The pull down menu may be used to select a different calibration file, or the association removed by selecting “No Selection”, or the text fields erased by selecting Reset.

If you are not going to enter a separate calibration field for every image, you can select a file to use for all the fields by hitting the “Center All/Cal. All” button near the bottom of the popup. You may use the same image to center all images (see below) and to specify the calibration. At the bottom of the popup is a text field where the signal from the center of the centering field is shown, and next to it is where the monitor units for this field is entered. A calibration constant will be generated as the ratio of mu/signal and applied to all fields for which an individual calibration was not established. The below selected calibration curve will be ignored. If an entry is not made here, then the below calibration curve will be used for all fields not individually calibrated.
You can generate a calibration curve. However, this is generally not needed since integration results in a linear response with a zero intercept and so can be done as above with a single point. Either hit the “Select Calibration Curve” button to select a calibration curve or create one here. Once a calibration curve is selected and used, the same curve will be the default entry here for this machine and energy. Calibration curves are stored in the data sub-directory CalDCur.d. The data directory is located by the file DataDir.loc in the program resources directory rl.dir specified by file rlresources.dir.loc in the current directory.
An entry will also be made in the data directory for each treatment machine to store the name of the last calibration file used here. A folder is made for the machine name, then the energy (such as X06), and then stored in the file EPIDcalFile is the name of the calibration file last used.
You can use one file to find the central ray for all images by hitting the “Center All/Cal. All” button and selecting a calibration image file. Or you can select a calibration file for an individual file using the “Select Center/Calibration” pull down menu for each image entry. In both cases you will get a display of the calibration image. Hitting the “Control” button in the lower left hand corner of the image will bring up the centering control as shown below:

Set the field size if different from 10x10, and then use the translate X and Y controls to move the field drawing to coincide with the field image. Or try the AutoCenter button. The center off set will be shown in the above convert to dose control. Your task here is define where the central ray is relative to the treatment radiation fields. But you must also find the center signal value at the center of the calibration field. Normally this is done in one operation as shown here.
Note also the toggle buttons for Set Center and Set Calibration, each with a text field. Both buttons are normally ON (in) and the centering and center value will be forwarded to the convert to dose tool. However, you could turn one of them off to specify centering separately from finding the center signal value. This may be of use if the EPID is moved off center so that the center of a centered 10x10 would miss the EPID or be near the edge. Move the field image to define the true location of the central ray. Then turn off Set Center and move to define the center of the 10x10 calibration field to get the signal value. What is turned off will not update to the right. However, if you have two images to use, then use the one in the same location as the image to be converted to find the central ray and a second with a centered calibation image to get the center signal value.
If you used the individual method, you must then type in the monitor units used for the 10x10 cm field for the calibration to be used. The calibration factor (of monitor unit/signal) will be used as a factor to convert the pixels of the integrated selected field to RMU, with the signal value coming from the center of the calibration field. Note that it is assumed here that zero signal is zero monitor units. If you do not enter the monitor units in the text field provided, the calibration cannot be used since the numerator is not specified.
The order is to use the individual calibration if defined. If not entered, then to use the global all calibration. If that was not entered, then to use the above selected calibration curve file if one was entered. If no calibration is defined, there will be an error message.
The calibration image files are auto centered if included with the original list of files. There is a button to command auto-centering all of the calibration images that were select for individual use. For the All option, use the Control button on the image of the field.
Hit the “Select Deconvolution Kernel” to select the kernel to use. Again thereafter the program will default to the selection for the same machine and energy. An entry will be made in the data directory for each treatment machine and energy to store the name of the last kernel file used, in the file EPIDkernelFile.
Do not deconvolute
images that are to be used to fit the kernel.
Unselect the toggle button if the files are to be used for fitting the kernel. The kernel fitting routine won’t accept files that have already been put through a deconvolution process. Unselecting also means that the in air off center ratio function will not be multiplied in.
We suggest leaving the pixel size at 1 mm for the resultant Field Dose file for normal operation.
When finished, hit the “Convert to RMU” button. The images will be processed and written out. Then run Dosimetry Check, and for each beam select the appropriate Field Dose file created here if not found automatically. You might also want to restrict the area of the fluence images to save computation time as the EPID may have measured a large area in relation to the size of the area containing actual radiation. However, leave a suitable margin as the penumbra is part of what is being measured here. See below.
A “Field Dose” file contains the fluence map. If the field dose file name contains the beam name from the plan, then Dosimetry Check will automatically find the field dose file for the beam. If more then one file contains the beam name, then the fields will be added. Adding might be appropriate if a carriage shift was required for the MLC and each was integrated separately. Varis or Arian will automatically assign a name containing the beam name for you. You must configure the Dicom Export Wizard to do this. Select “Patient ID + Suffix” when creating the export filter. For Elekta, our utility IviewToDicom will do this for you.
After converting the fields, the resulting fields will be displayed on a single new screen. As the EPID area may be very large compared to the radiation area, some advantage is had by reducing the margin around the radiation area, as this will reduce the computation time in Dosimetry Check. If the EPID area is otherwise 40x30 cm, Dosimetry Check will set up its dose array for a 40x30 size beam area. To save computation time, you can reduce the area of the active field. But you must leave an adequate margin around the radiation field, of the order of 3 to 5 cm, as signal in the tail of the field edge is needed to account for radiation that is in the penumbra of a field.
You will also have the opportunity to restrict the field area in Dosimetry Check and you need not do it here. And there you can apply the restriction from one field to all of them. Further, if fields need to be added you may as well wait and do this function in Dosimetry Check.
See the Dosimetry Check manual under Field Dose section for details on the Restrict Area tool. Basically you can take the mouse and drag a rectangular area or set the same with the wheel controls provided. Upon acceptance, the file will be rewritten if already written to or read from a file.
Use this option to create a calibration curve. You would normally integrate at least two 10x10 cm field size at two different monitor units. We would recommend three fields, with the monitor units well spread out to cover the effective range of monitor units used in patient cases. The effective range is not necessarily the total monitor units for a modulated field but is generally considerably less. However, once you have established that the response is linear, as it should be, and that the intercept is zero, you can create a curve with only one field read in. Then manually enter zero signal and zero monitor units for a second point.
However, when using the centering image as described above, only the one point is used for calibration with an assumed intercept value of zero and the curve fit is ignored. Using a 10x10 with each case insures that any drift in EPID is accounted for.
We are assuming here in this description that your machine calibration is performed for a 10x10 cm field. If you calibrate to a different field size, then use that field size.
The calibration popup is shown below:

You first hit the “Get Point From Image File” button at which you will get the file selection popup shown below.

Here you can only select one file at a time. Hit the “Apply” button and use the “OK” button on the last file to take down the popup, or hit the Cancel button.
The program will read the signal value at the center of the field and write this number into the first text box as the signal value in the FitSignalDose popup shown above. You must then type in the monitor units used to expose the field. The image will also be displayed and you will also get a centering control as shown above to find the central axis if that is necessary. The signal field will update as you adjust the center.
When all fields have been entered, hit the “Fit Data” button which is described below. After fitting a straight line, save the calibration file by selecting the “Save As” button.
Files are saved to the subdirectory CalDCur.d in the data directory (located by file DataDir.loc in the program resources directory).
This button will bring up the Field Dose curve fitting popup control. But the control will be defaulted to a linear fit. We recommend that you not change it from a linear fit. Only a linear fit can be extrapolated. Otherwise you would have to provide a zero point (which you could type in). The results of any fit will always truncate RMU < 0 to 0 and so never allow a negative RMU value.

The functions of this control are described in detail in the Field Dose section of the Dosimetry Check manual. Here it is only necessary to hit the “Fit Curve to Data” button.
And you may want to enter a title for the plot.
After fitting the line, you can dismiss this popup. Then save the calibration curve.
Under the Options pull down are direct access to the Show Dose (RMU) function described below from the Field Dose toolbar, the show RMU profile described in the Dosimetry Check manual (Plan section), and a distance measuring tool. Be aware that the distance measuring tool will show the pixel value of the image being displayed. The pixel value is not the integrated RMU value. These tools are provided for convenience in evaluating a fluence image for correctness.
Access to the Field Dose toolbar as described in the Dosimetry Check manual is provided here for the convenience of using some of those functions. Only the functions under the Dose pull down will be applicable. A useful function would be to view the RMU values at different points on the field images described next.
In particular, under the Dose pull down is the “Show Dose” function which can be used here to display the RMU of a converted file. Use this function to check the current calibration of a 10x10 cm field. You might want to include a 10x10 field with each case to test the stability of the EPID system for example if you are not individually calibrating images. The center of a converted test image should hold the monitor units used to make the image.
Another useful function is the Combine Fields function that can be used to add two or more fields together. This can also be done in Dosimetry Check by selecting more than one field dose file for a beam. If you perform this function here, you will have to formally save the result to a new file.
You will need a deconvolution kernel to convert integrated fields back to in air fluence. You probably should take all your data at the same EPID SID (source image distance). There may be some variation between centers and some small changes with the calibration of the EPID. Therefore you probably should perform your own kernel fit periodically as needed. See the reference at the end of this manual. After the deconvolution of square open fields, the RMU values in the center of the fields should reflect the in air collimator scatter factor normalized to 10x10.
Above in Table 1 in column three is the integration values after deconvolution. These values are now equivalent to the in air scatter collimator factor (here x 100). We define the in air scatter collimator factor Sc by the equation:
Output factor = Sp X Sc
Where Sp is the phantom scatter, and the output factor is the dose at depth of dmax. Note that measuring the Sc factor is subject to systematic error due to the need for a buildup cap, which acts like a phantom, and so is not a true in air measurement. Hence the measured Sc factor in column 4 does not agree with that computed in column 5. A pencil beam algorithm is used to compute the phantom scatter Sp, and that is divided into the measure output factor to get the in air collimator scatter factor Sc. Deconvolution of the EPID integration fields is necessary to produce the in air fluence, which is then used as input to the dose algorithm. Hence the in air fluence in column 3 is used to compute the dose in column 7.
Lastly, it has been our experience that measured output for 2x2 fields is generally accompanied by a large uncertaintly if an ion chamber is used, and generally is too small a value.
Hit this button to get the kernel generation tool described in the “Fitting Deconvolution Kernels for Electronic Portal Imaging Devices (EPID)” manual. But you must first convert EPID images to RMU files (Field Dose files) without the deconvolution process. Use those files along with either the output factor or water phantom scans to fit the kernel. You can fit a kernel using only a single point on the central axis which is the preferred method. To do that either use the output field factors in the machine’s data base, or you can create a profile scan file that consists of a single point for each field size. An example of a file follows below:
//
Varian 2100CD 6x
/* file
type: 1 = scan */ 1
/* file
format version: */ 2
/*
machine name: */ <*VarianStd*>
/*
energy = */ 6
/* date
of data: */ <**>
/*
wedge number, 0 = no wedge */ 0
/* field
size in cm = */ 8.00 8.00
/*
field size defined at isocentric distance of machine= */ 100.000000
/*
Source to Surface Distance (SSD) in cm = */ 100.0
// Here
z = 0 is at SSD, negative is depth.
/*
Number of scans: */ 1
/*
number of points this scan: */ 1
/* x,
y, z value */
0.0
0.000 -1.600 0.981
Refer to the ASCII file standard in the System2100 manual. // to end of line and /* to */ are comments which the program ignores when reading the file. Text data of more than one word must be set off with <* to *>. The value must be the dose rate in cGy/mu and must agree with the definition of the machine calibration in the calibration file. This file is to be put in the machine data directory under the proper energy directory. Note the above value is for calibration of 100 cm to surface where at a depth of 1.6 cm is 1.000 cGy/mu for a 10x10 cm field.