Skip to content

Refactor imwidget #459

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 32 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3662ab6
Removes slider_dims and now always generates slides for the first n -…
apasarkar Mar 28, 2024
a95badc
Adds more checks, removing C from the default dims order
apasarkar Mar 29, 2024
d155c27
Removes some more code that allowed specifying dimensions by int and …
apasarkar Mar 29, 2024
a77a41f
Fixes bug in kwarg initialization of frames_apply in imagewidget wher…
apasarkar Mar 29, 2024
18b423d
In the _process_indices function the search for the array index in th…
apasarkar Mar 29, 2024
d1f35fe
Enforces condition that we can only apply window function along T and…
apasarkar Mar 29, 2024
3e539ca
Includes properly formatted updates from previous commit
apasarkar Mar 30, 2024
6bd6191
Updates some global variable names for clarity such as ALLOWED_DIMS a…
apasarkar Mar 30, 2024
26d62c2
Updates doc strings and error messages for frame_apply and for error …
apasarkar Mar 31, 2024
c9d1ade
Adds check that window function windowsize is an int and also simplif…
apasarkar Mar 31, 2024
060161a
Removes some unreachable error statements, renames internal variables…
apasarkar Mar 31, 2024
ba6f5a4
Includes support for mixed data types and RGB for imagewidget
apasarkar Apr 2, 2024
0d217b0
Simplifies the code by removing dims_partition and replacing it with …
apasarkar Apr 3, 2024
1bc7190
Simplifies the imwidget api by replacing color_schemes with rgb_disp,…
apasarkar Apr 3, 2024
5b82074
Removes old global variables and color scheme function
apasarkar Apr 9, 2024
1002857
Renames global variables for dimension counts to be clearer, changes …
apasarkar Apr 9, 2024
3c3f0dc
Adds extra check to make sure rgb input list for imagewidget is same …
apasarkar Apr 9, 2024
54d8552
Updates get_n_scrollable_dims function names and docstrings
apasarkar Apr 9, 2024
cfe4bd6
Updates the function to get number of scrollable dimensions for each …
apasarkar Apr 9, 2024
5ff549e
Updates the set_data code, removing hard to maintain constants, updat…
apasarkar Apr 9, 2024
1d75b9b
Fixes bug that did not update slider dimensions properly and also inc…
apasarkar Apr 9, 2024
cbd47c2
Updates documentation, removes unnecessary public variables
apasarkar Apr 10, 2024
2360142
Merge branch 'main' into refactor_imwidget
apasarkar Apr 10, 2024
5ce336f
fix indexing
kushalkolar Apr 10, 2024
8679910
fix test
kushalkolar Apr 10, 2024
db5f5b4
Update image_widget_test.ipynb
kushalkolar Apr 10, 2024
491aa1f
black
kushalkolar Apr 10, 2024
29ed277
Includes new testing for imagewidget rgb and mixed types
apasarkar Apr 11, 2024
cf3cba1
Overrides synced controllers for gridplot imagewidget test
apasarkar Apr 11, 2024
eba97f7
Includes black after updating the tests
apasarkar Apr 11, 2024
8fa21de
Includes histogram widget in the new tests for rgb and mixed types
apasarkar Apr 11, 2024
aea6d56
Apply suggestions from code review
kushalkolar Apr 12, 2024
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
1 change: 0 additions & 1 deletion examples/notebooks/image_widget.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
"source": [
"iw_movie = ImageWidget(\n",
" data=gray_movie, \n",
" slider_dims=[\"t\"],\n",
" cmap=\"gray\"\n",
")"
]
Expand Down
63 changes: 51 additions & 12 deletions examples/notebooks/image_widget_test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "07019035-83f2-4753-9e7c-628ae439b441",
"metadata": {
"tags": []
Expand All @@ -18,7 +18,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "10b8ab40-944d-472c-9b7e-cae8a129e7ce",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -130,7 +130,6 @@
"source": [
"iw_movie = ImageWidget(\n",
" data=gray_movie, \n",
" slider_dims=[\"t\"],\n",
" cmap=\"gray\",\n",
" grid_plot_kwargs={\"size\": (900, 600)},\n",
")"
Expand Down Expand Up @@ -275,9 +274,6 @@
"execution_count": null,
"id": "76535d56-e514-4c16-aa48-a6359f8019d5",
"metadata": {
"jupyter": {
"source_hidden": true
},
"tags": []
},
"outputs": [],
Expand Down Expand Up @@ -444,23 +440,66 @@
"iw_z.close()"
]
},
{
"cell_type": "markdown",
"id": "6716f255-44c2-400d-a2bf-254683e4cd9d",
"metadata": {},
"source": [
"# Test Mixed Shapes, RGB (and set data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "870627ef-09d8-44e4-8952-aedb702d1526",
"execution_count": 30,
"id": "ed783360-992d-40f8-bb6f-152a59edff43",
"metadata": {},
"outputs": [],
"source": [
"notebook_finished()"
"zfish_data = np.load(\"./zfish_test.npy\")\n",
"zfish_frame_1 = zfish_data[0, 0, :, :]\n",
"zfish_frame_2 = zfish_data[20, 3, :, :]\n",
"movie = iio.imread(\"imageio:cockatoo.mp4\")\n",
"\n",
"iw_mixed_shapes = ImageWidget(\n",
" data=[zfish_frame_1, movie], # you can also provide a list of tzxy arrays\n",
" rgb=[False, True],\n",
" histogram_widget=True,\n",
" cmap=\"gnuplot2\", \n",
" grid_plot_kwargs = {\"controller_ids\": None},\n",
")\n",
"\n",
"iw_mixed_shapes.show()"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "274c67b4-aa07-4fcf-a094-1b1e70d0378a",
"metadata": {},
"outputs": [],
"source": [
"iw_mixed_shapes.sliders[\"t\"].value = 50\n",
"plot_test(\"image-widget-zfish-mixed-rgb-cockatoo-frame-50\", iw_mixed_shapes.gridplot)\n",
"\n",
"#Set the data, changing the first array and also the size of the \"T\" slider\n",
"iw_mixed_shapes.set_data([zfish_frame_2, movie[:200, :, :, :]], reset_indices=True)\n",
"plot_test(\"image-widget-zfish-mixed-rgb-cockatoo-set-data\", iw_mixed_shapes.gridplot)\n",
"\n",
"#Check how a window function might work on the RGB data\n",
"iw_mixed_shapes.window_funcs = {\"t\": (np.mean, 4)}\n",
"iw_mixed_shapes.sliders[\"t\"].value = 20\n",
"plot_test(\"image-widget-zfish-mixed-rgb-cockatoo-windowrgb\", iw_mixed_shapes.gridplot)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b8fff1a6-119e-4f03-ba3a-4c7b9e8c212b",
"id": "870627ef-09d8-44e4-8952-aedb702d1526",
"metadata": {},
"outputs": [],
"source": []
"source": [
"notebook_finished()"
]
}
],
"metadata": {
Expand All @@ -479,7 +518,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.8"
}
},
"nbformat": 4,
Expand Down
Loading
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