So i have recently added an if command (which i have done before without hiccough) to a macro
I now get an error later in the macro saying : ';' expected in line 132. <roiManager> ("Add"); line 132 and every other line has a semi colon already so i don't get it. Thanks in advance Andy Flett |
<roiManager> ("Add");
Did you put brackets around roiManager or did the error message put brackets around roiManager? If you put the brackets around roiManager, then that is probably your problem. Also, it would help if you gave us the if statement that you added. Make sure that you didn't capitalize the if statement.
|
In reply to this post by flettster
On 6/28/11 7:32 PM, flettster wrote:
> So i have recently added an if command (which i have done before without > hiccough) to a macro > > I now get an error later in the macro saying : > > ';' expected in line 132. > > <roiManager> ("Add"); > > line 132 and every other line has a semi colon already so i don't get it. > Check the previous line for an error (maybe a colon instead of semicolon, or extra character. --aryeh -- Aryeh Weiss School of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 |
So
The brackets were put in by the error message. There are no preceeding erroneous colons etc. I have finetoothed it and all appears well. I have not capitalised the if command. It is bascially if(var==1){ Dialog.create() Then 3 simple dialog commands to define a variable } There are then 100 lines of macro before this expected ; I don't get it! |
On Wednesday 29 Jun 2011 07:36:58 you wrote:
> The brackets were put in by the error message. > > There are no preceeding erroneous colons etc. I have finetoothed it and all > appears well. > > I have not capitalised the if command. It is bascially > if(var==1){ > Dialog.create() > > Then 3 simple dialog commands to define a variable > } > > There are then 100 lines of macro before this expected ; > > I don't get it! You missed a ";" after the Dialog.create(): Dialog.create(); Cheers G. |
I wish it was that simple!
I just didnt write it in the board post but it is there in the macro Basically - every single line of text has got a ; after it. Andy |
On Wednesday 29 Jun 2011 11:54:15 you wrote:
> I wish it was that simple! > I just didnt write it in the board post but it is there in the macro > Basically - every single line of text has got a ; after it. Some lines do not require it. Unless you post the macro, there is little chance of anybody being able to imagine precisely what you have done. Cheers, Gabriel |
In reply to this post by flettster
The macro works fine without the following code in it. This is lines 10-22.
the error message refers to line 132! Dialog.create("pre/post"); prepost = newArray("Pre", "Post", "5", "10", "15","Other"); Dialog.addChoice("Time post contrast", prepost); Dialog.show(); prepost=Dialog.getChoice(); if (prepost=="Other") { Dialog.create("Time"); Dialog.addMessage("Please enter the Time"); Dialog.addMessage("(Enter the time relative)"); Dialog.addString("Number",1); Dialog.show(); prepost = Dialog.getString(); } |
You can't break a line like this:
if (prepost=="Other") { Dialog.create("Time"); It should be in one line: if (prepost=="Other") {Dialog.create("Time"); Hope this helps! Zoltan -- Dr. Zoltan Cseresnyes Confocal and 2-Photon Microscopy Core Facility (MCF) Max-Delbrück-Center for Molecular Medicine Robert-Rössle-Str. 10 13125 Berlin phone: +49 (0)30 94062734 email: [hidden email] http://www.mdc-berlin.de/en/research/core_facilities/index.html -----Original Message----- From: ImageJ Interest Group on behalf of flettster Sent: Wed 6/29/2011 13:28 To: [hidden email] Subject: Re: Error - cant get around! Expected ; The macro works fine without the following code in it. This is lines 10-22. the error message refers to line 132! Dialog.create("pre/post"); prepost = newArray("Pre", "Post", "5", "10", "15","Other"); Dialog.addChoice("Time post contrast", prepost); Dialog.show(); prepost=Dialog.getChoice(); if (prepost=="Other") { Dialog.create("Time"); Dialog.addMessage("Please enter the Time"); Dialog.addMessage("(Enter the time relative)"); Dialog.addString("Number",1); Dialog.show(); prepost = Dialog.getString(); } -- View this message in context: http://imagej.588099.n2.nabble.com/Error-cant-get-around-Expected-tp6525588p6528552.html Sent from the ImageJ mailing list archive at Nabble.com. |
In reply to this post by flettster
On 6/29/11 2:28 PM, flettster wrote:
> The macro works fine without the following code in it. This is lines 10-22. > > the error message refers to line 132! > > > > Dialog.create("pre/post"); > prepost = newArray("Pre", "Post", "5", "10", "15","Other"); > Dialog.addChoice("Time post contrast", prepost); > Dialog.show(); > prepost=Dialog.getChoice(); > > if (prepost=="Other") { > Dialog.create("Time"); > Dialog.addMessage("Please enter the Time"); > Dialog.addMessage("(Enter the time relative)"); > Dialog.addString("Number",1); > Dialog.show(); > prepost = Dialog.getString(); > } > > Your code will work if you add a close parenthesis in your make polygon command: makePolygon(x2,y2,x2-(2*(cos(theta-(4*pi/3))*x2)),y2-(2*(sin(theta-(4*pi/3)))*y2),x2-(2*(cos(theta-(3*pi/3))*x2)),y2-(2*(sin(theta-(3*pi/3)))*y2)); In the macro you sent you were missing a ) in the makePolygon (also in the next one). Probably you cut and pasted, and lost the ). --aryeh -- Aryeh Weiss School of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 |
In reply to this post by flettster
Hi Dr Flett,
On Wed, 29 Jun 2011, flettster wrote: > The macro works fine without the following code in it. This is lines 10-22. > > the error message refers to line 132! > > > > Dialog.create("pre/post"); > prepost = newArray("Pre", "Post", "5", "10", "15","Other"); > Dialog.addChoice("Time post contrast", prepost); > Dialog.show(); > prepost=Dialog.getChoice(); > > if (prepost=="Other") { > Dialog.create("Time"); > Dialog.addMessage("Please enter the Time"); > Dialog.addMessage("(Enter the time relative)"); > Dialog.addString("Number",1); > Dialog.show(); > prepost = Dialog.getString(); > } Unsurprisingly, this code works well. I think when Gabriel referred to the source code, he meant to say: unless you send the complete macro so that people who are experts at macro programming can reproduce the error and teach you how to fix it. The only alternative to providing the complete source code would be a tedious back and forth of emails which would soon stop being funny for those who you ask to help. Hth, Johannes |
In reply to this post by Aryeh Weiss
Many thanks all
Apologies about my lack of helpful information - i should have posted the entire macro from the start but was trying to keep it simply I have learnt my lesson humbly The macro now works - thank you Andy |
In reply to this post by Cseresnyes, Zoltan
Hi,
On Wed, 29 Jun 2011, Cseresnyes, Zoltan wrote: > You can't break a line like this: > > if (prepost=="Other") { > Dialog.create("Time"); > > It should be in one line: > > if (prepost=="Other") {Dialog.create("Time"); You can break a line like this. Just try this little snippet: if (1 == 1) { write("Hi"); } Ciao, Johannes |
True, I didn't read the entire command. Actually, the snippet lastly posted by the original poster (lines 10-22) runs just fine as it is. We need indeed to see the whole macro!
Zoltan -----Original Message----- From: Johannes Schindelin [mailto:[hidden email]] Sent: Wed 6/29/2011 14:58 To: Cseresnyes, Zoltan Cc: [hidden email] Subject: Re: Error - cant get around! Expected ; Hi, On Wed, 29 Jun 2011, Cseresnyes, Zoltan wrote: > You can't break a line like this: > > if (prepost=="Other") { > Dialog.create("Time"); > > It should be in one line: > > if (prepost=="Other") {Dialog.create("Time"); You can break a line like this. Just try this little snippet: if (1 == 1) { write("Hi"); } Ciao, Johannes |
In reply to this post by dscho
I am starting to use the Advanced Weka Segmentation plugins, which are
proving to be very interesting. Two issues have come up when using them in macros. 1. there is some timing issue. Consider the following code: run("Advanced Weka Segmentation"); wait(3000); //Without this wait statement, the following statements will fail and return segmentation faults. call("trainableSegmentation.Weka_Segmentation.setFeature", "Variance=true"); call("trainableSegmentation.Weka_Segmentation.setFeature", "Mean=true"); call("trainableSegmentation.Weka_Segmentation.setFeature", "Maximum=true"); call("trainableSegmentation.Weka_Segmentation.setFeature", "Gabor=true"); 2. If I do the following: call("trainableSegmentation.Weka_Segmentation.trainClassifier"); then the segmentation will occur. However, a number buttons will be grayed out. I will lose "Get Probability", "Apply Classifier", and "Save Classifier". On the other hand, if I do the trainClassifier by manually clickingon "Train Classifier", then it does the segmentation and leaves all the other things functional. Yet the macro recorder records that very command call("trainableSegmentation.Weka_Segmentation.trainClassifier"); when I do it by hand. Since I am trying to automate my procedures as much as possible, any help with this second issue would be greatly appreciated. --aryeh -- Aryeh Weiss School of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 |
Very interesting, Aryeh. I guess it's a problem with my multi-threading. Let
me have a look and i will be back to you. Thanks for reporting! ignacio On Wed, Jun 29, 2011 at 3:28 PM, Aryeh Weiss <[hidden email]> wrote: > I am starting to use the Advanced Weka Segmentation plugins, which are > proving to be very interesting. > > Two issues have come up when using them in macros. > > 1. there is some timing issue. Consider the following code: > > run("Advanced Weka Segmentation"); > > wait(3000); //Without this wait statement, the following statements will > fail and return segmentation faults. > > call("trainableSegmentation.**Weka_Segmentation.setFeature", > "Variance=true"); > call("trainableSegmentation.**Weka_Segmentation.setFeature", "Mean=true"); > call("trainableSegmentation.**Weka_Segmentation.setFeature", > "Maximum=true"); > call("trainableSegmentation.**Weka_Segmentation.setFeature", > "Gabor=true"); > > 2. If I do the following: > > call("trainableSegmentation.**Weka_Segmentation.**trainClassifier"); > > then the segmentation will occur. However, a number buttons will be grayed > out. I will lose "Get Probability", "Apply Classifier", and "Save > Classifier". > > On the other hand, if I do the trainClassifier by manually clickingon > "Train Classifier", then it does the segmentation and leaves all the other > things functional. Yet the macro recorder records that very command > call("trainableSegmentation.**Weka_Segmentation.**trainClassifier"); > when I do it by hand. > > Since I am trying to automate my procedures as much as possible, any help > with this second issue would be greatly appreciated. > > --aryeh > -- > Aryeh Weiss > School of Engineering > Bar Ilan University > Ramat Gan 52900 Israel > > Ph: 972-3-5317638 > FAX: 972-3-7384051 > -- Ignacio Arganda-Carreras, Ph.D. Seung's lab, 46-5065 Department of Brain and Cognitive Sciences Massachusetts Institute of Technology 43 Vassar St. Cambridge, MA 02139 USA Phone: (001) 617-452-4976 Website: http://bioweb.cnb.csic.es/~iarganda/index_EN.html |
Oh! Neat! I can't wait to try your new plugin .
|
In reply to this post by Ignacio Arganda-Carreras
Hello again Aryeh,
I just fixed the second problem you mentioned, which was indeed a bug. You can find the new version of the plugin by updating Fiji. Regarding the first issue, it looks like a problem from the way ImageJ loads the classes from the macros. Still working on it. Best regards, ignacio On Wed, Jun 29, 2011 at 5:36 PM, Ignacio Arganda-Carreras < [hidden email]> wrote: > Very interesting, Aryeh. I guess it's a problem with my multi-threading. > Let me have a look and i will be back to you. Thanks for reporting! > > ignacio > > > On Wed, Jun 29, 2011 at 3:28 PM, Aryeh Weiss <[hidden email]> wrote: > >> I am starting to use the Advanced Weka Segmentation plugins, which are >> proving to be very interesting. >> >> Two issues have come up when using them in macros. >> >> 1. there is some timing issue. Consider the following code: >> >> run("Advanced Weka Segmentation"); >> >> wait(3000); //Without this wait statement, the following statements will >> fail and return segmentation faults. >> >> call("trainableSegmentation.**Weka_Segmentation.setFeature", >> "Variance=true"); >> call("trainableSegmentation.**Weka_Segmentation.setFeature", >> "Mean=true"); >> call("trainableSegmentation.**Weka_Segmentation.setFeature", >> "Maximum=true"); >> call("trainableSegmentation.**Weka_Segmentation.setFeature", >> "Gabor=true"); >> >> 2. If I do the following: >> >> call("trainableSegmentation.**Weka_Segmentation.**trainClassifier"); >> >> then the segmentation will occur. However, a number buttons will be grayed >> out. I will lose "Get Probability", "Apply Classifier", and "Save >> Classifier". >> >> On the other hand, if I do the trainClassifier by manually clickingon >> "Train Classifier", then it does the segmentation and leaves all the other >> things functional. Yet the macro recorder records that very command >> call("trainableSegmentation.**Weka_Segmentation.**trainClassifier"); >> when I do it by hand. >> >> Since I am trying to automate my procedures as much as possible, any help >> with this second issue would be greatly appreciated. >> >> --aryeh >> -- >> Aryeh Weiss >> School of Engineering >> Bar Ilan University >> Ramat Gan 52900 Israel >> >> Ph: 972-3-5317638 >> FAX: 972-3-7384051 >> > > > > -- > Ignacio Arganda-Carreras, Ph.D. > Seung's lab, 46-5065 > Department of Brain and Cognitive Sciences > Massachusetts Institute of Technology > 43 Vassar St. > Cambridge, MA 02139 > USA > > Phone: (001) 617-452-4976 > Website: http://bioweb.cnb.csic.es/~iarganda/index_EN.html > > -- Ignacio Arganda-Carreras, Ph.D. Seung's lab, 46-5065 Department of Brain and Cognitive Sciences Massachusetts Institute of Technology 43 Vassar St. Cambridge, MA 02139 USA Phone: (001) 617-452-4976 Website: http://bioweb.cnb.csic.es/~iarganda/index_EN.html |
On 6/30/11 11:30 PM, Ignacio Arganda-Carreras wrote:
> Hello again Aryeh, > > I just fixed the second problem you mentioned, which was indeed a bug. > You can find the new version of the plugin by updating Fiji. > > Regarding the first issue, it looks like a problem from the way ImageJ > loads the classes from the macros. Still working on it. Hi Ignacio, Thank you for your attention to this. I updated Fiji and ran the new Weka. However, now I am getting and error in updating the feature stack. Here is the log output: Creating feature stack... Updating features of slice number 1... Error when updating feature stack. Feature stack was not updated. The traning did not finish. This appears to be unrelated to the macro, since it occurred when I ran Weka standalone. Best regards, --aryeh > On Wed, Jun 29, 2011 at 5:36 PM, Ignacio Arganda-Carreras > <[hidden email] <mailto:[hidden email]>> wrote: > > Very interesting, Aryeh. I guess it's a problem with my > multi-threading. Let me have a look and i will be back to you. > Thanks for reporting! > > ignacio > > > On Wed, Jun 29, 2011 at 3:28 PM, Aryeh Weiss <[hidden email] > <mailto:[hidden email]>> wrote: > > I am starting to use the Advanced Weka Segmentation plugins, > which are proving to be very interesting. > > Two issues have come up when using them in macros. > > 1. there is some timing issue. Consider the following code: > > run("Advanced Weka Segmentation"); > > wait(3000); //Without this wait statement, the following > statements will fail and return segmentation faults. > > call("trainableSegmentation.__Weka_Segmentation.setFeature", > "Variance=true"); > call("trainableSegmentation.__Weka_Segmentation.setFeature", > "Mean=true"); > call("trainableSegmentation.__Weka_Segmentation.setFeature", > "Maximum=true"); > call("trainableSegmentation.__Weka_Segmentation.setFeature", > "Gabor=true"); > > 2. If I do the following: > > call("trainableSegmentation.__Weka_Segmentation.__trainClassifier"); > > then the segmentation will occur. However, a number buttons will > be grayed out. I will lose "Get Probability", "Apply > Classifier", and "Save Classifier". > > On the other hand, if I do the trainClassifier by manually > clickingon "Train Classifier", then it does the segmentation and > leaves all the other things functional. Yet the macro recorder > records that very command > call("trainableSegmentation.__Weka_Segmentation.__trainClassifier"); > when I do it by hand. > > Since I am trying to automate my procedures as much as possible, > any help with this second issue would be greatly appreciated. > > --aryeh > -- > -- Aryeh Weiss School of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 |
Free forum by Nabble | Edit this page |