-
Notifications
You must be signed in to change notification settings - Fork 12
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
Question #141
Comments
This message was generated by git-bob (version: 0.17.0, model: gpt-4o-2024-08-06, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully. Hi @smith6jt-cop, thanks for reaching out! Unfortunately, I'm not allowed to respond to you directly. Best, |
git-bob answer |
This message was generated by git-bob (version: 0.17.0, model: gpt-4o-2024-08-06, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully. Hi @ smith6jt-cop, The issue with Best, |
Thanks for the response! Running stackview in a jupyter notebook in VS Code on Windows 10 in conda env (miniforge). Reading in `file_list = sorted(glob(os.path.join(sig_dir,'*.tif')), key=alphanumeric_key) stackview.slice(markers, zoom_factor=0.09, slider_text=marker_names)` I can scroll through the images, but the slider text stays on the first element in marker_names. So I use:
Now although the buttons are too small to show the full marker name, hovering over the buttons shows them properly. |
That's because the feature you are expecting was not implemented. The "slider_text" is intended as a label for the slider. E.g. if you slice through the Z dimension, you could set the slider_text to "Z" so that the user knows what they are scrolling through. To have an additional label, which shows a custom text (e.g. a filename) depending on which slice is selected, you can use the I presume this code is close to your use-case: import ipywidgets as widgets
from IPython.display import display
import stackview
import numpy as np
image = np.random.random((10,200, 200))
filenames = [f"image{i}.tif" for i in range(10)]
# Create the slice viewer
slice_viewer = stackview.slice(image)
# event handler, called when the user moves the slider.
def on_slice_change(event=None):
label.value = f"You are viewing slice {filenames[slice_viewer.viewer.get_slice_index()[0]]}"
# Create label widget
label = widgets.Label()
on_slice_change()
# Connect the callback to slice changes
slice_viewer.viewer.observe(on_slice_change)
# Display widgets
display(slice_viewer)
display(label) Let me know if this solves the issue! |
Aha I was wondering if that was the case. What threw me off was that the input to slider_text is documented as: str = "[{}]" So I though the list could be related to the slice. Thank you for your help. The code does now update the string, but the image is not changing with the slider. Probably something with how Jupyter is configured in VS Code (I've been working through this). |
It's related to multiple sliders. Thanks for your input! Thus does sound like a good feature request. So I'll keep this issue open for the time being. |
Why doesn't the slider_text update when using stackview.slice?
git-bob answer
The text was updated successfully, but these errors were encountered: