Skip to content

Commit

Permalink
Fixes #33: add option to display timer during segmentation; fixes #49:…
Browse files Browse the repository at this point in the history
… no crash after volume folder selection cancel
  • Loading branch information
AcastaPaloma committed Aug 11, 2024
1 parent 2f68561 commit 37fd930
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
29 changes: 26 additions & 3 deletions SlicerCART/src/SlicerCART.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,17 @@ def __init__(self, segmenter, conf_folder_path = None, edit_conf = False, parent
mouse_shortcuts_hbox.addWidget(self.mouse_shortcuts_checkbox)

layout.addLayout(mouse_shortcuts_hbox)

display_timer_hbox = qt.QHBoxLayout()

display_timer_label = qt.QLabel('Display timer during segmentation? ')
display_timer_label.setStyleSheet("font-weight: bold")
display_timer_hbox.addWidget(display_timer_label)

self.display_timer_checkbox = qt.QCheckBox()
display_timer_hbox.addWidget(self.display_timer_checkbox)

layout.addLayout(display_timer_hbox)

self.configure_labels_button = qt.QPushButton('Configure Labels...')
self.configure_labels_button.setStyleSheet("background-color : yellowgreen")
Expand Down Expand Up @@ -596,7 +607,9 @@ def populate_default_values(self):
self.include_semi_automatic_PHE_tool_combobox.setCurrentIndex(0)
else:
self.include_semi_automatic_PHE_tool_combobox.setCurrentIndex(1)


if self.display_timer_selected:
self.display_timer_checkbox.setChecked(True)

if self.modality_selected == 'CT':
self.ct_modality_radio_button.setChecked(True)
Expand Down Expand Up @@ -635,6 +648,7 @@ def set_default_values(self):
self.classification_selected = self.general_config_yaml['is_classification_requested']
self.mouse_shortcuts_selected = self.general_config_yaml['is_mouse_shortcuts_requested']
self.keyboard_shortcuts_selected = self.general_config_yaml['is_keyboard_shortcuts_requested']
self.display_timer_selected = self.general_config_yaml['is_display_timer_requested']

if self.general_config_yaml['is_semi_automatic_phe_tool_requested']:
self.include_semi_auto_PHE_tool_selected_option = 'Yes'
Expand Down Expand Up @@ -782,6 +796,7 @@ def push_apply(self):
self.general_config_yaml['is_mouse_shortcuts_requested'] = self.mouse_shortcuts_checkbox.isChecked()
self.general_config_yaml['is_keyboard_shortcuts_requested'] = self.keyboard_shortcuts_checkbox.isChecked()
self.general_config_yaml['modality'] = self.modality_selected
self.general_config_yaml['is_display_timer_requested'] = self.display_timer_checkbox.isChecked()

if self.include_semi_auto_PHE_tool_selected_option == 'Yes':
self.general_config_yaml['is_semi_automatic_phe_tool_requested'] = True
Expand Down Expand Up @@ -2472,7 +2487,12 @@ def setup_configuration(self):
callback = getattr(self, callback_name)

self.connectShortcut(shortcutKey, button, callback)


if self.general_config_yaml['is_display_timer_requested']:
self.ui.lcdNumber.setStyleSheet("background-color : black")
else:
self.ui.lcdNumber.setVisible(False)

# Display the selected color view at module startup
if self.general_config_yaml['slice_view_color'] == "Yellow":
slicer.app.layoutManager().setLayout(
Expand Down Expand Up @@ -2580,7 +2600,10 @@ def onEditConfiguration(self):

def onSelectVolumesFolderButton(self):
self.CurrentFolder= qt.QFileDialog.getExistingDirectory(None,"Open a folder", self.DefaultDir, qt.QFileDialog.ShowDirsOnly)


if not self.CurrentFolder:
return

file_structure_valid = True
if REQUIRE_VOLUME_DATA_HIERARCHY_BIDS_FORMAT == True:
file_structure_valid = self.validateBIDS(self.CurrentFolder)
Expand Down
3 changes: 2 additions & 1 deletion SlicerCART/src/general_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ impose_bids_format: false
input_filetype: '*.nii.gz'
interpolate_value: 1
is_classification_requested: true
is_display_timer_requested: false
is_keyboard_shortcuts_requested: true
is_mouse_shortcuts_requested: false
is_segmentation_requested: false
is_segmentation_requested: true
is_semi_automatic_phe_tool_requested: true
modality: CT
slice_view_color: Red

0 comments on commit 37fd930

Please sign in to comment.