I was hoping to have a macro count up the number of files in a directory
and then launch an appropriate number of executions (in parallel) of a second macro that will act on the images. Can this be done in the macro language? It seems that runMacro and eval both wait until the macro they call completes before allowing their containing macro to proceed to any next steps. Thanks for any advice, Bill |
Hi,
On Wed, 21 Sep 2011, Bill Mohler wrote: > I was hoping to have a macro count up the number of files in a directory > and then launch an appropriate number of executions (in parallel) of a > second macro that will act on the images. > > Can this be done in the macro language? It seems that runMacro and eval > both wait until the macro they call completes before allowing their > containing macro to proceed to any next steps. It can be done by either going via Javascript. But then I would _strongly_ advise to go fully Javascript. It is so much more powerful and flexible (as long as you _can_ do all you want to do via the Java API, something that will definitely be the case with ImageJ2). Ciao, Johannes |
In reply to this post by Bill Mohler
Hi Bill,
What you can do: If you have a macro that has its own menu command (by installing it), you can start it in a separate thread by call("ij.IJ.doCommand", commandName); where commandName is the menu command. This will start it in a separate thread without waiting till it finishes. If you do it like this, beware: I am not aware of any nice way to pass arguments to the called macro in a multi-threading safe way. Probably, whatever you try will be an ugly hack (and might possibly fail with a future version of ImageJ). Michael ________________________________________________________________ On 21 Sep 2011, at 20:27, Bill Mohler wrote: > I was hoping to have a macro count up the number of files in a > directory and then launch an appropriate number of executions (in > parallel) of a second macro that will act on the images. > > Can this be done in the macro language? It seems that runMacro and > eval both wait until the macro they call completes before allowing > their containing macro to proceed to any next steps. > > Thanks for any advice, > Bill |
Hi Bill,
The way I do is to have two variables that specify the start/end numbers of the images to process. Then, if I've got 2000 images to process I'll start four instances of imageJ, each processing 500 images (there are four processors on my machine) - i.e., from 1 to 500, 501 to 1000, 1001 to 1500, and 1501 to 2000. Hope this helps, Emmanuel On 22 September 2011 12:01, Michael Schmid <[hidden email]> wrote: > Hi Bill, > > What you can do: If you have a macro that has its own menu command (by > installing it), you can start it in a separate thread by > call("ij.IJ.doCommand", commandName); > where commandName is the menu command. This will start it in a separate > thread without waiting till it finishes. > If you do it like this, beware: I am not aware of any nice way to pass > arguments to the called macro in a multi-threading safe way. Probably, > whatever you try will be an ugly hack (and might possibly fail with a future > version of ImageJ). > > Michael > ________________________________________________________________ > > On 21 Sep 2011, at 20:27, Bill Mohler wrote: > >> I was hoping to have a macro count up the number of files in a directory >> and then launch an appropriate number of executions (in parallel) of a >> second macro that will act on the images. >> >> Can this be done in the macro language? It seems that runMacro and eval >> both wait until the macro they call completes before allowing their >> containing macro to proceed to any next steps. >> >> Thanks for any advice, >> Bill > |
Free forum by Nabble | Edit this page |