Skip to content

Commit

Permalink
Subject panel integrates MRI chooser if multiple MRIs found
Browse files Browse the repository at this point in the history
  • Loading branch information
jstout211 committed Oct 28, 2024
1 parent fe73f1b commit f19f73f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
15 changes: 14 additions & 1 deletion nih2mne/GUI/qt_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()))
Expand Down Expand Up @@ -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)



Expand Down
13 changes: 8 additions & 5 deletions nih2mne/dataQA/bids_project_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit f19f73f

Please sign in to comment.