Skip to content

Commit

Permalink
update sct_operator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dummyindex committed Nov 29, 2023
1 parent 1b6a5c6 commit 67e9e9f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions livecellx/core/sct_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ def store_shape_layer_info(self, update_slice=None):
if key == "sc":
continue
self.original_properties[key] = copy.deepcopy(self.shape_layer.properties[key])
# if not hasattr(self, "original_shape_data"):
# self.original_shape_data = copy.deepcopy(self.shape_layer.data.copy())
if not hasattr(self, "original_shape_data"):
self.original_shape_data = copy.deepcopy(self.shape_layer.data.copy())

if update_slice:
# w/o deepcopy, the original_face_colors will be changed when shape_layer.face_color is changed...
Expand All @@ -429,7 +429,7 @@ def store_shape_layer_info(self, update_slice=None):
self.original_properties[key][update_slice] = copy.deepcopy(self.shape_layer.properties.copy())[key][
update_slice
]
# self.original_shape_data[update_slice] = copy.deepcopy(self.shape_layer.data.copy())[update_slice]
self.original_shape_data[update_slice] = copy.deepcopy(self.shape_layer.data.copy())[update_slice]
self.original_properties["sc"][update_slice] = self.original_scs[update_slice]
else:
self.original_face_colors = copy.deepcopy(list(self.shape_layer.face_color))
Expand All @@ -439,7 +439,7 @@ def store_shape_layer_info(self, update_slice=None):
if key == "sc":
continue
self.original_properties[key] = copy.deepcopy(self.shape_layer.properties[key])
# self.original_shape_data = copy.deepcopy(self.shape_layer.data.copy())
self.original_shape_data = copy.deepcopy(self.shape_layer.data.copy())
self.original_properties["sc"] = self.original_scs # avoid deepcopying the single cells

end_time = datetime.datetime.now()
Expand All @@ -460,11 +460,10 @@ def disconnect_sct(self):
print("disconnecting shape...")
old_traj = self.traj_collection.pop_trajectory(sct.track_id)


max_tid = self.traj_collection.get_max_tid()
# # Py2: prevent from overflow, no need to check in py 3
# assert max_tid < 2 ** 31 - 1, "max_tid is too large, please re-assign track ids."

tid_1, tid_2 = max_tid + 1, max_tid + 2
new_sct1, new_sct2 = old_traj.split(sc.timeframe, tid_1=tid_1, tid_2=tid_2)
self.traj_collection.add_trajectory(new_sct1)
Expand Down

0 comments on commit 67e9e9f

Please sign in to comment.