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!
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
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 : import pymedphys
In : pymedphys.Delivery?
Init signature: pymedphys.Delivery(*args, **kwargs)
Docstring: Delivery(monitor_units, gantry, collimator, mlc, jaw)
In : [item for item in dir(pymedphys.Delivery) if not item.startswith('_')]
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:
When PyMedPhys is installed you can start the GUI that we use by running the following command:
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:
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:
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.
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.
Only VMAT and IMRT are working now in v.37.1. Field in field and 3D are not working yet.
@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.
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.
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
with FPxxxxxxxx folders, each folder with a few TRF
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.