Skip to content

ImageWidget #51

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

Merged
merged 22 commits into from
Dec 11, 2022
Merged

ImageWidget #51

merged 22 commits into from
Dec 11, 2022

Conversation

kushalkolar
Copy link
Member

@kushalkolar kushalkolar commented Dec 2, 2022

start implementing #31

TODO:

  • Simple plot
  • grid plot
  • implement quick_min_max()
  • bool kwarg for vmin vmax range-sliders
  • maybe rename "axes" to dimensions/dims to prevent confusion with matplotlib axes
  • test all combinations of kwargs for axes_order and slider_axes
    • in progress
  • implement window_function to allow applying a function along chosen dimension(s) using a window around the current index
    • change the current slice_avg so that a user can just pass any function that takes an axis argument. They can create a wrapper if it doesn't take an axis kwarg.
      • arg in the form like: window_funcs = {"t": (np.mean, 5), "z": None})
  • implement frame_apply, user can provide a single function (for simple plot) or a dict of functions mapping each data array to a function that is called and applied on each slice before it is displayed. This function is called on the output of the window_function if it exists. These function(s) must return a 2D array-like

@kushalkolar kushalkolar requested a review from clewis7 December 2, 2022 03:58
@kushalkolar
Copy link
Member Author

kushalkolar commented Dec 2, 2022

basic image widget without gridplot is functional, takes slider axes arguments

Basic

Can choose the dimension index that the slider should use is desired

img_widget.mp4

Complex axes order arguments

By default it assumes that the "t" dimension is for the slider but any dimension can be used for the slider

img_widget_axes.mp4

@kushalkolar
Copy link
Member Author

If it is a single plot and not a gridplot, we can show a z-axis slider vertically. Maybe once #30 is done we can use the docked viewports to show sliders for individual subplots by creating widgets using pygfx objects.

@kushalkolar
Copy link
Member Author

basic functionality of simple and gridplots work!

img_widget_both.mp4

Did some light testing, errors for basic user mistakes are caught correctly, tried different kwargs like this, need to test more thoroughly.

a = np.random.rand(100, 512, 512, 5)
b = np.random.rand(100, 512, 512, 5)
c = np.random.rand(100, 512, 512, 7)
d = np.random.rand(100, 512, 512, 7)

iw = ImageWidget([a, b, c, d], slider_axes=["t", "z"], axes_order="txyz", cmap="gnuplot2")
iw.show()

@kushalkolar kushalkolar added this to the v0.1 alpha 6 milestone Dec 4, 2022
@kushalkolar
Copy link
Member Author

can now average across multiple dims in both single and gridplots

slice_avg is a property that can be modified at any time

averaging in single plots

imgwidget_avg_single.mp4

averaging multiple dims in gridplot (can also average multiple dims in single plot)

imgwidget_avg_grid.mp4

This was referenced Dec 8, 2022
@kushalkolar kushalkolar marked this pull request as ready for review December 11, 2022 10:17
@kushalkolar
Copy link
Member Author

just for fun, ImageWidget has:

66 if statements
11 elif
15 else
21 for loops
35 possible raise

for handling all the possible args 🙃

@kushalkolar kushalkolar merged commit 0bdddf7 into master Dec 11, 2022
@kushalkolar kushalkolar deleted the high-level-widgets branch December 25, 2022 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy