From e4be06c62e2bd73cf797d53dfc1867a1b372fce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20H=2E=20Benedetti?= Date: Wed, 20 Nov 2024 09:39:52 +0100 Subject: [PATCH] Starting GUI linking --- src/microglia_analyzer/_widget.py | 12 ++---------- src/microglia_analyzer/models.json | 10 ++++++++-- src/microglia_analyzer/qt_workers.py | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 src/microglia_analyzer/qt_workers.py diff --git a/src/microglia_analyzer/_widget.py b/src/microglia_analyzer/_widget.py index a05473b..9eb8686 100644 --- a/src/microglia_analyzer/_widget.py +++ b/src/microglia_analyzer/_widget.py @@ -117,11 +117,6 @@ def segment_microglia_panel(self): self.segment_microglia_group = QGroupBox("Segmentation") layout = QVBoxLayout() - # Dropdown menu to choose a model - self.model_selector = QComboBox() - self.model_selector.addItem("---") - layout.addWidget(self.model_selector) - # Minimal area of a microglia h_layout = QHBoxLayout() self.minimal_area_label = QLabel("Min area (µm²):") @@ -216,9 +211,6 @@ def select_image(self): return self.open_image(full_path) - def apply_calibration(self): - pass - def proba_threshold_update(self): self.proba_value_label.setText(f"{self.probability_threshold_slider.value()}%") @@ -285,7 +277,7 @@ def open_image(self, image_path): self.viewer.layers[_IMAGE_LAYER_NAME].data = data else: self.viewer.add_image(data, name=_IMAGE_LAYER_NAME, colormap='green') - # self.mam.load_image(image_path) + self.mam.set_input_image(data) def convert_to_optimal_unit(self, size, unit): @@ -318,4 +310,4 @@ def set_calibration(self, size, unit): layer.scale = (size, size) self.pixel_size_label.setText(f"Pixel size: {size:.2f} {unit}") self.viewer.scale_bar.visible = True - # self.mam.set_calibration(size, unit) \ No newline at end of file + self.mam.set_calibration(size, unit) \ No newline at end of file diff --git a/src/microglia_analyzer/models.json b/src/microglia_analyzer/models.json index 1673e5a..713022c 100644 --- a/src/microglia_analyzer/models.json +++ b/src/microglia_analyzer/models.json @@ -1,4 +1,10 @@ { - "µnet" : "https://dev.mri.cnrs.fr/attachments/download/3574/%C2%B5net.zip", - "µyolo": "https://dev.mri.cnrs.fr/attachments/download/3575/%C2%B5yolo.zip" + "µnet" : { + "url": "https://dev.mri.cnrs.fr/attachments/download/3574/%C2%B5net.zip", + "version": 208 + }, + "µyolo": { + "url": "https://dev.mri.cnrs.fr/attachments/download/3575/%C2%B5yolo.zip", + "version": 51 + } } \ No newline at end of file diff --git a/src/microglia_analyzer/qt_workers.py b/src/microglia_analyzer/qt_workers.py new file mode 100644 index 0000000..5f32321 --- /dev/null +++ b/src/microglia_analyzer/qt_workers.py @@ -0,0 +1,20 @@ +from qtpy.QtCore import QObject +from PyQt5.QtCore import pyqtSignal + +class QtSegmentProtoplasts(QObject): + + finished = pyqtSignal() + update = pyqtSignal(str, int, int) + + def _probe_model(self, model): + pass + + def __init__(self, pbr, mga): + super().__init__() + self.pbr = pbr + self.mga = mga + + def run(self): + self.mga.find_traps() + self.mga.process_patches() + self.finished.emit() \ No newline at end of file