def export_object_data(self, settings, selected_features, gui=None): """ Initialize progress displays and start the actual export in a new thread using the lazyflow.request framework :param settings: the settings from the GUI export dialog :type settings: dict :param selected_features: the features to export from the GUI dialog :type selected_features: list :param gui: the Progress bar and callbacks for finish/fail/cancel see ExportingGui.show_export_dialog :type gui: dict """ self.save_export_progress_dialog(None) if gui is None or "dialog" not in gui: progress_display = ProgressPrinter("Export Progress", xrange(100, -1, -5), 2) else: progress_display = gui["dialog"] self.save_export_progress_dialog(progress_display) export = partial(self.do_export, settings, selected_features, progress_display) request = Request(export) if gui is not None: if "fail" in gui: request.notify_failed(gui["fail"]) if "ok" in gui: request.notify_finished(gui["ok"]) if "cancel" in gui: request.notify_cancelled(gui["cancel"]) if "unlock" in gui: request.notify_cancelled(gui["unlock"]) request.notify_failed(gui["unlock"]) request.notify_finished(gui["unlock"]) if "lock" in gui: lock = gui["lock"] lock() request.notify_failed(self.export_failed) request.notify_finished(self.export_finished) request.notify_cancelled(self.export_cancelled) request.submit() if gui is not None and "dialog" in gui: progress_display.cancel.connect(request.cancel)
def export_object_data(self, lane_index, show_gui=False, filename_suffix=""): """ Initialize progress displays and start the actual export in a new thread using the lazyflow.request framework :param settings: the settings from the GUI export dialog :type settings: dict :param selected_features: the features to export from the GUI dialog :type selected_features: list :param gui: the Progress bar and callbacks for finish/fail/cancel see ExportingGui.show_export_dialog :type gui: dict """ settings, selected_features = self.get_table_export_settings() self.save_export_progress_dialog(None) if not show_gui: progress_display = ProgressPrinter("Export Progress", xrange(100, -1, -5), 2) gui = None else: from ilastik.widgets.progressDialog import ProgressDialog progress = ProgressDialog( ["Feature Data", "Labeling Rois", "Raw Image", "Exporting"]) progress.set_busy(True) progress.show() gui = { "dialog": progress, "ok": partial(progress.safe_popup, "information", "Information", "Export successful!"), "cancel": partial(progress.safe_popup, "information", "Information", "Export cancelled!"), "fail": partial(progress.safe_popup, "critical", "Critical", "Export failed!"), "unlock": self.unlock_gui, "lock": self.lock_gui } progress_display = gui["dialog"] self.save_export_progress_dialog(progress_display) export = partial(self.do_export, settings, selected_features, progress_display, lane_index, filename_suffix) request = Request(export) if gui is not None: if "fail" in gui: request.notify_failed(gui["fail"]) if "ok" in gui: request.notify_finished(gui["ok"]) if "cancel" in gui: request.notify_cancelled(gui["cancel"]) if "unlock" in gui: request.notify_cancelled(gui["unlock"]) request.notify_failed(gui["unlock"]) request.notify_finished(gui["unlock"]) if "lock" in gui: lock = gui["lock"] lock() request.notify_failed(self.export_failed) request.notify_finished(self.export_finished) request.notify_cancelled(self.export_cancelled) request.submit() if gui is not None and "dialog" in gui: progress_display.cancel.connect(request.cancel) return request
def export_object_data(self, lane_index, show_gui=False, filename_suffix=""): """ Initialize progress displays and start the actual export in a new thread using the lazyflow.request framework Args: lane_index (int): Index of the lane to be exported show_gui (bool, optional): boolean to determine whether or not to show gui filename_suffix (str, optional): If provided, appended to the filename (before the extension) Returns: lazyflow.request.Request: Request object from which the result can be obtained. """ settings, selected_features = self.get_table_export_settings() if not settings: return Request.with_value(None) self.save_export_progress_dialog(None) if not show_gui: progress_display = ProgressPrinter("Export Progress", range(100, -1, -5), 2) gui = None else: from ilastik.widgets.progressDialog import ProgressDialog progress = ProgressDialog( ["Feature Data", "Labeling Rois", "Raw Image", "Exporting"]) progress.set_busy(True) progress.show() gui = { "dialog": progress, "ok": partial(progress.safe_popup, "information", "Information", "Export successful!"), "cancel": partial(progress.safe_popup, "information", "Information", "Export cancelled!"), "fail": partial(progress.safe_popup, "critical", "Critical", "Export failed!"), "unlock": self.unlock_gui, "lock": self.lock_gui, } progress_display = gui["dialog"] self.save_export_progress_dialog(progress_display) export = partial(self.do_export, settings, selected_features, progress_display, lane_index, filename_suffix) request = Request(export) if gui is not None: if "fail" in gui: request.notify_failed(gui["fail"]) if "ok" in gui: request.notify_finished(gui["ok"]) if "cancel" in gui: request.notify_cancelled(gui["cancel"]) if "unlock" in gui: request.notify_cancelled(gui["unlock"]) request.notify_failed(gui["unlock"]) request.notify_finished(gui["unlock"]) if "lock" in gui: lock = gui["lock"] lock() request.notify_failed(self.export_failed) request.notify_finished(self.export_finished) request.notify_cancelled(self.export_cancelled) request.submit() if gui is not None and "dialog" in gui: progress_display.cancel.connect(request.cancel) return request