-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to Disable Guide Lines #30
Comments
Nice idea, will take a look at this |
diff --git a/niwidgets/niwidget_volume.py b/niwidgets/niwidget_volume.py
index a5f0b6c..b74963e 100644
--- a/niwidgets/niwidget_volume.py
+++ b/niwidgets/niwidget_volume.py
@@ -142,6 +142,8 @@ class NiftiWidget:
value=0, min=0, max=data_array.shape[3] - 1,
continuous_update=False
)
+ if 'show_guide' in kwargs:
+ kwargs['show_guide'] = fixed(kwargs['show_guide'])
widgets.interact(self._plot_slices, data=fixed(data_array), **kwargs)
@@ -149,7 +151,7 @@ class NiftiWidget:
plt.ion() # return to interactive state
def _plot_slices(self, data, x, y, z, t,
- colormap='viridis', figsize=(15, 5)):
+ colormap='viridis', figsize=(15, 5), show_guide=True):
"""
Plot x,y,z slices.
@@ -183,10 +185,16 @@ class NiftiWidget:
)
# draw guides to show selected coordinates
- guide_positions = [val for jj, val in enumerate(coords)
+ if show_guide:
+ guide_positions = [val for jj, val in enumerate(coords)
if jj != ii]
- imh.axes.lines[0].set_xdata(2*[guide_positions[0]])
- imh.axes.lines[1].set_ydata(2*[guide_positions[1]])
+ imh.axes.lines[0].set_xdata(2*[guide_positions[0]])
+ imh.axes.lines[1].set_ydata(2*[guide_positions[1]])
+ imh.axes.lines[0].set_linewidth(1.5)
+ imh.axes.lines[1].set_linewidth(1.5)
+ else:
+ imh.axes.lines[0].set_linewidth(0)
+ imh.axes.lines[1].set_linewidth(0)
imh.set_cmap(colormap) |
Nice - I was thinking of this as a checkbox in the widget that you'd be able to tick and untick, but this is a good start! |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
e.g.
niwidgets/niwidgets/niwidget_volume.py
Lines 200 to 204 in 044ad6f
The text was updated successfully, but these errors were encountered: