Skip to content
Snippets Groups Projects
Commit a82b52a8 authored by polarbean's avatar polarbean
Browse files

add damage marker checkbox to pnt gui

parent 37bdee41
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment