Automation of StarDist in imagej macros

Hi Everyone,

I am trying to write a ImageJ macro in which I will use StarDist. Is there a way to automate so that ok is not needed to be pressed every time (windowless version)?

I have found this link but as it is in python I have no idea what to do?

@nacherso is also interested in the answer if there is a way to do this please it will be greatly appreciated!

Thanks,
Megan

2 Likes

Hi Megan,

thanks for using StarDist and welcome to the forum!

You’ve already found the Jython script that allows to automate StarDist in ImageJ (also see this for another example).
I understand that the ImageJ macro language is very popular, but I don’t have much experience with it and don’t know how to call StarDist from it. I’m not even sure if it’s possible, given that StarDist is an ImageJ2 plugin. (Maybe @haesleinhuepf et al. can weigh in on this.)

Sorry for the late reply.

Best,
Uwe

3 Likes

Hi @meganapalmer,

we just released a new version of StarDist for ImageJ, which is macro-recordable and that can also be called from a macro. The syntax is a bit weird though, so it’s best to record with the parameters that you need, and then go from there.

Hope that works for you.

Best,
Uwe

3 Likes

Hi @uschmidt83

Thank you so much, however I have just tried to record and it threw up this error:

[ERROR] Module threw error
java.lang.NoClassDefFoundError: org/apache/commons/text/StringEscapeUtils
at de.csbdresden.CommandFromMacro.getMacroString(CommandFromMacro.java:229)
at de.csbdresden.CommandFromMacro.record(CommandFromMacro.java:169)
at de.csbdresden.CommandFromMacro.record(CommandFromMacro.java:153)
at de.csbdresden.stardist.StarDist2D.run(StarDist2D.java:322)
at org.scijava.command.CommandModule.run(CommandModule.java:199)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Am I missing anything here?

Thanks,
Megan

2 Likes

Hi Megan,

thanks for the bug report! I’ve just updated StarDist to fix this problem. Please try again.

Best,
Uwe

2 Likes

Thank you @uschmidt83 :blush:

2 Likes