def __init__(self, shell, headless, workflow_cmdline_args, project_creation_workflow, *args, **kwargs): self.stored_classifier = None # Create a graph to be shared by all operators graph = Graph() super(MulticutWorkflow, self).__init__(shell, headless, workflow_cmdline_args, project_creation_workflow, graph=graph, *args, **kwargs) self._applets = [] # -- DataSelection applet # self.dataSelectionApplet = DataSelectionApplet( self, "Input Data", "Input Data", forceAxisOrder=['zyxc', 'yxc']) # Dataset inputs opDataSelection = self.dataSelectionApplet.topLevelOperator opDataSelection.DatasetRoles.setValue(self.ROLE_NAMES) # -- Watershed applet # self.wsdtApplet = WsdtApplet(self, "DT Watershed", "DT Watershed") # -- Edge training applet # self.edgeTrainingApplet = EdgeTrainingApplet(self, "Edge Training", "Edge Training") opEdgeTraining = self.edgeTrainingApplet.topLevelOperator DEFAULT_FEATURES = { self.ROLE_NAMES[self.DATA_ROLE_RAW]: ['standard_edge_mean'] } opEdgeTraining.FeatureNames.setValue(DEFAULT_FEATURES) # -- Multicut applet # self.multicutApplet = MulticutApplet(self, "Multicut Segmentation", "Multicut Segmentation") # -- DataExport applet # self.dataExportApplet = DataExportApplet(self, "Data Export") self.dataExportApplet.prepare_for_entire_export = self.prepare_for_entire_export self.dataExportApplet.post_process_entire_export = self.post_process_entire_export # Configure global DataExport settings opDataExport = self.dataExportApplet.topLevelOperator opDataExport.WorkingDirectory.connect(opDataSelection.WorkingDirectory) opDataExport.SelectionNames.setValue(self.EXPORT_NAMES) # -- BatchProcessing applet # self.batchProcessingApplet = BatchProcessingApplet( self, "Batch Processing", self.dataSelectionApplet, self.dataExportApplet) # -- Expose applets to shell self._applets.append(self.dataSelectionApplet) self._applets.append(self.wsdtApplet) self._applets.append(self.edgeTrainingApplet) self._applets.append(self.multicutApplet) self._applets.append(self.dataExportApplet) self._applets.append(self.batchProcessingApplet) # -- Parse command-line arguments # (Command-line args are applied in onProjectLoaded(), below.) if workflow_cmdline_args: self._data_export_args, unused_args = self.dataExportApplet.parse_known_cmdline_args( workflow_cmdline_args) self._batch_input_args, unused_args = self.batchProcessingApplet.parse_known_cmdline_args( unused_args) else: unused_args = None self._batch_input_args = None self._data_export_args = None if unused_args: logger.warning("Unused command-line args: {}".format(unused_args)) if not self._headless: shell.currentAppletChanged.connect(self.handle_applet_changed)
def __init__(self, shell, headless, workflow_cmdline_args, project_creation_workflow, *args, **kwargs): self.stored_classifier = None # Create a graph to be shared by all operators graph = Graph() super(EdgeTrainingWithMulticutWorkflow, self).__init__(shell, headless, workflow_cmdline_args, project_creation_workflow, graph=graph, *args, **kwargs) self._applets = [] # -- DataSelection applet # self.dataSelectionApplet = DataSelectionApplet(self, "Input Data", "Input Data") # Dataset inputs opDataSelection = self.dataSelectionApplet.topLevelOperator opDataSelection.DatasetRoles.setValue(self.ROLE_NAMES) # -- Watershed applet # self.wsdtApplet = WsdtApplet(self, "DT Watershed", "DT Watershed") # -- Edge training AND Multicut applet # self.edgeTrainingWithMulticutApplet = EdgeTrainingWithMulticutApplet( self, "Training and Multicut", "Training and Multicut") opEdgeTrainingWithMulticut = self.edgeTrainingWithMulticutApplet.topLevelOperator DEFAULT_FEATURES = { self.ROLE_NAMES[self.DATA_ROLE_RAW]: ['standard_edge_mean'] } opEdgeTrainingWithMulticut.FeatureNames.setValue(DEFAULT_FEATURES) # -- DataExport applet # self.dataExportApplet = DataExportApplet(self, "Data Export") self.dataExportApplet.prepare_for_entire_export = self.prepare_for_entire_export self.dataExportApplet.post_process_entire_export = self.post_process_entire_export # Configure global DataExport settings opDataExport = self.dataExportApplet.topLevelOperator opDataExport.WorkingDirectory.connect(opDataSelection.WorkingDirectory) opDataExport.SelectionNames.setValue(self.EXPORT_NAMES) # -- BatchProcessing applet # self.batchProcessingApplet = BatchProcessingApplet( self, "Batch Processing", self.dataSelectionApplet, self.dataExportApplet) # -- Expose applets to shell self._applets.append(self.dataSelectionApplet) self._applets.append(self.wsdtApplet) self._applets.append(self.edgeTrainingWithMulticutApplet) self._applets.append(self.dataExportApplet) self._applets.append(self.batchProcessingApplet) # -- Parse command-line arguments # (Command-line args are applied in onProjectLoaded(), below.) # Parse workflow-specific command-line args parser = argparse.ArgumentParser() parser.add_argument( '--retrain', help= "Re-train the classifier based on labels stored in the project file, and re-save.", action="store_true") self.parsed_workflow_args, unused_args = parser.parse_known_args( workflow_cmdline_args) if unused_args: # Parse batch export/input args. self._data_export_args, unused_args = self.dataExportApplet.parse_known_cmdline_args( unused_args) self._batch_input_args, unused_args = self.batchProcessingApplet.parse_known_cmdline_args( unused_args) else: unused_args = None self._batch_input_args = None self._data_export_args = None if unused_args: logger.warn("Unused command-line args: {}".format(unused_args)) if not self._headless: shell.currentAppletChanged.connect(self.handle_applet_changed)
def __init__(self, shell, headless, workflow_cmdline_args, project_creation_workflow, *args, **kwargs): # Create a graph to be shared by all operators graph = Graph() super(WsdtWorkflow, self).__init__(shell, headless, workflow_cmdline_args, project_creation_workflow, graph=graph, *args, **kwargs) self._applets = [] # -- DataSelection applet # self.dataSelectionApplet = DataSelectionApplet(self, "Input Data", "Input Data") # Dataset inputs opDataSelection = self.dataSelectionApplet.topLevelOperator opDataSelection.DatasetRoles.setValue(self.ROLE_NAMES) # -- Wsdt applet # self.wsdtApplet = WsdtApplet(self, "Watershed", "Wsdt Watershed") # -- DataExport applet # self.dataExportApplet = DataExportApplet(self, "Data Export") # Configure global DataExport settings opDataExport = self.dataExportApplet.topLevelOperator opDataExport.WorkingDirectory.connect(opDataSelection.WorkingDirectory) opDataExport.SelectionNames.setValue(self.EXPORT_NAMES) # -- BatchProcessing applet # self.batchProcessingApplet = BatchProcessingApplet( self, "Batch Processing", self.dataSelectionApplet, self.dataExportApplet) # -- Expose applets to shell self._applets.append(self.dataSelectionApplet) self._applets.append(self.wsdtApplet) self._applets.append(self.dataExportApplet) self._applets.append(self.batchProcessingApplet) # -- Parse command-line arguments # (Command-line args are applied in onProjectLoaded(), below.) if workflow_cmdline_args: self._data_export_args, unused_args = self.dataExportApplet.parse_known_cmdline_args( workflow_cmdline_args) self._batch_input_args, unused_args = self.dataSelectionApplet.parse_known_cmdline_args( unused_args, role_names) else: unused_args = None self._batch_input_args = None self._data_export_args = None if unused_args: logger.warning("Unused command-line args: {}".format(unused_args))