Hello,
I have got the following code, which was working perfectly fine and gave results for all tests:
import io
import math
import pylinac
from matplotlib import pyplot as plt
from pylinac import WinstonLutz
from pylinac.winston_lutz import GANTRY, COLLIMATOR, COUCH, COMBO, EPID
GANTRY = ‘Gantry’
COLLIMATOR = ‘Collimator’
COUCH = ‘Couch’
COMBO = ‘Combo’
EPID = ‘Epid’
REFERENCE = ‘Reference’
ALL = 'All
#wl = WinstonLutz.from_zip(……)
wl = WinstonLutz.from_zip(BIN_FILE.path)
wl.plot_images(show=False)
figure = plt.gcf()
UTILS.write_file(“wl.png”, figure)
wl_analysis = {
‘gantry iso size’: wl.gantry_iso_size,
‘collimator iso size’ : wl.collimator_iso_size,
‘couch iso size’ : wl.couch_iso_size,
‘shift vector x’ : wl.bb_shift_vector.x,
‘shift vector y’ : wl.bb_shift_vector.y,
‘shift vector z’ : wl.bb_shift_vector.z,
“cax to bb max”: wl.cax2bb_distance(‘max’),
“cax to bb median”: wl.cax2bb_distance(‘median’),
'nimages" : len(wl.images),
‘gantry max rms dev’ : max(wl.axis_rms_deviation(GANTRY)),
‘epid max rms dev’ : max(wl.axis_rms_deviation(EPID)),
‘coll max rms dev’ : max(wl.axis_rms_deviation(COLLIMATOR)),
‘couch max rms dev’ : max(wl.axis_rms_deviation(COUCH)),
‘shift’ : wl.bb_shift_instructions(couch_vrt=None, couch_lng=None, couch_lat=None),
}
wl.plot_summary(show=True)
summaryfigure = plt.gcf()
UTILS.write_file(“wlsummary.png”, summaryfigure)
Then, for single tests, I added commands to round up the return values, like this:
wl_coll_maxrmsdev=round(wl_analysis[‘coll max rms dev’],2)
However, at some point, QATrack failed so I started to delete the “round” commands accordingly to make it work again. I did not find any way to debug the code within QATrack and I have some issue with setting up an environment for Python and installing pip.
Since this moment I could never get the code to work again. I started to quote lines and eventually, deleted most of the code. I created a second test and test list, simply to find an issue, with the following content:
import pylinac
from pylinac import WinstonLutz
wl = WinstonLutz.from_zip(BIN_FILE.path)
wl_import = {
‘gantry iso size’: wl.gantry_iso_size,
}
Unfortunately, it does not import an image for some reason. Obviously, I did change file names to what was suggested and as I mentioned code was working fine earlier.
I will very appreciate your help as I have no idea what causes this. I restarted web browser, computer, but it also didn’t help.
With best wishes,
Klaudiusz