using variables in a plugin numeric field

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

using variables in a plugin numeric field

shihj
Hi everyone,

I am currently writing a macro that calculates a certain threshold for a picture, and then uses the threshold value of each picture in the "Colocalization" plugin (http://rsbweb.nih.gov/ij/plugins/colocalization.html). So far, I have all the threshold values calculated and recorded in a Results table, but when I try to call these values up (using getResult("Threshold", 1)) to insert in the options string of the Colocalization function, it doesn't work. I looked at the source code of the Colocalization plugin, and the values that are required go into a numeric field. So the following line, as written, doesn't work at the threshold_channel_1 and threshold_channel_2 options:

run("Colocalization ", "channel_1=594-0001 channel_2=488-0001 ratio=50 threshold_channel_1=getResult("Threshold", 1) threshold_channel_2=getResult("Threshold", 6) display=255 colocalizated");

How do I get the options of a plugin to take variables?

Thanks for any help,
Jennifer
Reply | Threaded
Open this post in threaded view
|

Re: using variables in a plugin numeric field

David Webster
Jennifer,

I think your problen\m may be that the getResult() call is inside of
astring, that is surrounded by doube quotes. So, it is just being trated as
a string, not a method call. Try

run("Colocalization ", "channel_1=594-0001 channel_2=488-0001 ratio=50
threshold_channel_1="+getResult("Threshold", 1)+"
threshold_channel_2="+getResult("Threshold", 6)+" display=255
colocalizated");

This evaluates the getResult() calls then concatenates their return values
with the other quoted string values. (i.e. + is stringh concatenetation in
Java and the ImageJ macro language.

David

On Fri, Jan 22, 2010 at 12:36 PM, shihj <[hidden email]> wrote:

> Hi everyone,
>
> I am currently writing a macro that calculates a certain threshold for a
> picture, and then uses the threshold value of each picture in the
> "Colocalization" plugin
> (http://rsbweb.nih.gov/ij/plugins/colocalization.html). So far, I have all
> the threshold values calculated and recorded in a Results table, but when I
> try to call these values up (using getResult("Threshold", 1)) to insert in
> the options string of the Colocalization function, it doesn't work. I
> looked
> at the source code of the Colocalization plugin, and the values that are
> required go into a numeric field. So the following line, as written,
> doesn't
> work at the threshold_channel_1 and threshold_channel_2 options:
>
> run("Colocalization ", "channel_1=594-0001 channel_2=488-0001 ratio=50
> threshold_channel_1=getResult("Threshold", 1)
> threshold_channel_2=getResult("Threshold", 6) display=255 colocalizated");
>
> How do I get the options of a plugin to take variables?
>
> Thanks for any help,
> Jennifer
> --
> View this message in context:
> http://n2.nabble.com/using-variables-in-a-plugin-numeric-field-tp4442333p4442333.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: using variables in a plugin numeric field

shihj
Thank you, David! Worked like a charm!