diff --git a/gui/PyNutilGUI.py b/gui/PyNutilGUI.py index c362cdd87809c78782c9bb6a230d8ce8af190271..d63dea5e913e6dc0fa03c43f37e2afb2d749f1f6 100644 --- a/gui/PyNutilGUI.py +++ b/gui/PyNutilGUI.py @@ -29,6 +29,7 @@ from PyQt6.QtWidgets import ( QGridLayout, QGroupBox, QProgressDialog, + QCheckBox, ) from PyQt6.QtGui import QAction, QColor, QIcon, QDesktopServices from PyQt6.QtCore import ( @@ -200,7 +201,7 @@ class AnalysisWorker(QThread): print("Analysis cancelled") return - pnt.get_coordinates(object_cutoff=0) + pnt.get_coordinates(object_cutoff=0, apply_damage_mask=self.arguments["apply_damage_mask"]) # Check if cancelled before continuing if self.cancelled: @@ -299,6 +300,7 @@ class PyNutilGUI(QMainWindow): "label_path": None, # Added for custom atlases "atlas_path": None, # Added for custom atlases "custom_region_path": None, # Added for custom region file (optional) + "apply_damage_mask": False, # <-- ADDED default field } self.recent_files_path = os.path.join( os.path.expanduser("~"), ".pynutil_recent_files.json" @@ -470,6 +472,16 @@ class PyNutilGUI(QMainWindow): ) left_layout.addLayout(output_layout) + damage_markers_layout = QHBoxLayout() + damage_markers_label = QLabel("Include Damage Quantification:") + self.include_damage_markers_checkbox = QCheckBox() + self.include_damage_markers_checkbox.setChecked(False) + self.include_damage_markers_checkbox.stateChanged.connect(self.update_damage_markers_flag) + + damage_markers_layout.addWidget(damage_markers_label) + damage_markers_layout.addWidget(self.include_damage_markers_checkbox) + left_layout.addLayout(damage_markers_layout) + # Run and cancel buttons left_layout.addWidget(QLabel("Start analysis:")) run_buttons_layout, self.run_button, self.cancel_button = ( @@ -520,6 +532,7 @@ For more information about the QUINT workflow: <a href="https://quint-workflow.r def set_registration_json(self, index): if index >= 0: + # Retrieve the full path from userData value = ( self.registration_json_dropdown.itemData(index) or self.registration_json_dropdown.currentText() @@ -778,6 +791,11 @@ For more information about the QUINT workflow: <a href="https://quint-workflow.r if index >= 0: self.atlas_combo.setCurrentIndex(index) + if "include_damage_markers" in settings: + dmg_markers = bool(settings["include_damage_markers"]) + self.arguments["apply_damage_mask"] = dmg_markers + self.include_damage_markers_checkbox.setChecked(dmg_markers) + self.output_box.setHtml(f"Settings loaded from: {file_path}") except Exception as e: @@ -1063,6 +1081,9 @@ For more information about the QUINT workflow: <a href="https://quint-workflow.r self.populate_atlas_dropdown() self.append_text_to_output(f"Custom atlas '{atlas_name}' added successfully.") + def update_damage_markers_flag(self, state): + self.arguments["apply_damage_mask"] = bool(state) + if __name__ == "__main__": app = QApplication(sys.argv) diff --git a/gui/ui_components.py b/gui/ui_components.py index b31743f8367f12a3d598ef1fb4946458640d73fa..1d3a77608aa0cc4066007cee62eea9282e9a7d6e 100644 --- a/gui/ui_components.py +++ b/gui/ui_components.py @@ -232,9 +232,8 @@ def populate_dropdown(dropdown, recents, clear_first=True): else: # Handle string items display_text = get_path_display_name(item) - dropdown.addItem(display_text) - # Store the full path as user data in the item - # dropdown.setItemData(dropdown.count() - 1, item) + # Store the full path as user data + dropdown.addItem(display_text, userData=item) dropdown.setEditable(False) # dropdown.setCurrentIndex(-1)