can I set numeric value to variable?

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

can I set numeric value to variable?

Sahar Vilan
Hello,

I'm new to ImageJ and I try to write a simple macro to open raw image.

It works with fixed values (1) but not with variables (2).

1)       run("Raw...", "(open image=[16-bit Unsigned] width=3072 height=3072
offset=0 number=1 gap=0 little-endian");
         OK!

2)       w = 3072;
run("Raw...", "(open image=[16-bit Unsigned] width=w height=3072 offset=0
number=1 gap=0 little-endian");
         ERROR!

Can anyone help me with this?

Thanks,
Sahar Vilan




*******************************************************************************************************

This e-mail message may contain confidential,and  privileged information or data that constitute proprietary information of CMT Medical Ltd. Any review or distribution by others is strictly prohibited. If you are not the intended recipient you are hereby notified that any use of this information or data by any other person is absolutely prohibited. If you are not the intended recipient, please delete all copies. Thank You. http://www.cmt.co.il

********************************************************************************************************





 
 
************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: can I set numeric value to variable?

Michael Doube
Hello Sahar,

You have to break the string with this concatenation syntax

"string" -> "st"+variable+"ring

will put the contents of 'variable' between "st" and "ring".

 > 2)       w = 3072;
 > run("Raw...", "(open image=[16-bit Unsigned] width="+w+" height=3072
offset=0


The new string is then passed to the function.

Mike