Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions nibabel/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(self, data, affine=None, axes=None, title=None):
mpl_patch = optional_package('matplotlib.patches')[0]
self._title = title
self._closed = False
self._cross = True

data = np.asanyarray(data)
if data.ndim < 3:
Expand Down Expand Up @@ -490,6 +491,9 @@ def _on_keypress(self, event):
new_idx = max(self._data_idx[3] - 1, 0)
self._set_volume_index(new_idx, update_slices=True)
self._draw()
elif event.key == 'ctrl+x':
self._cross = not self._cross
self._draw()

def _draw(self):
"""Update all four (or three) plots"""
Expand All @@ -498,8 +502,9 @@ def _draw(self):
for ii in range(3):
ax = self._axes[ii]
ax.draw_artist(self._ims[ii])
for line in self._crosshairs[ii].values():
ax.draw_artist(line)
if self._cross:
for line in self._crosshairs[ii].values():
ax.draw_artist(line)
ax.figure.canvas.blit(ax.bbox)
if self.n_volumes > 1 and len(self._axes) > 3:
ax = self._axes[3]
Expand Down