Skip to content

Commit a995710

Browse files
authored
Merge pull request #701 from mko010/master
ENH: Add crosshair toggling to OrthoSlicer3D
2 parents d38f9d6 + 099d975 commit a995710

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

nibabel/viewers.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def __init__(self, data, affine=None, axes=None, title=None):
6969
mpl_patch = optional_package('matplotlib.patches')[0]
7070
self._title = title
7171
self._closed = False
72+
self._cross = True
7273

7374
data = np.asanyarray(data)
7475
if data.ndim < 3:
@@ -490,6 +491,9 @@ def _on_keypress(self, event):
490491
new_idx = max(self._data_idx[3] - 1, 0)
491492
self._set_volume_index(new_idx, update_slices=True)
492493
self._draw()
494+
elif event.key == 'ctrl+x':
495+
self._cross = not self._cross
496+
self._draw()
493497

494498
def _draw(self):
495499
"""Update all four (or three) plots"""
@@ -498,8 +502,9 @@ def _draw(self):
498502
for ii in range(3):
499503
ax = self._axes[ii]
500504
ax.draw_artist(self._ims[ii])
501-
for line in self._crosshairs[ii].values():
502-
ax.draw_artist(line)
505+
if self._cross:
506+
for line in self._crosshairs[ii].values():
507+
ax.draw_artist(line)
503508
ax.figure.canvas.blit(ax.bbox)
504509
if self.n_volumes > 1 and len(self._axes) > 3:
505510
ax = self._axes[3]

0 commit comments

Comments
 (0)