Skip to content

Commit

Permalink
Linked the latest runtime flags - stable segmentation. RADS part to b…
Browse files Browse the repository at this point in the history
…e re-connected. [skip ci]
  • Loading branch information
dbouget committed Mar 24, 2023
1 parent 2a3225a commit 62e0a47
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ def on_diagnosis_selection(self, index):

self.diagnosis_model_parameters.destroy()
json_model = self.find_json_model(selected_model_name=selected_model)
if not json_model:
return

self.diagnosis_model_parameters.create(json_model)

if "briefdescription" in json_model:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,18 @@ def setup_execution_area(self):
tmp_layout = qt.QGridLayout()
self.advanced_use_gpu_label = qt.QLabel('Use GPU')
self.advanced_use_gpu_checkbox = qt.QCheckBox()
self.advanced_use_gpu_checkbox.setEnabled(False)
tmp_layout.addWidget(self.advanced_use_gpu_label, 0, 0)
tmp_layout.addWidget(self.advanced_use_gpu_checkbox, 0, 1)
self.advanced_use_stripped_inputs_label = qt.QLabel('Stripped inputs')
self.advanced_use_stripped_inputs_checkbox = qt.QCheckBox()
tmp_layout.addWidget(self.advanced_use_stripped_inputs_label, 0, 2)
tmp_layout.addWidget(self.advanced_use_stripped_inputs_checkbox, 0, 3)
self.advanced_use_registered_inputs_label = qt.QLabel('Registered inputs')
self.advanced_use_registered_inputs_checkbox = qt.QCheckBox()
tmp_layout.addWidget(self.advanced_use_registered_inputs_label, 0, 4)
tmp_layout.addWidget(self.advanced_use_registered_inputs_checkbox, 0, 5)

self.advanced_predictions_type_label = qt.QLabel('Predictions')
self.advanced_predictions_type_combobox = qt.QComboBox()
self.advanced_predictions_type_combobox.addItems(['Probabilities', 'Binary'])
Expand Down Expand Up @@ -103,6 +113,8 @@ def setup_interactive_results_area(self):

def setup_connections(self):
self.advanced_use_gpu_checkbox.connect("stateChanged(int)", self.on_use_gpu_change)
self.advanced_use_stripped_inputs_checkbox.connect("stateChanged(int)", self.on_use_stripped_inputs_change)
self.advanced_use_registered_inputs_checkbox.connect("stateChanged(int)", self.on_use_registered_inputs_change)
self.advanced_resampling_combobox.connect("currentIndexChanged(QString)", self.on_sampling_strategy_change)
self.advanced_predictions_type_combobox.connect("currentIndexChanged(QString)", self.on_predictions_type_change)

Expand Down Expand Up @@ -132,6 +144,18 @@ def on_use_gpu_change(self, state):
elif state == qt.Qt.Unchecked:
SharedResources.getInstance().use_gpu = False

def on_use_stripped_inputs_change(self, state):
if state == qt.Qt.Checked:
SharedResources.getInstance().user_configuration['Runtime']['use_stripped_data'] = 'True'
elif state == qt.Qt.Unchecked:
SharedResources.getInstance().user_configuration['Runtime']['use_stripped_data'] = 'False'

def on_use_registered_inputs_change(self, state):
if state == qt.Qt.Checked:
SharedResources.getInstance().user_configuration['Runtime']['use_registered_data'] = 'True'
elif state == qt.Qt.Unchecked:
SharedResources.getInstance().user_configuration['Runtime']['use_registered_data'] = 'False'

def on_sampling_strategy_change(self, order):
if order == 'First':
SharedResources.getInstance().user_configuration['Predictions']['reconstruction_order'] = 'resample_first'
Expand Down
5 changes: 4 additions & 1 deletion Raidionics/Raidionics/src/utils/backend_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ def generate_backend_config(input_folder: str, parameters, logic_target_space: s
rads_config.set('System', 'model_folder', '/home/ubuntu/resources/models')
rads_config.set('System', 'pipeline_filename', '/home/ubuntu/resources/models/' + model_name + '/pipeline.json')
rads_config.add_section('Runtime')
# @TODO. The backend disregards those parameters after the latest RADS lib update, has to be fixed
rads_config.set('Runtime', 'reconstruction_method',
SharedResources.getInstance().user_configuration['Predictions']['reconstruction_method'])
rads_config.set('Runtime', 'reconstruction_order',
SharedResources.getInstance().user_configuration['Predictions']['reconstruction_order'])
rads_config.set('Runtime', 'use_stripped_data',
SharedResources.getInstance().user_configuration['Runtime']['use_stripped_data'])
rads_config.set('Runtime', 'use_registered_data',
SharedResources.getInstance().user_configuration['Runtime']['use_registered_data'])
# rads_config.add_section('Neuro')
# if SoftwareConfigResources.getInstance().user_preferences.compute_cortical_structures:
# rads_config.set('Neuro', 'cortical_features', 'MNI, Schaefer7, Schaefer17, Harvard-Oxford')
Expand Down
4 changes: 3 additions & 1 deletion Raidionics/Raidionics/src/utils/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def __set_runtime_parameters(self):
self.user_configuration['Predictions']['non_overlapping'] = 'true'
self.user_configuration['Predictions']['reconstruction_method'] = 'probabilities'
self.user_configuration['Predictions']['reconstruction_order'] = 'resample_first'
self.user_configuration['Runtime'] = {}
self.user_configuration['Runtime']['use_stripped_data'] = 'False'
self.user_configuration['Runtime']['use_registered_data'] = 'False'
self.user_configuration['Neuro'] = {}
self.user_configuration['Neuro']['brain_segmentation_filename'] = ''
self.user_configuration['Mediastinum'] = {}
Expand All @@ -94,4 +97,3 @@ def __set_runtime_parameters(self):
self.user_diagnosis_configuration['Neuro'] = {}
self.user_diagnosis_configuration['Neuro']['tumor_segmentation_filename'] = ''
self.user_diagnosis_configuration['Neuro']['brain_segmentation_filename'] = ''
self.user_diagnosis_configuration['Neuro']['tumor_type'] = ''

0 comments on commit 62e0a47

Please sign in to comment.