Exemple #1
0
    def show_export_dialog(self):
        """
        Shows the ExportObjectInfoDialog and calls the operators export_object_data method
        """
        # Late imports here, so we don't accidentally import PyQt during headless mode.
        from ilastik.widgets.exportObjectInfoDialog import ExportObjectInfoDialog
        from ilastik.widgets.progressDialog import ProgressDialog
        
        dimensions = self.get_raw_shape()
        feature_names = self.get_feature_names()

        dialog = ExportObjectInfoDialog(dimensions, feature_names)
        if not dialog.exec_():
            return

        settings = dialog.settings()
        selected_features = dialog.checked_features()

        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!")
        }
        self.topLevelOperatorView.export_object_data(settings, selected_features, gui)
Exemple #2
0
    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 show_export_dialog(self):
        """
        Shows the ExportObjectInfoDialog and calls the operators export_object_data method
        """
        # Late imports here, so we don't accidentally import PyQt during headless mode.
        from ilastik.widgets.exportObjectInfoDialog import ExportObjectInfoDialog
        from ilastik.widgets.progressDialog import ProgressDialog
        
        dimensions = self.get_raw_shape()
        feature_names = self.get_feature_names()

        dialog = ExportObjectInfoDialog(dimensions, feature_names, title=self.get_export_dialog_title())
        if not dialog.exec_():
            return

        settings = dialog.settings()
        selected_features = dialog.checked_features()

        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
        }
        self.get_exporting_operator().export_object_data(settings, selected_features, gui)
    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
Exemple #6
0
    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()

        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