Question about the plugin Calculator Plus

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

Question about the plugin Calculator Plus

NatashaW
Dear all,
I'm working on this macro to correct the images that I got them from a fluorescence microscope, and I need some help please:

*******************
dirX = getDirectory("Choose the dark reference folder");
listX = getFileList(dirX + "/");
X=listX[0];
open(dirX + X);

dirY = getDirectory("Choose H2AX image folder ");
listY = getFileList(dirY+"/");
Y = listY[0];
open(dirY + Y);

run("Calculator Plus", "i1=X i2=Y operation=[Subtract: i2 = (i1-i2) x k1 + k2] k1=1 k2=0 create");
*******************
The plugin didn't accept i1=X and i2=Y as inputs in this form "i1=X i2=Y ...
 (I think the reason is the quotations when I read the X and Y but I'm not sure) and I didn't arrive to correct it..?

Anyone could help me?
Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Question about the plugin Calculator Plus

Paul Grimm-2
i ran your code on my macintosh and it performed perfectly after I took out the return changing ...

[Subtract: i2 = (i1-i2) x k1 +
k2] k1=1 k2=0 create");
to
[Subtract: i2 = (i1-i2) x k1 + k2] k1=1 k2=0 create");
--


Paul C. Grimm
Professor of Pediatrics
Dept of Pediatric Nephrology
Lucile Packard Children's Hospital
Stanford University School of Medicine
G306, MC 5208
300 Pasteur Drive
Stanford, CA 94305-5208
USA

phone   650-723-7903
fax       650-498-6714

"The gem cannot be polished without friction, nor man perfected without trials”
-Chinese Proverb
 


On Apr 17, 2010, at 1:22 PM, NatashaW wrote:

> Dear all,
> I'm working on this macro to correct the images that I got them from a
> fluorescence microscope, and I need some help please:
>
> *******************
> dirX = getDirectory("Choose the dark reference folder");
> listX = getFileList(dirX + "/");
> X=listX[0];
> open(dirX + X);
>
> dirY = getDirectory("Choose H2AX image folder ");
> listY = getFileList(dirY+"/");
> Y = listY[0];
> open(dirY + Y);
>
> run("Calculator Plus", "i1=X i2=Y operation=[Subtract: i2 = (i1-i2) x k1 +
> k2] k1=1 k2=0 create");
> *******************
> The plugin didn't accept i1=X and i2=Y as inputs in this form "i1=X i2=Y ...
> (I think the reason is the quotations when I read the X and Y but I'm not
> sure) and I didn't arrive to correct it..?
>
> Anyone could help me?
> Thank you
> --
> View this message in context: http://n2.nabble.com/Question-about-the-plugin-Calculator-Plus-tp4918748p4918748.html
> Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Question about the plugin Calculator Plus

Gabriel Landini
The problem in the code posted is that the variable names should be outside
the quotations:

Instead of:
> > run("Calculator Plus", "i1=X i2=Y operation=[Subtract: i2 = (i1-i2) x k1
> > + k2] k1=1 k2=0 create");

it should be something like:

run("Calculator Plus", "i1="+X+" i2="+Y+" operation=[Subtract: i2 = (i1-i2) x
k1 + k2] k1=1 k2=0 create");

or add an ampersand prefix to get the variables' values in the quoted string:

run("Calculator Plus", "i1=&X i2=&Y operation=[Subtract: i2 = (i1-i2) x k1 +
k2] k1=1 k2=0 create");

all in one line, obviously.

Cheers,
G.
Reply | Threaded
Open this post in threaded view
|

Re: Question about the plugin Calculator Plus

NatashaW
In reply to this post by Paul Grimm-2
Hello,

Indeed, what I want to do is to control the values of i1 and i2 as I want
I need that in the rest of my code, so how can I tell him to subtract an image "X" from another image "Y" or whatever image?
I think the plugin Calculator Plus takes the values of i1 and i2 from a predefined list (which is the IDList)
Maybe I should work with stacks or change something in the plugin code ??

I'm waiting your suggestions..
Thanks