save all for save_locs
@@ -2700,7 +2700,6 @@ class View(QtGui.QLabel):
self.setPixmap(self.pixmap)
self.window.update_info()
-
def draw_scene_slicer(
self,
viewport,
@@ -2756,6 +2755,28 @@ class View(QtGui.QLabel):
else:
return None
+ def save_channel_multi(self, title="Choose a 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 = QtGui.QInputDialog.getItem(
+ self,
+ "Save localizations",
+ "Channel:",
+ pathlist,
+ editable=False,
+ )
+ if ok:
+ return pathlist.index(index)
+ else:
+ return None
+
+
def save_channel(self, title="Choose a channel"):
n_channels = len(self.locs_paths)
if n_channels == 0:
@@ -6287,8 +6308,32 @@ class Window(QtGui.QMainWindow):
self.view.save_pick_properties(path, channel)
def save_locs(self):
- channel = self.view.get_channel("Save localizations")
+ channel = self.view.save_channel_multi("Save localizations")
if channel is not None:
+ if channel is (len(self.view.locs_paths)):
+ print("Save all at once.")
+ suffix, ok = QtGui.QInputDialog.getText(
+ self,
+ "Input Dialog",
+ "Enter suffix",
+ QtGui.QLineEdit.Normal,
+ "_arender"
+ )
+ if ok:
+ for i in tqdm(range(len(self.view.locs_paths))):
+ channel = i
+ base, ext = os.path.splitext(self.view.locs_paths[channel])
+ out_path = base + suffix +".hdf5"
+
+ info = self.view.infos[channel] + [
+ {
+ "Generated by": "Picasso Render",
+ "Last driftfile": self.view._driftfiles[channel],
+ }
+ ]
+ io.save_locs(out_path, self.view.locs[channel], info)
+
+ else:
base, ext = os.path.splitext(self.view.locs_paths[channel])
out_path = base + "_render.hdf5"
path = QtGui.QFileDialog.getSaveFileName(
