remove picked locs applied to all channels at once
@@ -6839,17 +6839,7 @@ class View(QtWidgets.QLabel):
else:
return None
- def save_channel_pickprops(self, title="Choose a channel"):
- """
- Opens an input dialog to ask which channel to use in saving
- pick properties.
- There is an option to save all channels.
-
- Returns
- None if no locs found or channel picked, int otherwise
- Index of the chosen channel
- """
-
+ def remove_locs_channel(self, title="Choose a channel"):
n_channels = len(self.locs_paths)
if n_channels == 0:
return None
@@ -6857,10 +6847,10 @@ class View(QtWidgets.QLabel):
return 0
elif len(self.locs_paths) > 1:
pathlist = list(self.locs_paths)
- pathlist.append("Save all at once")
+ pathlist.append("Apply to all at once")
index, ok = QtWidgets.QInputDialog.getItem(
self,
- "Save pick properties",
+ "Save localizations",
"Channel:",
pathlist,
editable=False,
@@ -6870,6 +6860,37 @@ class View(QtWidgets.QLabel):
else:
return None
+ # def save_channel_pickprops(self, title="Choose a channel"):
+ # """
+ # Opens an input dialog to ask which channel to use in saving
+ # pick properties.
+ # There is an option to save all channels.
+
+ # Returns
+ # None if no locs found or channel picked, int otherwise
+ # Index of the chosen channel
+ # """
+
+ # n_channels = len(self.locs_paths)
+ # if n_channels == 0:
+ # return None
+ # elif n_channels == 1:
+ # return 0
+ # elif len(self.locs_paths) > 1:
+ # pathlist = list(self.locs_paths)
+ # pathlist.append("Save all at once")
+ # index, ok = QtWidgets.QInputDialog.getItem(
+ # self,
+ # "Save pick properties",
+ # "Channel:",
+ # pathlist,
+ # editable=False,
+ # )
+ # if ok:
+ # return pathlist.index(index)
+ # else:
+ # return None
+
def get_channel3d(self, title="Choose a channel"):
"""
Similar to View.get_channel, used in selecting 3D picks.
@@ -8447,8 +8468,14 @@ class View(QtWidgets.QLabel):
localizations were picked.
"""
- channel = self.get_channel("Remove picked localizations")
- if channel is not None:
+ channel = self.remove_locs_channel("Remove picked localizations")
+ if channel is len(self.locs_paths): # apply to all channels
+ for channel in range(len(self.locs)):
+ self._remove_picked_locs(channel)
+ elif channel is not None: # apply to a single channel
+ self._remove_picked_locs(channel)
+
+ def _remove_picked_locs(self, channel):
index = np.arange(len(self.all_locs[channel]), dtype=np.int32)
self.all_locs[channel] = lib.append_to_rec(
self.all_locs[channel], index, "index"
@@ -11435,7 +11462,7 @@ class Window(QtWidgets.QMainWindow):
Saves pick properties in a given channel (or all channels).
"""
- channel = self.view.save_channel_pickprops("Save localizations")
+ channel = self.view.save_channel_multi("Save localizations")
if channel is not None:
self.convert_z()
if channel is len(self.view.locs_paths):
