User interactive macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

User interactive macro

Soriano.Joaquim
HI everyone,

I would like to record a macro by using the macro recorder.

Such macro should start, pause to allow the user  to draw a selection, then the macro should continue, pause again to allow the user to set a threshold and continue to its end.

The question is: is it possible for a Macro to perform such pauses? How can I do that?

Thank you very much in advance and thanks to the people who encouraged me to learn java and recommended me learning materials. I'm working on it.

 

Joaquim Soriano Felipe.

Confocal Microscopy Unit

Spanish National Cancer Research Centre (CNIO)

Melchor Fernández Almagro,3, E-28029 Madrid, Spain

Phone  + 34 917 328 000, exts.: 3161, 3162. [hidden email] <mailto:[hidden email]>

 



**NOTA DE CONFIDENCIALIDAD** Este correo electrÿnico, y en su caso los ficheros adjuntos, pueden contener informaciÿn protegida para el uso exclusivo de su destinatario. Se prohÿbe la distribuciÿn, reproducciÿn o cualquier otro tipo de transmisiÿn por parte de otra persona que no sea el destinatario. Si usted recibe por error este correo, se ruega comunicarlo al remitente y borrar el mensaje recibido.
**CONFIDENTIALITY NOTICE** This email communication and any attachments may contain confidential and privileged information for the sole use of the designated recipient named above. Distribution, reproduction or any other use of this transmission by any party other than the intended recipient is prohibited. If you are not the intended recipient please contact the sender and delete all copies.


Reply | Threaded
Open this post in threaded view
|

Re: User interactive macro

Michael Schmid
Hi Joaquim,

see the documentation of the macro functions. The waitForUser  
function is designed for that purpose.

http://rsb.info.nih.gov/ij/developer/macro/functions.html#W

After waitForUser, you can also check with selectionType() whether  
the selection exists and is suitable (e.g., a line selection, no line  
selection, etc.)

Michael
________________________________________________________________

On 7 Sep 2010, at 10:24, Soriano.Joaquim wrote:

> HI everyone,
>
> I would like to record a macro by using the macro recorder.
>
> Such macro should start, pause to allow the user  to draw a  
> selection, then the macro should continue, pause again to allow the  
> user to set a threshold and continue to its end.
>
> The question is: is it possible for a Macro to perform such pauses?  
> How can I do that?
>
> Thank you very much in advance and thanks to the people who  
> encouraged me to learn java and recommended me learning materials.  
> I'm working on it.
>
>
>
> Joaquim Soriano Felipe.
Reply | Threaded
Open this post in threaded view
|

Re: User interactive macro

Carles Rentero-2
In reply to this post by Soriano.Joaquim
Hola Joaquin,
the best way (as far as I know) to do that is to use the 'waitForUser'  
function. A couple of examples are:

setTool("rectangle");
run("Select None");
waitForUser("Select areas","Select the area to analyze and click 'OK'");
getSelectionBounds(x,y,width,height);

and:

run("Threshold...");
waitForUser("Set mask","Threshold set?");
getThreshold(lower,upper);

I hope it will help. Best regards,
Carles.

--
Carles Rentero, PhD
Dept. de Biologia Cel·lular, Immunologia i Neurociències
Institut d'Investigacions Biomèdiques August Pi i Sunyer (IDIBAPS)
Facultat de Medicina - Hospital Clínic de Barcelona
Universitat de Barcelona (UB)

c/ Casanova, 143
08036 Barcelona
SPAIN

phone: +34 93 227 5400 ext. 3358
FAX: +34 93 402 1907


"Soriano.Joaquim" <[hidden email]> ha escrit:

> HI everyone,
>
> I would like to record a macro by using the macro recorder.
>
> Such macro should start, pause to allow the user  to draw a  
> selection, then the macro should continue, pause again to allow the  
> user to set a threshold and continue to its end.
>
> The question is: is it possible for a Macro to perform such pauses?  
> How can I do that?
>
> Thank you very much in advance and thanks to the people who  
> encouraged me to learn java and recommended me learning materials.  
> I'm working on it.
>
>
>
> Joaquim Soriano Felipe.
>
> Confocal Microscopy Unit
>
> Spanish National Cancer Research Centre (CNIO)
>
> Melchor Fernández Almagro,3, E-28029 Madrid, Spain
>
> Phone  + 34 917 328 000, exts.: 3161, 3162. [hidden email]  
> <mailto:[hidden email]>
>
>
>
>
>
> **NOTA DE CONFIDENCIALIDAD** Este correo electrÿnico, y en su caso  
> los ficheros adjuntos, pueden contener informaciÿn protegida para el  
> uso exclusivo de su destinatario. Se prohÿbe la distribuciÿn,  
> reproducciÿn o cualquier otro tipo de transmisiÿn por parte de otra  
> persona que no sea el destinatario. Si usted recibe por error este  
> correo, se ruega comunicarlo al remitente y borrar el mensaje  
> recibido.
> **CONFIDENTIALITY NOTICE** This email communication and any  
> attachments may contain confidential and privileged information for  
> the sole use of the designated recipient named above. Distribution,  
> reproduction or any other use of this transmission by any party  
> other than the intended recipient is prohibited. If you are not the  
> intended recipient please contact the sender and delete all copies.
>
>
>