Closed Clarkszw closed 1 year ago
If you run pytest -svv fury/tests/test_actors.py::test_peak_slicer you will see:
pytest -svv fury/tests/test_actors.py::test_peak_slicer
fury/tests/test_actors.py::test_peak_slicer FAILED ========================================================================== FAILURES ========================================================================== ______________________________________________________________________ test_peak_slicer ______________________________________________________________________ interactive = False def test_peak_slicer(interactive=False): _peak_dirs = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype='f4') # peak_dirs.shape = (1, 1, 1) + peak_dirs.shape peak_dirs = np.zeros((11, 11, 11, 3, 3)) peak_values = np.random.rand(11, 11, 11, 3) peak_dirs[:, :, :] = _peak_dirs scene = window.Scene() > peak_actor = actor.peak_slicer(peak_dirs) fury\tests\test_actors.py:613: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ fury\actor.py:1538: in peak_slicer peak_actor.display_extent( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <PeakSlicerActor(0x000001E5B17CECF0) at 0x000001E5B7291780>, x1 = 0, x2 = 10, y1 = 0, y2 = 10, z1 = 5, z2 = 5 def display_extent(self, x1, x2, y1, y2, z1, z2): tmp_mask = np.zeros(grid_shape, dtype=bool) tmp_mask[x1 : x2 + 1, y1 : y2 + 1, z1 : z2 + 1] = True tmp_mask = np.bitwise_and(tmp_mask, mask) ijk = np.ascontiguousarray(np.array(np.nonzero(tmp_mask)).T) if len(ijk) == 0: self.SetMapper(None) return if affine is not None: ijk_trans = np.ascontiguousarray(apply_affine(affine, ijk)) list_dirs = [] for index, center in enumerate(ijk): # center = tuple(center) if affine is None: xyz = center[:, None] else: xyz = ijk_trans[index][:, None] xyz = xyz.T for i in range(peaks_dirs[tuple(center)].shape[-2]): if peaks_values is not None: pv = peaks_values[tuple(center)][i] else: pv = 1.0 if symmetric: dirs = np.vstack( ( -peaks_dirs[tuple(center)][i] * pv + xyz, peaks_dirs[tuple(center)][i] * pv + xyz, ) ) else: dirs = np.vstack((xyz, peaks_dirs[tuple(center)][i] * pv + xyz)) list_dirs.append(dirs) > colors = check_color_ndarray(colors) E UnboundLocalError: cannot access local variable 'colors' where it is not associated with a value fury\actor.py:1503: UnboundLocalError ================================================================== short test summary info =================================================================== FAILED fury/tests/test_actors.py::test_peak_slicer - UnboundLocalError: cannot access local variable 'colors' where it is not associated with a value ===================================================================== 1 failed in 1.40s ======================================================================
I will investigate it when I finish the current PR. If anyone has the clue, please share:)
I don't know why it passes the test now.. so I will close this issue..
If you run
pytest -svv fury/tests/test_actors.py::test_peak_slicer
you will see:I will investigate it when I finish the current PR. If anyone has the clue, please share:)