I am running a macro on Fiji with the is("global scale") built-in function without any error on a MAC. However, when I run the same macro on the PC, I get an error message as shown in the attached image. A snippet of the macro is macro "Test" { if (!(is("global scale"))) { Dialog.create("ERROR"); Dialog.addMessage("Set Scale in MM (millimeters),\nand\ncheck Set Scale GLOBAL before ANALYSIS"); Dialog.show(); exit(); } } //end macro The message is Invalid argument in line 4 if (!(is("global scale" <)>)) What am I doing wrong here? Why does it work just fine on the Mac, but fails on a PC? Thanks Fatima |
> On Mar 9, 2017, at 6:05 PM, fmerchant <[hidden email]> wrote:
> > <http://imagej.1557.x6.nabble.com/file/n5018267/Fiji_error.png> > > I am running a macro on Fiji with the is("global scale") built-in function > without any error on a MAC. > However, when I run the same macro on the PC, I get an error message as > shown in the attached image. > > A snippet of the macro is > > macro "Test" { > > if (!(is("global scale"))) > { > Dialog.create("ERROR"); > Dialog.addMessage("Set Scale in MM (millimeters),\nand\ncheck Set Scale > GLOBAL before ANALYSIS"); > Dialog.show(); > exit(); > } > } //end macro > > The message is > > Invalid argument in line 4 > > if (!(is("global scale" <)>)) > > What am I doing wrong here? Why does it work just fine on the Mac, but fails > on a PC? The PC is probably running a version of ImageJ earlier than 1.50i, the version that added the is("global scale”) macro function. -wayne > -- > View this message in context: http://imagej.1557.x6.nabble.com/is-global-scale-not-working-on-Fiji-Macro-running-on-PC-tp5018267.html > Sent from the ImageJ mailing list archive at Nabble.com. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear All,
When I wrote the ImageJ (2.0.0-rc59/1.51j; java 1.8.0_66 [64-bit]) macro below, it return my area result as a string. Is this a bug or normal behaviour? List.setMeasurements; a = List.get("Area"); print(a); a = a / a; print(a); //will return an error message that say statement cannot begin with "/" Best Regards, John Confidentiality Notice: This e-mail and any attachments are only for the use of the intended recipient and may be confidential and/or privileged. If you are not the recipient, please delete it or notify the sender immediately. Please do not copy or use it for any purpose or disclose the contents to any other person as it may be an offence under the Official Secrets Act. ________________________________________ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi John,
the List in the ImageJ Macro language can only hold Strings, not numbers (maybe this is not perfectly clear from the description). You need parseFloat(a) to recover the number. Michael ________________________________________________________________ On 10/03/2017 12:07, LIM Soon Yew John wrote: > Dear All, > > When I wrote the ImageJ (2.0.0-rc59/1.51j; java 1.8.0_66 [64-bit]) > macro below, it return my area result as a string. Is this a bug or > normal behaviour? > > List.setMeasurements; a = List.get("Area"); print(a); a = a / a; > print(a); //will return an error message that say statement cannot > begin with "/" > > Best Regards, John -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Wayne Rasband-2
Wayne:
Thanks much! I did have an outdated version of Fiji on my PC. Thanks again, Fatima |
In reply to this post by Michael Schmid
You might also use a=List.getValue("Area"); instead.
Jerome. 2017-03-10 12:50 GMT+01:00 Michael Schmid <[hidden email]>: > Hi John, > > the List in the ImageJ Macro language can only hold Strings, not numbers > (maybe this is not perfectly clear from the description). You need > parseFloat(a) to recover the number. > > > Michael > ________________________________________________________________ > On 10/03/2017 12:07, LIM Soon Yew John wrote: > >> Dear All, >> >> When I wrote the ImageJ (2.0.0-rc59/1.51j; java 1.8.0_66 [64-bit]) >> macro below, it return my area result as a string. Is this a bug or >> normal behaviour? >> >> List.setMeasurements; a = List.get("Area"); print(a); a = a / a; >> print(a); //will return an error message that say statement cannot >> begin with "/" >> >> Best Regards, John >> > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- Jerome Mutterer CNRS - Institut de biologie moléculaire des plantes 12, rue du Général Zimmer 67084 Strasbourg Cedex www.ibmp.cnrs.fr -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |