imagej.js icon indicating copy to clipboard operation
imagej.js copied to clipboard

plugin request : Action Bar

Open kwolbachia opened this issue 3 years ago • 18 comments

Hello, I think the Action Bar plugin would be very usefull for tool sharing and testing via imageJ.js it creates personnalized buttons that can run macros or beanshell scripts. the bars can be integrated to imageJ main bar or sticked to opened image or free floating. it has the possibility to generate a bar from a simple string , for example optained from a raw gist URL. It really is a great way to make macro scripts user friendly!

links : https://figshare.com/articles/dataset/Custom_toolbars_and_mini_applications_with_Action_Bar/3397603/12?file=26749979 https://github.com/mutterer/ActionBar

and an example bar that I'd like to share in imagej.js https://forum.image.sc/t/new-tool-colorblind-bar/53634

Hope you'll like the idea, Best, Kevin

kwolbachia avatar Nov 10 '21 22:11 kwolbachia

Hi Kevin, thanks for the request! I will give it a try!

Edit: Let's see how it goes: https://github.com/imjoy-team/ImageJA.JS/commit/dc76d1142d697b7097994c4d6b8f234fc1b0242d

oeway avatar Nov 12 '21 08:11 oeway

Thanks Wei that was fast! Sorry I tried things from there but I don't really know what I'm doing right now x) am I supposed to test it with the "Compile ImageJ into Javascript" way in your wiki?

kwolbachia avatar Nov 12 '21 11:11 kwolbachia

I will need to trigger the CI rebuild on this repo, then you will get it at ij.ImJoy.io

oeway avatar Nov 12 '21 11:11 oeway

That's awesome! Thank you again

kwolbachia avatar Nov 12 '21 11:11 kwolbachia

@kwolbachia It's now deployed, however, due to browser caching you need to use incognito mode in Chrome to open https://ij.imjoy.io

There is another issue, I got an error and it seems that actionbar try to save to plugins folder which is readonly for this case. See below: Screen Shot 2021-11-12 at 2 11 26 PM

@mutterer Can we save it to another path? E.g. you can write to /files/ in imagej.js.

oeway avatar Nov 12 '21 13:11 oeway

There is one problem, I didn't see that the github rep of Action Bar is not udated, the real last version is there : https://sites.imagej.net/Mutterer/plugins/ (action_bar.jar-20210614214121) The github jar is from 2015 ^^' In the last version I think this macro code should work for opening an Action Bar from a url : run("Action Bar",File.openUrlAsString("https://raw.githubusercontent.com/kwolbachia/Imagej-macro-addiction/main/Colorblind%20Bar/CB_Bar_fromstring.ijm")); if it works, this "from string" function allows to avoid the need of a saved file in the Action Bar folder

kwolbachia avatar Nov 12 '21 13:11 kwolbachia

Ok, I will update that then.

oeway avatar Nov 12 '21 20:11 oeway

Hi @oeway @kwolbachia , Thanks for your efforts for making ActionBar available in ImageJ.JS Let me know if any update to AB is needed. I also think it would be better if the non working examples were removed from the ActionBar menu, so that nobody gets confused. I'll try to update the script that is run when calling the basic "Action Bar" command to make it work with the "from string" concept.

mutterer avatar Nov 14 '21 16:11 mutterer

@kwolbachia I just updated: https://github.com/imjoy-team/ImageJA.JS/commit/3c8924c877e747ac3ae62a25eab4c022328d27e8 Will take some time to comiple and then I will trigger an update on imagej.js site.

oeway avatar Nov 15 '21 13:11 oeway

Thanks again @oeway !

kwolbachia avatar Nov 15 '21 14:11 kwolbachia

@kwolbachia It's ready now.

@mutterer With the latest version we still get the error with "Erro Install Action Bar in plugins/ActionBar/" mostly due to the reason I mentioned above. Do you have any idea on how to fix that?

oeway avatar Nov 15 '21 18:11 oeway

imageJ js_ActionBar

This is awesome, the fromString way work perfectly! : http://tiny.cc/imagejJS_ActionBar

kwolbachia avatar Nov 15 '21 18:11 kwolbachia

Hi @oeway , About the necessity of private window on chrome, I don't really understand if it's a temporary thing or forever?

kwolbachia avatar Nov 16 '21 14:11 kwolbachia

Hi @oeway, @kwolbachia

enabling writing action bars to /files/ could be made to work, but I don't think it makes a lot a sense, as those would be lost across browser sessions. I'd rather suggest replacing the createAB.txt macro content by a simple message to the Log window that in ImageJ.JS, the recommended method to create ActionBars are to host the bar code on e.g. github. and maybe point to some example code:

The createAB.txt could be:

print ("//With ImageJ.JS, we recommended the following method to create Action Bars:");
print ("//host your bars in a GitHub repository");
print ("//use the <fromString> tag to inject the bar's code to the ActionBar plugin");
print ("s=File.openUrlAsString('https://raw.githubusercontent.com/mutterer/weird/master/embeded_bar.ijm');");
print ("run('Action Bar',s);");

Either please replace the file above, or let me know where I can make the PR. Thanks!

mutterer avatar Nov 16 '21 15:11 mutterer

@mutterer /files/ endpoint is a an IndexedDB-based, persistent read-write file system, so the data won't be lost across browser sessions, only if the user decided to clear all the browser data which I would assume user don't do often. For me it would make sense to store there.

@kwolbachia The incognito mode won't be needed if I bump there version, and I just did it, could you try it and see if it works? You might need to refresh the page once.

oeway avatar Nov 19 '21 11:11 oeway

Hi @oeway, at this moment nothing changed for me : I see Action Bar only on chrome incognito. And when I try my current browser Firefox in incognito, imageJ.js loads forever. I will try again later

kwolbachia avatar Nov 19 '21 12:11 kwolbachia

Hi @oeway , I tried again and I can see Action Bar only on chrome in mac. I need incognito in windows to see it and never see it on Firefox. I can have either the v0.5.1 or v0.5.4 depending on the browser / os

kwolbachia avatar Nov 22 '21 10:11 kwolbachia

Hi @oeway I realized I needed to clear browser cookies and data to see the Action Bar plugin So everything works everywhere now! Thanks again for implementing this :) Best, Kevin

kwolbachia avatar Jan 04 '22 13:01 kwolbachia