-
Notifications
You must be signed in to change notification settings - Fork 31
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
Dynamic generation of the LUTs png #581
Conversation
for more information, see https://pre-commit.ci
@Tom-TBT I created it by importing a single-channel Image into OMERO that is a gradient from black to white, like the "fake" images (or I created it via the API |
Sorry, I only meant for the thing called "gradient.png" in |
Ah - understood. I don't remember about that I'm afraid. But if you have something that looks similar then that's fine. |
The original "gradient.png" (pre-dating LUTs) was probably created manually in photoshop, then copied into the LUTs image later. |
@@ -2076,23 +2077,97 @@ def listLuts_json(request, conn=None, **kwargs): | |||
We include 'png_index' which is the index of each LUT within the | |||
static/webgateway/img/luts_10.png or -1 if LUT is not found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update this docstring and mention version etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring updated with mention to v5.28.0
Everything seems to be working, but I didn't manage to test adding a new LUT. I duplicated a LUT and renamed it to create a new one in the luts directory on my Docker server, but after restarting I'm not seeing the new one in the lists (nothing to do with this PR). As I understand it, to use the dynamic LUTs list, clients need to use So it should be possible for a client/app e.g. figure, to try |
for more information, see https://pre-commit.ci
Yes, that way omero-web is retrocompatible with the plugins.
Thanks for the tip, I tried something like this, to then return the appropriate URL from a view of the plugin. |
I guess e.g. omero-figure could load the LUTS json with |
I like this approach of dynamically generating the LUTS preview PNG. Having the
This way old clients would still work, and new clients would also still use the same old URL and only need to check for the existence of |
for more information, see https://pre-commit.ci
I changed the implementation. Now the new index and list are returned next to the old one. Implementing it here doesn't require any checks since changes on the client and server are packaged together (it won't be the case for figure and iviewer). I have a question about the caching of the png. A new PNG is generated each time a LUT is renamed, added, or removed because there won't be a matching key in the cache. But what should be the timeout of the cache? The generation of the PNG takes a few seconds. Setting it to |
This looks good to me. Since the cached value depends on the available LUTs, I don't see a problem with caching indefinitely. |
Thank you Andreas, I thus changed the timeout value to None. |
@will-moore do you mind taking a final look at this PR before I merge? Thank you! |
@will-moore could you please validate the following:
|
|
Hello,
here's the change I propose to generate the LUT png dynamically within a view of webgateway.
I opened the PR so we can discuss it from here, but I haven't yet solved the version compatibility problems between OMERO.web and the plugins.
What I have done:
url('../img/luts_10.png')
tourl('/webgateway/luts_png/')
Several other points:
I guess that the gradient stopping at half is for display. Here I have a slight change with
numpy.linspace(255, 0, 180, dtype="uint8")
but display is very similar