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() op = self.get_exporting_operator() settings, selected_features = op.get_table_export_settings() filename = None if settings is not None and 'file path' in settings: filename = settings['file path'] dialog = ExportObjectInfoDialog(dimensions, feature_names, selected_features=selected_features, title=self.get_export_dialog_title(), filename=filename) if not dialog.exec_(): return (None, None) settings = dialog.settings() selected_features = list( dialog.checked_features() ) # returns a generator, but that's inconvenient because it can't be serialized. return settings, selected_features
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)
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() op = self.get_exporting_operator() settings, selected_features = op.get_table_export_settings() dialog = ExportObjectInfoDialog(dimensions, feature_names, selected_features=selected_features, title=self.get_export_dialog_title(), filename=self._default_export_filename) if not dialog.exec_(): return (None, None) settings = dialog.settings() selected_features = list(dialog.checked_features()) # returns a generator, but that's inconvenient because it can't be serialized. return settings, selected_features
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 configure_export_dialog(self, gui, initial_settings): dimensions = gui.get_raw_shape() feature_names = gui.get_feature_names() op = gui.get_exporting_operator() settings, selected_features = op.get_table_export_settings() dialog = ExportObjectInfoDialog( dimensions, feature_names, selected_features=selected_features, title=gui.get_export_dialog_title(), initial_settings=settings, ) dialog.show() QApplication.processEvents() # do the interaction with the dialog file_type = initial_settings["file type"] index = FILE_TYPES.index(file_type) dialog.ui.fileFormat.setCurrentIndex(index) file_path = initial_settings["file path"] dialog.ui.exportPath.setText(file_path) if file_type == "h5": # TODO: what about normalize? margin = initial_settings["margin"] dialog.ui.addMargin.setValue(margin) include_raw = initial_settings["include raw"] dialog.ui.includeRaw.setChecked(include_raw) compression_settings = initial_settings["compression"] compression_type = compression_settings["compression"] index = dialog.ui.compressionType.findText(compression_type) dialog.ui.compressionType.setCurrentIndex(index) shuffle = compression_settings["shuffle"] dialog.ui.enableShuffling.setChecked(shuffle) compression_rate = compression_settings["compression_opts"] dialog.ui.gzipRate.setValue(compression_rate) dialog.ui.selectAllFeatures.click() QApplication.processEvents() dialog.close() QApplication.processEvents() settings = dialog.settings() selected_features = list(dialog.checked_features()) return settings, selected_features
def configure_export_dialog(self, gui, initial_settings): dimensions = gui.get_raw_shape() feature_names = gui.get_feature_names() op = gui.get_exporting_operator() settings, selected_features = op.get_table_export_settings() dialog = ExportObjectInfoDialog( dimensions, feature_names, selected_features=selected_features, title=gui.get_export_dialog_title(), initial_settings=settings) dialog.show() QApplication.processEvents() # do the interaction with the dialog file_type = initial_settings['file type'] index = FILE_TYPES.index(file_type) dialog.ui.fileFormat.setCurrentIndex(index) file_path = initial_settings['file path'] dialog.ui.exportPath.setText(file_path) if file_type == 'h5': # TODO: what about normalize? margin = initial_settings['margin'] dialog.ui.addMargin.setValue(margin) include_raw = initial_settings['include raw'] dialog.ui.includeRaw.setChecked(include_raw) compression_settings = initial_settings['compression'] compression_type = compression_settings['compression'] index = dialog.ui.compressionType.findText(compression_type) dialog.ui.compressionType.setCurrentIndex(index) shuffle = compression_settings['shuffle'] dialog.ui.enableShuffling.setChecked(shuffle) compression_rate = compression_settings['compression_opts'] dialog.ui.gzipRate.setValue(compression_rate) dialog.ui.selectAllFeatures.click() QApplication.processEvents() dialog.close() QApplication.processEvents() settings = dialog.settings() selected_features = list(dialog.checked_features()) return settings, selected_features