--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) Cell In[8], line 6 1 # scs_path = "./datasets/test_data_STAV-A549/tutorial_three_img_single_cells.json" 2 # scs_path = "./datasets/test_scs_EBSS_starvation/single_cells.json" 3 # scs_path = "./datasets/test_scs_EBSS_starvation/XY16/tmp_corrected_scs.json" 4 # scs_path = "./datasets/test_scs_EBSS_starvation/XY1/single_cells.json" 5 scs_path = "./datasets/test_scs_EBSS_starvation/XY1/corrected_scs.json" ----> 6 single_cells = SingleCellStatic.load_single_cells_json(path=scs_path) File ~\Documents\Single-cell\LiveCell\LiveCellTracker-dev\livecell_tracker\core\single_cell.py:418, in SingleCellStatic.load_single_cells_json(path) 403 @staticmethod 404 # TODO: check forward declaration change: https://peps.python.org/pep-0484/#forward-references 405 def load_single_cells_json(path: str) -> List["SingleCellStatic"]: 406 """load a json file containing a list of single cells 407 408 Parameters (...) 416 _description_ 417 """ --> 418 with open(path, "r") as f: 419 sc_json_dict_list = json.load(f) 421 # contour = [] here to suppress warning FileNotFoundError: [Errno 2] No such file or directory: './datasets/test_scs_EBSS_starvation/XY1/corrected_scs.json' '0.4.18' --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[7], line 2 1 # sct_operator = create_scs_edit_viewer(single_cells, img_dataset = dic_dataset) ----> 2 viewer = create_scs_edit_viewer_by_interval(single_cells, img_dataset=dic_dataset, span_interval = 10, viewer = None) 3 # for i in range(0, len(single_cells), span_interval): 4 # sct_operator = create_scs_edit_viewer(single_cells, img_dataset = dic_dataset, viewer = viewer, time_span=(i, i+span_interval)) 5 # # set slice to the first frame of the span 6 # viewer.dims.set_point(0, i) 7 # # viewer.show(block=True) 8 # input("Press Enter to continue...") File ~\Documents\Single-cell\LiveCell\LiveCellTracker-dev\livecell_tracker\core\sct_operator.py:823, in create_scs_edit_viewer_by_interval(single_cells, img_dataset, span_interval, viewer, clear_prev_batch) 820 def create_scs_edit_viewer_by_interval(single_cells, img_dataset, span_interval=10, viewer=None, clear_prev_batch=True): 821 # TODO: a potential bug is that the slice index is not the same concept as the time. A solution is to add time frame to shape properties 822 # Here for now we assume indices represents timeframes --> 823 sct_operator = create_scs_edit_viewer( 824 single_cells, img_dataset=img_dataset, viewer=viewer, time_span=(0, span_interval) 825 ) 826 viewer = sct_operator.viewer 827 tmp_points_data_layer_key = "_lcx_sct_cur_idx" File ~\Documents\Single-cell\LiveCell\LiveCellTracker-dev\livecell_tracker\core\sct_operator.py:807, in create_scs_edit_viewer(single_cells, img_dataset, viewer, time_span) 804 temp_sc_trajs_for_correct = create_sctc_from_scs(single_cells) 806 # Create an SctOperator instance for editing the SingleCellStatic objects --> 807 sct_operator = create_scts_operator_viewer(temp_sc_trajs_for_correct, img_dataset, viewer, time_span) 808 return sct_operator File ~\Documents\Single-cell\LiveCell\LiveCellTracker-dev\livecell_tracker\core\sct_operator.py:776, in create_scts_operator_viewer(sctc, img_dataset, viewer, time_span) 773 else: 774 viewer = napari.Viewer() --> 776 shape_layer = NapariVisualizer.gen_trajectories_shapes(sctc, viewer, contour_sample_num=20) 777 shape_layer.mode = "select" 778 sct_operator = SctOperator(sctc, shape_layer, viewer, img_dataset=img_dataset, time_span=time_span) File ~\Documents\Single-cell\LiveCell\LiveCellTracker-dev\livecell_tracker\core\napari_visualizer.py:63, in NapariVisualizer.gen_trajectories_shapes(trajectories, viewer, bbox, contour_sample_num, viewer_kwargs, text_parameters) 58 all_status.extend([""] * len(traj_shapes)) 59 properties = {"track_id": track_ids, "sc": all_scs, "status": all_status} 60 shape_layer = viewer.add_shapes( 61 all_shapes, 62 properties=properties, ---> 63 face_color=NapariVisualizer.map_colors(properties["track_id"]), 64 face_colormap="viridis", 65 shape_type="polygon", 66 text=text_parameters, 67 name="trajectories", 68 **viewer_kwargs 69 ) 70 return shape_layer File ~\Documents\Single-cell\LiveCell\LiveCellTracker-dev\livecell_tracker\core\napari_visualizer.py:28, in NapariVisualizer.map_colors(values, cmap) 26 norm = matplotlib.colors.Normalize(vmin=minima, vmax=maxima, clip=True) 27 mapper = cm.ScalarMappable(norm=norm, cmap=cmap) ---> 28 res_colors = [mapper.to_rgba(v) for v in values] 29 return res_colors File ~\Documents\Single-cell\LiveCell\LiveCellTracker-dev\livecell_tracker\core\napari_visualizer.py:28, in (.0) 26 norm = matplotlib.colors.Normalize(vmin=minima, vmax=maxima, clip=True) 27 mapper = cm.ScalarMappable(norm=norm, cmap=cmap) ---> 28 res_colors = [mapper.to_rgba(v) for v in values] 29 return res_colors File c:\Users\13290\AppData\Local\Programs\Python\Python39\lib\site-packages\matplotlib\cm.py:493, in ScalarMappable.to_rgba(self, x, alpha, bytes, norm) 491 x = ma.asarray(x) 492 if norm: --> 493 x = self.norm(x) 494 rgba = self.cmap(x, alpha=alpha, bytes=bytes) 495 return rgba File c:\Users\13290\AppData\Local\Programs\Python\Python39\lib\site-packages\matplotlib\colors.py:1354, in Normalize.__call__(self, value, clip) 1352 # ma division is very slow; we can take a shortcut 1353 resdat = result.data -> 1354 resdat -= vmin 1355 resdat /= (vmax - vmin) 1356 result = np.ma.array(resdat, mask=result.mask, copy=False) File c:\Users\13290\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\ma\core.py:4218, in MaskedArray.__sub__(self, other) 4216 if self._delegate_binop(other): 4217 return NotImplemented -> 4218 return subtract(self, other) File c:\Users\13290\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\ma\core.py:1034, in _MaskedBinaryOperation.__call__(self, a, b, *args, **kwargs) 1031 m = umath.logical_or(ma, mb) 1033 # Case 1. : scalar -> 1034 if not result.ndim: 1035 if m: 1036 return masked AttributeError: 'float' object has no attribute 'ndim' |-----> Downloading data to datasets\test_data_STAV-A549.zip |-----> Data already exists at datasets\test_data_STAV-A549.zip |-----> Extracting data to datasets 3 png img file paths loaded; 3 tif img file paths loaded; 100%|██████████| 3/3 [00:07<00:00, 2.59s/it] --------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[15], line 1 ----> 1 sct_operator = _get_viewer_sct_operator(viewer) NameError: name 'viewer' is not defined