|
8 | 8 | import finn |
9 | 9 | from finn.utils import DirectLabelColormap |
10 | 10 | from finn.utils.action_manager import action_manager |
11 | | -from finn.utils.notifications import show_info, show_warning |
| 11 | +from finn.utils.notifications import show_info |
12 | 12 |
|
13 | 13 | if TYPE_CHECKING: |
14 | 14 | from finn.track_data_views.views_coordinator.tracks_viewer import TracksViewer |
@@ -229,53 +229,8 @@ def _on_paint(self, event): |
229 | 229 | 0 |
230 | 230 | ] # also pass on the current time point to know which node to select later |
231 | 231 | new_value, updated_pixels = self._parse_paint_event(event.value) |
232 | | - # updated_pixels is a list of tuples. Each tuple is (indices, old_value) |
233 | | - to_delete = [] # (node_ids, pixels) |
234 | | - to_update_smaller = [] # (node_id, pixels) |
235 | | - to_update_bigger = [] # (node_id, pixels) |
236 | | - to_add = [] # (node_id, track_id, pixels) |
237 | | - for pixels, old_value in updated_pixels: |
238 | | - ndim = len(pixels) |
239 | | - if old_value == 0: |
240 | | - continue |
241 | | - time = pixels[0][0] |
242 | | - removed_node = old_value |
243 | | - assert removed_node is not None, ( |
244 | | - f"Node with label {old_value} in time {time} was not found" |
245 | | - ) |
246 | | - # check if all pixels of old_value are removed |
247 | | - if np.sum(self.data[time] == old_value) == 0: |
248 | | - to_delete.append((removed_node, pixels)) |
249 | | - else: |
250 | | - to_update_smaller.append((removed_node, pixels)) |
251 | | - if new_value != 0: |
252 | | - all_pixels = tuple( |
253 | | - np.concatenate([pixels[dim] for pixels, _ in updated_pixels]) |
254 | | - for dim in range(ndim) |
255 | | - ) |
256 | | - for _ in np.unique(all_pixels[0]): |
257 | | - existing_node = self.tracks_viewer.tracks.graph.has_node(new_value) |
258 | | - if existing_node: |
259 | | - to_update_bigger.append((new_value, all_pixels)) |
260 | | - else: |
261 | | - to_add.append((new_value, self.selected_track, all_pixels)) |
262 | | - |
263 | | - if len(to_delete) > 0 and len(to_add) > 0: |
264 | | - show_warning( |
265 | | - "This paint or fill operation completely replaced one label with a " |
266 | | - "new label. This is currently not supported." |
267 | | - " If you want to update the track id of the node, please edit the " |
268 | | - "edges directly instead." |
269 | | - ) |
270 | | - self._revert_paint(event) |
271 | | - self.refresh() |
272 | | - return |
273 | 232 | self.tracks_viewer.tracks_controller.update_segmentations( |
274 | | - to_delete, |
275 | | - to_update_smaller, |
276 | | - to_update_bigger, |
277 | | - to_add, |
278 | | - current_timepoint, |
| 233 | + new_value, updated_pixels, current_timepoint, self.selected_track |
279 | 234 | ) |
280 | 235 |
|
281 | 236 | def _refresh(self): |
|
0 commit comments