Hi all.
I am trying to analyze some Catphan600 images with pylinac. When i call the function analyze() in the module of Catphan600, it gives me the following error:
Cell In[1], line 11
9 my_acq.catphan_size
10 #my_acq.find_phantom_roll()
—> 11 my_acq.analyze()
12 print(f"zs: {zs}“)
13 print(f"common_idxs: {common_idxs}”)
File ~\pylinac_env\Lib\site-packages\pylinac\ct.py:2500, in CatPhanBase.analyze(self, hu_tolerance, scaling_tolerance, thickness_tolerance, low_contrast_tolerance, cnr_threshold, zip_after, contrast_method, visibility_threshold, thickness_slice_straddle, expected_hu_values, x_adjustment, y_adjustment, angle_adjustment, roi_size_factor, scaling_factor)
2498 self.roi_size_factor = roi_size_factor
2499 self.scaling_factor = scaling_factor
→ 2500 self.localize()
2501 ctp404, offset = self._get_module(CTP404CP504, raise_empty=True)
2502 self.ctp404 = ctp404(
2503 self,
2504 offset=offset,
(…)
2510 expected_hu_values=expected_hu_values,
2511 )
File ~\pylinac_env\Lib\site-packages\pylinac\ct.py:2073, in CatPhanBase.localize(self)
2071 def localize(self) → None:
2072 “”“Find the slice number of the catphan’s HU linearity module and roll angle”“”
→ 2073 self._phantom_center_func = self.find_phantom_axis()
2074 self.origin_slice = self.find_origin_slice()
2075 self.catphan_roll = self.find_phantom_roll() + self.angle_adjustment
File ~\pylinac_env\Lib\site-packages\pylinac\ct.py:2153, in CatPhanBase.find_phantom_axis(self)
2148 common_idxs = np.intersect1d(x_idxs, y_idxs)
2149 # fit to 1D polynomials; inspiration: python - Fitting a polynomial using np.polyfit in 3 dimensions - Stack Overflow
2150 # rcond should be explicitly passed. Started randomly failing in the pipe. v1.14.0 numpy release notes
2151 # say it should be explicitly passed. Value is arbitrary but small and tests pass.
2152 fit_zx = np.poly1d(
→ 2153 np.polyfit(zs[common_idxs], center_xs[common_idxs], deg=1, rcond=0.00001)
2154 )
2155 fit_zy = np.poly1d(
2156 np.polyfit(zs[common_idxs], center_ys[common_idxs], deg=1, rcond=0.00001)
2157 )
2158 return fit_zx, fit_zy
File ~\pylinac_env\Lib\site-packages\numpy\lib\polynomial.py:639, in polyfit(x, y, deg, rcond, full, w, cov)
637 raise TypeError(“expected 1D vector for x”)
638 if x.size == 0:
→ 639 raise TypeError(“expected non-empty vector for x”)
640 if y.ndim < 1 or y.ndim > 2:
641 raise TypeError(“expected 1D or 2D array for y”)
TypeError: expected non-empty vector for x
How can i fix it? Thank you