Wait times in macros that use the Trainable Weka Segmentation

As a rule of thumb when should you add wait commands? How do you guess at a wait time? Is there a typical error that you see when this is the issue?

Hello @susan-sheehan,

I moved your question to its own topic to avoid mixing up answers of different problems.

Working with macros you might need to add a wait after calling any command that takes some time to be executed if you need to access its output right after the execution. That is the case when you call the Trainable Weka Segmentation plugin for the first time (since you open Fiji) because it needs some seconds to find and load all the available Weka learning schemes. It usually takes about 2-3 seconds.

That being said, working with scripts instead of macros avoids this problem because all the instructions wait for the previous one to finish :slight_smile:

1 Like

Thanks for your help! That clarifies things a little I think. I was asking in general for better understanding of coding in ImageJ and more specifically some ImageJ projects I am working on. I am currently writing in .ijm language so I keep calling them macros but I’m running them in headless mode etc. so I think I fall into the scripting category so hopefully won’t encounter this problem but its good to make note of these types of things.

1 Like