Marcos - passing on measures to varibles in the same macro

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

Marcos - passing on measures to varibles in the same macro

Roger_Kemp
Hello,

I would like to use the doWand command in a macro on the centre of an image, but I will not know the co-ords of the centre so I would like to run a measurement to find the centroid co-ordinates and pass the values on to a varible to use later on in the same macro.

is this possible? and if so how?

thanks in advance

Roger
Reply | Threaded
Open this post in threaded view
|

Re: Marcos - passing on measures to varibles in the same macro

Michael Schmid
Hi Roger,

have a look at the descriptions of the macro language, especially the  
functions:
   http://rsb.info.nih.gov/ij/developer/macro/functions.html

You need no measurement for the center of an image:

tolerance = 0; //or whatever you like
doWand(getWidth()/2, getHeight()/2, tolerance, "8-connected")

If you don't want the geometrical center of the image, but really  
need the result of a measurement, use the getResult("Column", row)  
command.


Michael
________________________________________________________________

On 23 Jun 2010, at 15:12, Roger_Kemp wrote:

> Hello,
>
> I would like to use the doWand command in a macro on the centre of  
> an image,
> but I will not know the co-ords of the centre so I would like to run a
> measurement to find the centroid co-ordinates and pass the values  
> on to a
> varible to use later on in the same macro.
>
> is this possible? and if so how?
>
> thanks in advance
>
> Roger
Reply | Threaded
Open this post in threaded view
|

Re: Marcos - passing on measures to varibles in the same macro

Carles Rentero-2
In reply to this post by Roger_Kemp
Hi Roger,
just a simple approach that could work: 'getHeight' and 'getWidth'  
will give you the height & width in pixels of the image. From here,  
1/2 of each of them will give you the center of image (use Round(n)  
for odd values).

Hope it helps!!
Carles.

--
Carles Rentero
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


Roger_Kemp <[hidden email]> ha escrit:

> Hello,
>
> I would like to use the doWand command in a macro on the centre of an image,
> but I will not know the co-ords of the centre so I would like to run a
> measurement to find the centroid co-ordinates and pass the values on to a
> varible to use later on in the same macro.
>
> is this possible? and if so how?
>
> thanks in advance
>
> Roger
> --
> View this message in context:  
> http://imagej.588099.n2.nabble.com/Marcos-passing-on-measures-to-varibles-in-the-same-macro-tp5213176p5213176.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>