Elekta Log Files

I’m in the process of improving and automating the QA in our clinic. We have an Elekta Infinity and Versa, both with the agility head, and I’m very interested in log file analysis. But I’ve got some big picture questions about this process.

How is your clinic pulling the log files from the machine? Is this automatic or a manual process?

At what frequency are you pulling log files? (daily? weekly? monthly?)

What exactly are you comparing the log files with?

How does physics actually review the results? What do you do with the data?

If you can help me with getting this process set up for our clinic, I wouldn’t mind doing some documentation and a write-up.

Thanks for putting this project out there for the community!

Hi @ekryck,

Welcome to the PyMedPhys community :slight_smile:.

That would be absolutely amazing. There would be many others out there in the community who would find that quite helpful.

Actually, I am no longer working at my previous clinic where I wrote this code. I have gone out on my own to create the startup Radiotherapy AI focused initially on radiotherapy autocontouring. Nevertheless, I’d be more than happy to answer your questions :slight_smile:

At a high level, PyMedPhys has an object called Delivery accessible at pymedphys.Delivery. Running the following commands gives you a bit of an idea what is achievable with this object:

In [1]: import pymedphys

In [2]: pymedphys.Delivery?
Init signature: pymedphys.Delivery(*args, **kwargs)
Docstring:      Delivery(monitor_units, gantry, collimator, mlc, jaw)
File:           ~/.asdf/installs/python/3.9.7/lib/python3.9/site-packages/pymedphys/_delivery.py
Type:           type
Subclasses:     

In [3]: [item for item in dir(pymedphys.Delivery) if not item.startswith('_')]
Out[3]: 
['collimator',
 'combine',
 'count',
 'from_dicom',
 'from_icom',
 'from_logfile',
 'from_monaco',
 'from_mosaiq',
 'from_trf',
 'gantry',
 'index',
 'jaw',
 'merge',
 'metersetmap',
 'mlc',
 'monitor_units',
 'mu',
 'mudensity',
 'to_dicom']

Essentially, it is an object that includes the MU, gantry angle, collimator angle, MLC positions and Jaw positions. This object is able to be created from a DICOM plan file, an Elekta Icom live logfile stream, an Elekta TRF backup logfile, the backend files from the Monaco planning system, or a Mosaiq database.

So essentially, any of these 5 sources can be utilised and converted into this common Delivery format. Once it is in this common format one can utilise the metersetmap function to create a sort of first order fluence calculation. These fluence calculations are then able to be compared with something like a gamma.

We then created an interactive GUI that pulls all of this functionality into a web front end for use day-to-day. Here is a video presentation where I detail the usage of this web frontend (at ~6 mins in):

Here are some GitHub issue where I discuss a bit more about the usage of this Delivery object:

The TRF files are being extracted from the weekly Linac backup files are using the pymedphys trf orchestrate command. Here is the bat file that we run every night using Windows Scheduler:

The Icom stream is collected live. It is using the pymedphys icom listen command. Here is the bat file that is converted into a service to listen to the Linac and save the Icom stream:

As mentioned above these are then compared utilising metersetmap. Some examples of using metersetmap can be seen at:

https://docs.pymedphys.com/lib/ref/metersetmap.html#pymedphys.metersetmap.calculate

When PyMedPhys is installed you can start the GUI that we use by running the following command:

pymedphys gui

To customise how that GUI works, specific to your centre, you will need to create a config.toml file within the .pymedphys directory within your home drive. Here is the config.toml used at my previous centre:

Let me know if you need any more help :slight_smile:

Cheers,
Simon

@LipTeck_Chew, might you be able to reach out to @ekryck to give them a bit of a hand in getting started?

Hi @SimonBiggs, Hi @ekryck ,

We have managed to get the TRF files for two linacs (one VersaHD and one Infinity) out into a live folder and also group them into folders every biweekly.

We are also looking into automation. Our attempt to get information from MosaiqSQL has not been successful but the manual pymedphys is so far working ok for us.

There are a few challenges:

  1. Supplying PatientID information into the field description in Monaco plans so that the TRF files would have this information, removing the need to connect to MosaiqSQL.

  2. The Elekta TRF log files from time to time is affected and become " Z.trf" without field description information. Hence, even we can do (1), we still have to fix some of these Z files for automation. Fortunately, these files are still useful in manual pymedphys metersetmap using gui.

  3. Only VMAT and IMRT are working now in v.37.1. Field in field and 3D are not working yet.

  4. @SimonBiggs , could you show us in python command line how to compare a dicomRTPlan that has 3 TRF files instead of one TRF? Thank you.

  5. We hope it will be possible to reconstruct the TRF files back into a DicomRTPlan. This will enable a calculation of delivery plan in Monaco and then dose comparison!
    Is it possible with manual command line?

@ekryck , hope you have managed to get it up and going.

regards,
LipTeck

Hi @LipTeck_Chew,

Certainly :slight_smile:. Once you’ve converted the TRF file into a delivery object you can calculate the meterset map for each TRF file, and then add them all together. Here is how the PyMedPhys GUI does it:

Then, once the GUI has calculated the total meterset map for both the DICOM plan file and the TRF files it compares them using gamma:

Once it has the reference and evaluation metersetmap results, and the gamma determination it then plots everything using the following function:

Hi @SimonBiggs

Thank you for pointing out the codes in streamlit. Is it possible to run the pymedphys command line directly without going through the gui?

Meanwhile, I am thinking that there is no quick solution to workaround the missing field information in Z-TRF but to rely on RT or physicist who have performed the QA -plan/treatment plan delivery to copy the TRF files into manual patientID folder, say

D:\TRF\

with FPxxxxxxxx folders, each folder with a few TRF

Dicom Folder:

D:\dicom\FPxxxxxxxx_ApprovedPlan.dcm

Completed Folder:

D:\dicom_done\

D:\TRF_done\

PDF Folder:

D:\PDF\FPxxxxxxxx_ApprovedPlan.pdf

Then, we do a cron script to look into the dicom folder and TRF folder to match the PatientID (FPxxxxxxxx) so that,

it will then automatically run the MetersetMap and produce the PDF. Once completed, the cron script moves the dicom and trf folder to the respective done directories.

The current script runs in the gui. Could you enlighten me ? Thank you.

regards,
LipTeck

Have you looked into utilising the Icom logfiles? When using the Icom stream it has all of that information that I suspect you are after.

Unfortunately There aren’t any pymedphys CLI commands for metersetmap. Here are all of the TRF CLI commands:

https://docs.pymedphys.com/cli/ref/trf.html

You can however directly use Python to automate this. The following GitHub issue has some details of how to do it:

Cheers,
Simon