Skip to content
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

Make StarDist (and other problematic IJ2 plugins) accessible from IJ1 Macro #7

Merged
merged 6 commits into from
Apr 7, 2020

Conversation

uschmidt83
Copy link
Member

As a reaction to PR #6 and reading @ctrueden's comment here, I've decided to make a generic SciJava Command CommandFromMacro that (potentially) allows to call any Command from IJ1 macro (without the need to press OK). The syntax is not ideal, but this is a workaround until the situation has been properly fixed.

Based on @haesleinhuepf's example in #6, I've added a custom macro recorder to take advantage of CommandFromMacro for the two StarDist Commands.

I'm not sure this is the way to go, but it seems to work and is (in my understanding) a fairly general solution that could be implemented/used by other plugins without much effort.

@uschmidt83
Copy link
Member Author

uschmidt83 commented Apr 2, 2020

All a plugin has to do is to call CommandFromMacro.record(this, <CommandService instance>); at the end of the run() method to record the macro string in the new format.

For example:

run("Command From Macro", "command=[de.csbdresden.stardist.StarDist2D], args=['input':'Label Image','modelChoice':'Versatile (fluorescent nuclei)','normalizeInput':'true','percentileBottom':'1.0','percentileTop':'99.8','probThresh':'0.5','nmsThresh':'0.4','outputType':'Both','nTiles':'1','excludeBoundary':'2','verbose':'false','showCsbdeepProgress':'false','showProbAndDist':'false','label':''], process=[false]");

@haesleinhuepf
Copy link
Contributor

Wow, this is so awesome!

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.

3 participants