I would like to use the mouse within a macro to select a pair of images to process - I can't see how. I can give the images names before the macro runs and use the names within the macro, but it would be much less just to select them with the mouse. Suggestions would be appreciated. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Jeremy,
a look at the available macro functions reveals: imgID = getImageID(); The explanatory text tells us: "Returns the unique ID (a negative number) of the active image." The rest is a question of adequate loops that allow you to activate the desired images. HTH Herbie :::::::::::::::::::::::::::::::::::::::::: Am 05.11.15 um 16:30 schrieb Jeremy Adler: > > I would like to use the mouse within a macro to select a pair of > images to process - I can't see how. > > I can give the images names before the macro runs and use the names > within the macro, but it would be much less just to select them with > the mouse. > > Suggestions would be appreciated. > > > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Jeremy Adler
Hi Jeremy,
How about a wait for user command? That would pause the macro and pop up a dialog box instructing the use to click on the desired image and then to click OK in the dialog box. The clicked image would then be the "current" image, so the macro would do the processing you want, and then you could insert a second wait for user command to pause and allow clicking on the second image to process. So your code would look like this: waitForUser("click the first image"); // code to process first image here waitForUser("click the second image"); // code to process second image here Best, Christine -------------------------------------------- Christine Labno, Ph.D. Asst. Technical Director Light Microscopy Core University of Chicago Office of Shared Research Facilities KCBD 1250 900 E. 57th St. (773) 834-9040 (phone) ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Jeremy Adler [[hidden email]] Sent: Thursday, November 05, 2015 9:30 AM To: [hidden email] Subject: active mouse within a macro I would like to use the mouse within a macro to select a pair of images to process - I can't see how. I can give the images names before the macro runs and use the names within the macro, but it would be much less just to select them with the mouse. Suggestions would be appreciated. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Jeremy Adler
Hi Jeremy,
you might be aware of this simple possibility. Nevertheless, I post it since it might be helpful for others. Disadvantage is that you additionally need to press Ok after selecting the image. A mouse listener would also be a possibility but that might be very sensitive to accidental clicks. The following code can be placed anywhere in the macro sequence just before you need the images to be specified. //-------------- waitForUser("select image 1"); image1 = getTitle(); waitForUser("select image 2"); image2 = getTitle(); // your macro code using the variable image1 and image2 //--------------- Regards, Jan 2015-11-05 16:30 GMT+01:00 Jeremy Adler <[hidden email]>: > > I would like to use the mouse within a macro to select a pair of images to > process - I can't see how. > > I can give the images names before the macro runs and use the names within > the macro, but it would be much less just to select them with the mouse. > > Suggestions would be appreciated. > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- CEO: Dr. rer. nat. Jan Brocher phone: +49 (0)6234 917 03 39 mobile: +49 (0)176 705 746 81 e-mail: [hidden email] info: [hidden email] inquiries: [hidden email] web: www.biovoxxel.de -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Jeremy Adler
For this problem, the waitForUser command is perhaps the best solution. Also if you get occasional error messages, you can add a short delay afterwards:
waitForUser(Message); wait(1); For other problems, in which stable interaction with mouse is needed, this macro (interactive flow diagram) may be helpful: http://www.zmbh.de/Central_Services/Imaging_Facility/2D_Imagej_Macros.html#M5
|
Free forum by Nabble | Edit this page |