def unveil_image(self, params): try: check.layer(self.imagery_layer) check.layer(self.index_layer) check.sizes(self.imagery_layer, self.index_layer) except (LayersError, SizesError) as e: log.warning(str(e)) self.view.pushWarningMessage(str(e)) else: image = Imagery(self.imagery_layer.source(), index_path=self.index_layer.source()) result = self.view.saveFileDialog(extension=image.extension, driver=image.driver) if result: image.unveiled(result) log.info(f"Path to unveiled image: {result}") fim = ForcedInvariance(params) fim_task = FImTask(self.imagery_layer.name(), self.index_layer.name()) fim_task.configure(fim, image) fim_task.taskCompleted.connect( partial(self.unveiling_finished, result)) fim_task.taskTerminated.connect(self.unveiling_error) self.view.manager.task_manager.addTask(fim_task) log.info("Task for FIM starts")
def test_algorithm(self): try: check.layer(self.imagery_layer) check.layer(self.index_layer) check.layer(self.standard_layer) check.sizes(self.imagery_layer, self.index_layer, self.standard_layer) check.test_threshold(self.threshold) except (LayersError, SizesError, ParametersError) as e: log.warning(str(e)) self.view.pushWarningMessage(str(e)) else: imagery = Imagery(self.imagery_layer.source(), index_path=self.index_layer.source()) unveiled = self.view.saveFileDialog(extension=imagery.extension, driver=imagery.driver) if unveiled: imagery.unveiled(unveiled) standard = Raster(self.standard_layer.source()) fim = ForcedInvariance(self.view.manager.parameters) comparator = Comparator(self.threshold) test_task = TestTask(self.imagery_layer.name(), self.standard_layer.name()) test_task.presenter(self) test_task.configure(comparator, fim, imagery, standard, unveiled) self.view.manager.task_manager.addTask(test_task) log.info("Task for evaluating starts")
def get_statistics(self, band, imagery, index, params): try: check.layer(imagery) check.layer(index) check.sizes(imagery, index) except (LayersError, SizesError) as e: log.warning(str(e)) self.view.pushWarningMessage(str(e)) else: image = Imagery(imagery.source(), index_path=index.source()) fim = ForcedInvariancePlot(params) plot_task = PlotTask(imagery.name(), f"Band {band}", index.name()) plot_task.presenter(self) plot_task.configure(fim, band, image) self.view.manager.task_manager.addTask(plot_task) log.info("Task for displaying starts")
def displaying_finished(self, band, frame): self.view.addTab(frame, f"Band {band}") message = "Displaying completed" log.info(message) self.view.pushInfoMessage(message)
def testing_finished(self, result): self.view.showTestResult(result) message = "Testing completed" log.info(message) self.view.pushSuccessMessage(message)