planar imaging slow in python 3.7.2


I am experiencing some problems with pylinac in the latest Anaconda python distribution. For some reason, the planar imaging module is now extremely slow. It takes about 2 minutes to do the analysis on my computer. Is anyone experiencing the same problem? I am using python version 3.7.2. and all the latest packages.

I am now experimenting with older version of python to see if I can fix it. By the looks of it, the problem lies in the scikit-image module or scipy.


Dear James,

I think that there may be a problem with the planar_imaging module. I was checking what is going on when StandardImagingQC3 is analyzing an image. It seems that certain function are called repeatedly. For example _phan_region(self) is called many times. At least I think this is the reason why it seems to be so slow.


Dne četrtek, 14. februar 2019 17.39.51 UTC+1 je oseba Denis Brojan napisala:

It’s me again. I may have found the problem. Is it possible that the phantom_ski_region is missing the wrapper lru_cache()?


Hi again!

I think the planar_imaging module is broken.

  1. The StandardImagingQC3 model has a problem with repeating the analysis many times for no reason that I could determine. That is way it is so slow.

  2. LeedsTOR also seems to have a problem. I tried analyzing an old image in the newest version of pylinac and with a version before pdf reports were available. The newest version improperly determines the phantom angle, so I get bad results. For some reason the function phantom_angle() is called twice with different results. For example, the first output is -2.1995 and the second -1.8939. But only the first result is correct. If I force this function to always give -2.1995, the result is what it should be. So I think there is problem with the code.


thanks for reporting this. I had used lru_cache() before but I removed it because reanalyzing the phantom (e.g. after adjusting the image) would use the cached values. The planar imaging module has given me quite a bit of trouble due to phantom rotation determination and also the background image often being non-uniform. I have an issue to work on this for the v2.3 release, whenever I get time to do it =S

Hi again,

I believe that there is a memory leak in the planar_imaging module (version 2.2.6). When I repeat the analysis of the LeedsTor and QC3 phantoms, the memory consumption keeps growing.


Dne sobota, 23. februar 2019 02.47.26 UTC+1 je oseba James Kerns napisala: