Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrockhill committed Apr 29, 2024
1 parent ac6cdf9 commit a7c59df
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
24 changes: 15 additions & 9 deletions mne_gui_addons/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,11 @@ def _load_image_data(self, base_image=None):
self._mr_scan_ras_ras_vox_t = None
else:
mr_base_fname = op.join(self._subject_dir, "mri", "{}.mgz")
mr_fname = mr_base_fname.format('brain') if \
op.isfile(mr_base_fname.format('brain')) else mr_base_fname.format('T1')
mr_fname = (
mr_base_fname.format("brain")
if op.isfile(mr_base_fname.format("brain"))
else mr_base_fname.format("T1")
)
(
self._mr_data,
mr_vox_mri_t,
Expand Down Expand Up @@ -493,7 +496,7 @@ def _configure_status_bar(self, hbox=None):
brush.setStyle(QtCore.Qt.SolidPattern)
model.setData(model.index(0, 0), brush, QtCore.Qt.BackgroundRole)

if self._base_mr_aligned and hasattr(self, '_toggle_show_brain'):
if self._base_mr_aligned and hasattr(self, "_toggle_show_brain"):
self._toggle_show_selector.addItem("Show brain slices")
self._toggle_show_selector.addItem("Show atlas slices")

Expand Down Expand Up @@ -598,14 +601,14 @@ def _toggle_show(self):
idx = self._toggle_show_selector.currentIndex()
show_hide, item = text.split(" ")[0], " ".join(text.split(" ")[1:])
show_hide_opp = "Show" if show_hide == "Hide" else "Hide"
if 'slices' in item:
if "slices" in item:
# atlas shown and brain already on or brain already on and atlas shown
if show_hide == "Show" and "mri" in self._images:
self._toggle_show_brain()
if self._using_atlas:
self._toggle_show_selector.setItemText(1, f"Hide atlas slices")
self._toggle_show_selector.setItemText(1, "Hide atlas slices")
else:
self._toggle_show_selector.setItemText(0, f"Hide brain slices")
self._toggle_show_selector.setItemText(0, "Hide brain slices")
mr_base_fname = op.join(self._subject_dir, "mri", "{}.mgz")
if show_hide == "Show" and "atlas" in item and not self._using_atlas:
if op.isfile(mr_base_fname.format("wmparc")):
Expand Down Expand Up @@ -817,11 +820,14 @@ def _update_moved(self):
"{:3d}, {:3d}, {:3d}".format(*self._vox.round().astype(int))
)
intensity_text = "intensity = {:.2f}".format(
self._base_data[tuple(self._current_slice)])
self._base_data[tuple(self._current_slice)]
)
if self._using_atlas:
vox = apply_trans(self._mr_scan_ras_ras_vox_t, self._ras).round().astype(int)
vox = (
apply_trans(self._mr_scan_ras_ras_vox_t, self._ras).round().astype(int)
)
label = self._atlas_ids[int(self._mr_data[tuple(vox)])]
intensity_text += f' ({label})'
intensity_text += f" ({label})"
self._intensity_label.setText(intensity_text)

@safe_event
Expand Down
4 changes: 1 addition & 3 deletions mne_gui_addons/_ieeg_locate.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,7 @@ def _update_ct_images(self, axis=None, draw=False):

def _get_mr_slice(self, axis):
"""Get the current MR slice."""
mri_data = np.take(
self._mr_data, self._current_slice[axis], axis=axis
).T
mri_data = np.take(self._mr_data, self._current_slice[axis], axis=axis).T
if self._using_atlas:
mri_slice = mri_data.copy().astype(int)
mri_data = np.zeros(mri_slice.shape + (3,), dtype=int)
Expand Down

0 comments on commit a7c59df

Please sign in to comment.