Dear all,
is there a way to tell a Macro to wait until a plugin running threads has finished? I'd like to wait until the output window of the plugin (ExtendedDepthOfField in this case) appears, and then continue the macro without the need of any user input. Is this possible in a macro, or do I have to use a plugin for this? thx for any hints, jan -- Jan Eglinger PhD Student, Eckhard Lammert group Max Planck Institute of Molecular Cell Biology and Genetics Pfotenhauerstrasse 108 01307 Dresden Germany +49 351 210 2722 |
Hi,
On Wed, 10 Jan 2007, Jan Eglinger wrote: > is there a way to tell a Macro to wait until a plugin running threads has > finished? > I'd like to wait until the output window of the plugin (ExtendedDepthOfField > in this case) appears, and then continue the macro without the need of any > user input. A quick and dirty way: x = getImageID(); run("ExtendedDepthOfField ", "arguments to the plugin"); while (x == getImageID()) wait(100); This just waits (sleeping 100 milliseconds at a time) until the current image is different. Hth, Dscho |
Hi,
thanks for the suggestion, I tried it like this and also with getTitle(), but: the while loop doesn't stop after the new Image appears. I can see the image window, but the macro apparently still gets the old ImageID and Title. Any idea why? Is there a way to check in a macro if an image with a given title exists in the window list? best, jan (using ImageJ 1.38f) -------- Original Message -------- From: Johannes Schindelin <[hidden email]> To: Jan Eglinger <[hidden email]> Cc: [hidden email] Subject: Re:macro listening to thread Date: 10.01.2007 10:53 > Hi, > > On Wed, 10 Jan 2007, Jan Eglinger wrote: > >> is there a way to tell a Macro to wait until a plugin running threads has >> finished? >> I'd like to wait until the output window of the plugin (ExtendedDepthOfField >> in this case) appears, and then continue the macro without the need of any >> user input. > > A quick and dirty way: > > x = getImageID(); > run("ExtendedDepthOfField ", "arguments to the plugin"); > while (x == getImageID()) > wait(100); > > This just waits (sleeping 100 milliseconds at a time) until the current > image is different. > > Hth, > Dscho |
Hi,
On Wed, 10 Jan 2007, Jan Eglinger wrote: > thanks for the suggestion, I tried it like this and also with > getTitle(), but: > > the while loop doesn't stop after the new Image appears. I can see the > image window, but the macro apparently still gets the old ImageID and > Title. Any idea why? Evidently, the current image is not changed. Could you try with "nImages()" instead of "getImageID()"? > Is there a way to check in a macro if an image with a given title exists > in the window list? Try "isOpen("Title")". Hth, Dscho |
In reply to this post by Jan Eglinger-5
On Wednesday 10 January 2007 13:45, Jan Eglinger wrote:
> Is there a way to check in a macro if an image with a given title exists > in the window list? http://rsbweb.nih.gov/ij/developer/macro/functions.html Look for isOpen() function. I hope it helps. Gabriel |
In reply to this post by dscho
Both the getImageID() and getTitle() macro functions have bugs that
cause them to not notice when an image window is opened by a plugin. These bugs will be fixed in ImageJ 1.38g. In the meantime, you can work around the bugs by using the nImages() function. -wayne On Jan 10, 2007, at 8:50 AM, Johannes Schindelin wrote: > Hi, > > On Wed, 10 Jan 2007, Jan Eglinger wrote: > >> thanks for the suggestion, I tried it like this and also with >> getTitle(), but: >> >> the while loop doesn't stop after the new Image appears. I can see the >> image window, but the macro apparently still gets the old ImageID and >> Title. Any idea why? > > Evidently, the current image is not changed. Could you try with > "nImages()" instead of "getImageID()"? > >> Is there a way to check in a macro if an image with a given title >> exists >> in the window list? > > Try "isOpen("Title")". > > Hth, > Dscho > |
Free forum by Nabble | Edit this page |