diff --git a/nih2mne/GUI/qt_gui.py b/nih2mne/GUI/qt_gui.py index 33f8c9d..8a91fdd 100755 --- a/nih2mne/GUI/qt_gui.py +++ b/nih2mne/GUI/qt_gui.py @@ -136,6 +136,17 @@ def __init__(self, bids_info, qa_file=None): self.b_save.clicked.connect(self.save) top_button_layout.addWidget(self.b_save) + if self.bids_info.mri == 'Multiple': + mri_picker_layout = QHBoxLayout() + self.b_mri_override_selection = QComboBox() + self.b_mri_override_selection.addItems(self.get_mri_choices()) + mri_picker_layout.addWidget(self.b_mri_override_selection) + self.b_mri_override_activate = QPushButton('Set MRI') + self.b_mri_override_activate.clicked.connect(self.override_mri) + mri_picker_layout.addWidget(self.b_mri_override_activate) + top_button_layout.addLayout(mri_picker_layout) + #Set an else statement to force an override + main_layout.addLayout(top_button_layout) # main_layout.addWidget(self.b_save) main_layout.addWidget(QLabel(bids_info.__repr__())) @@ -230,7 +241,9 @@ def save(self): self.bids_info.save(overwrite=True) def override_mri(self): - pass + idx = self.b_mri_override_selection.currentIndex() + mri_to_set = self.bids_info.all_mris[idx] + self.bids_info.mri_selection_override(override_mri=mri_to_set) diff --git a/nih2mne/dataQA/bids_project_interface.py b/nih2mne/dataQA/bids_project_interface.py index 0232fa2..3ba419c 100644 --- a/nih2mne/dataQA/bids_project_interface.py +++ b/nih2mne/dataQA/bids_project_interface.py @@ -288,11 +288,14 @@ def __init__(self, subject=None, bids_root=None): if (self.mri != 'Multiple') and (self.mri != None): self._valid_fids() - def mri_selection_override(self): - for idx, fname in enumerate(self.all_mris): - print(f'{idx}: {fname}') - fname_idx = int(input('Choose an MRI to use in processing:\n')) - self.mri = self.all_mris[fname_idx] + def mri_selection_override(self, override_mri=None): + if override_mri == None: + for idx, fname in enumerate(self.all_mris): + print(f'{idx}: {fname}') + fname_idx = int(input('Choose an MRI to use in processing:\n')) + self.mri = self.all_mris[fname_idx] + else: + self.mri = override_mri self.mri_json = self._get_matching_mr_json() assert len(self.mri_json)>3 self._valid_fids()