: Issue with CIRS062 Phantom Analysis in Pylinac – "expected non-empty vector for x"

41 views
Skip to first unread message

Bannan Ahmed

unread,
Feb 28, 2025, 1:53:23 PMFeb 28
to Pylinac


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.


Bannan Ahmed

unread,
Feb 28, 2025, 2:02:00 PMFeb 28
to Pylinac
  For reference, the DICOM images of the phantom and error logs can be downloaded from this link:  

https://drive.google.com/file/d/1UgoSPUM4nGAfa8aJhsUcwY50OCY561Jj/view?usp=drive_link

tbe...@gmail.com

unread,
Mar 6, 2025, 2:36:13 AMMar 6
to Pylinac
Hi,
I had no problems with your data. Did you remove the files from the folder that are not slices from the phantom? There was a SR, a .xml and some kind of overview.
If you have only the slices in your zip/folder and still get the error, which version of pylinac are you using?

regards
Thomas

oussama elmouden

unread,
Mar 6, 2025, 6:52:30 AMMar 6
to Pylinac

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]

Reply all
Reply to author
Forward
0 new messages