Dear Pylinac Community,
I encountered an error while analyzing the CIRS062 phantom using Pylinac. The script loads the DICOM ZIP file and provides electron density values but fails at analyze(), returning:
----------------------------------------------------------------------------------------------------------------------------------------------
C:\Users\ONCENTRA\Desktop\pylinac_dev\env\Lib\site-packages\numpy\core\fromnumeric.py:3504: RuntimeWarning: Mean of empty slice.
return _methods._mean(a, axis=axis, dtype=dtype,
C:\Users\ONCENTRA\Desktop\pylinac_dev\env\Lib\site-packages\numpy\core\_methods.py:129: RuntimeWarning: invalid value encountered in scalar divide
ret = ret.dtype.type(ret / rcount)
Traceback (most recent call last):
File "c:\Users\ONCENTRA\Desktop\pylinac_dev\cirs062.py", line 53, in <module>
phantom.analyze(electron_density)
File "C:\Users\ONCENTRA\Desktop\pylinac_dev\env\Lib\site-packages\pylinac\cheese.py", line 296, in analyze
self.localize(origin_slice=origin_slice)
File "C:\Users\ONCENTRA\Desktop\pylinac_dev\env\Lib\site-packages\pylinac\ct.py", line 2071, in localize
self._phantom_center_func = self.find_phantom_axis()
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ONCENTRA\Desktop\pylinac_dev\env\Lib\site-packages\pylinac\ct.py", line 2161, in find_phantom_axis
np.polyfit(zs[common_idxs], center_xs[common_idxs], deg=1, rcond=0.00001)
File "C:\Users\ONCENTRA\Desktop\pylinac_dev\env\Lib\site-packages\numpy\lib\polynomial.py", line 639, in polyfit
raise TypeError("expected non-empty vector for x")
TypeError: expected non-empty vector for x
----------------------------------------------------------------------------------------------------------------------------------------------
It seems the phantom is not being localized correctly, leading to empty data for axis fitting. Despite enabling clear_borders and verifying the DICOM dataset, no ROIs are detected.
Has anyone successfully analyzed the CIRS062 phantom with Pylinac? Any advice on preprocessing or parameter adjustments would be appreciated.
I’m attaching the DICOM images and error logs for reference.
Hi Thomas,
Thank you for your response and for your valuable suggestion.
I have verified that the folder contains only the slices from the phantom, without any additional files like SR, .xml, or overview. I am currently using the latest version of Pylinac (3.31.0).
Following your remark, I tested multiple versions, and I found that the code works correctly only with version 3.17.0, but not with the newer ones.
Your insight was very helpful, and it ultimately allowed me to resolve the issue. I really appreciate your support!
Best regards,
[Ahmed]