Dear all
I have just combined 2 of my macros which work fine by themselves. Since joining them when i run it it says ; expected in line 324. There is clearly a ; present however. Would very much appreciate some help if you can figure out whats going on! Thanks Andy |
Here is the txt.
run("Set Measurements...", "area mean standard min display redirect=None decimal=6"); run("Colors...", "foreground=black background=black selection=yellow"); dir = getDirectory("image"); calw = getWidth(); calh = getHeight(); name = getTitle; dotIndex = indexOf(name, "."); underscoreindex = indexOf(name, "_") Dim = substring(name, 2, dotIndex); x = substring(name, 0, underscoreindex) run("Scale...", "x=3 y=3 interpolate create title=preimage.raw"); preimage = getImageID() wait(40) ID = getImageID(); run("Window/Level..."); run("Enhance Contrast", "saturated=0.5"); run("Enhance Contrast", "saturated=0.5"); run("Enhance Contrast", "saturated=0.5"); setTool(0); makeRectangle(160, 210, 150, 150); waitForUser("Draw LV region"); run("Crop"); scwidth = 0.005 * screenWidth scheight = 0.25 * screenHeight setLocation(scwidth, scheight) run("In"); run("In"); run("Duplicate...", "title=Working.TIF"); working = getImageID() run("8-bit") wscwidth = 0.5 * screenWidth wscheight = 0.25 * screenHeight setLocation (wscwidth, wscheight) run("In"); run("In"); run("Window/Level..."); run("Enhance Contrast", "saturated=0.5"); height = 0.45 * getHeight() width = 0.5 * getWidth() setTool(3); setAutoThreshold("Percentile dark"); waitForUser("Refine threshold"); setTool(8); doWand(height,width); resetThreshold(); setTool(10); run("Enhance Contrast", "saturated=0.5"); waitForUser("Correct endocardium"); run("Clear"); run("Add to Manager "); roiManager("Select", 0); roiManager("Rename", "Endo"); setTool(3); run("Enhance Contrast", "saturated=0.5"); waitForUser("Draw epicardium"); wait(60) run("Clear Outside"); run("Add to Manager "); roiManager("Select", 1); roiManager("Rename", "Epi"); setOption("Show All",true); roiManager("Select", 1); setTool(10); run("ROI Manager..."); selectImage(ID) setOption("Show All",true); selectWindow("Working.TIF") setTool(10); setOption("Show All",true); setAutoThreshold(); waitForUser("Correct endo, epicardium"); roiManager("update"); selectWindow("Working.TIF") roiManager("Select", 0); wait(60) run("Clear"); roiManager("Select", 1); wait(60) run("Clear Outside"); setTool(3); resetThreshold(); roiManager("Deselect"); run("Enhance Contrast", "saturated=0.5"); Dialog.create("T2?"); Dialog.addMessage("Do you wish to run T2 analysis?"); Dialog. addCheckbox("Yes", true); Dialog.show(); LGEpos = Dialog.getCheckbox(); if (LGEpos==1) { waitForUser("Please carefully draw T2 enhanced area manually"); run("Add to Manager "); roiManager("select",2); roiManager("Rename", "man"); roiManager("Measure"); max1 = getResult("Max"); selectImage(ID); setOption("Show All",true); setTool(3); selectWindow("Working.TIF"); FWHM1 = 0.5 * max1; setThreshold(FWHM1,1000000); wait(30); run("Threshold..."); run("Create Selection"); waitForUser("Remove artifact (FWHM 1st pass)"); selectWindow("Working.TIF"); run("Measure"); max2 = getResult("Max"); FWHM2 = 0.5 * max2; setThreshold(FWHM2,1000000); wait(30); run("Threshold..."); run("Create Selection"); waitForUser("Remove artifact (FWHM final)"); run("Add to Manager "); wait(30); roiManager("Select", 3); roiManager("Rename", "FWHM"); roiManager("Deselect"); run("Create Selection"); directory = getDirectory("temp"); roiManager("Save", directory+"Temp.zip"); roiManager("Select", 2); roiManager("Delete"); roiManager("Select", 2); roiManager("Delete"); roiManager("Deselect"); roiManager("XOR"); setAutoThreshold("Otsu dark"); run("Create Selection"); waitForUser("Remove artifact (OTSU)"); roiManager("Deselect"); roiManager("Delete"); roiManager("Open", directory+"Temp.zip"); run("Add to Manager "); roiManager("Select", 4); roiManager("Rename", "OTSU"); roiManager("Save", directory+"Temp.zip"); roiManager("Select", 2); roiManager("Delete"); roiManager("Select", 2); roiManager("Delete"); roiManager("Select", 2); roiManager("Delete"); roiManager("Deselect"); roiManager("XOR"); setAutoThreshold("Huang dark"); run("Create Selection"); waitForUser("Remove artifact (Huang)"); roiManager("Deselect") roiManager("Delete") roiManager("Open", directory+"Temp.zip"); run("Add to Manager "); roiManager("Select", 5); roiManager("Rename", "Huang"); resetThreshold(); roiManager("Deselect"); roiManager("Show None"); run("Select None"); setTool(3); waitForUser("please draw remote myocardium"); run("Add to Manager "); roiManager("Select", 6); roiManager("Rename", "Remote"); run("Measure"); SD = getResult("StdDev"); Mean = getResult("Mean"); max = getResult("Max"); t2=100000; t5= 3*SD + Mean; setThreshold(t5,t2); run("Threshold..."); run("Create Selection"); setTool(10); waitForUser("Remove artifacts (3SD)"); run("Add to Manager "); run("ROI Manager..."); setOption("Show All",true); resetThreshold(); roiManager("Select", 7); roiManager("Rename", "3SD"); t6= 2*SD + Mean; setThreshold(t6,t2); run("Threshold..."); run("Create Selection"); setTool(10); waitForUser("Remove artifacts (2SD)"); run("Add to Manager "); run("ROI Manager..."); setOption("Show All",true); resetThreshold(); roiManager("Select", 8); roiManager("Rename", "2SD"); setOption("Show All",true); roiManager("Select", 0); roiManager("Measure"); roiManager("Select", 1); roiManager("Measure"); roiManager("Select", 2); roiManager("Measure"); roiManager("Select", 3); roiManager("Measure"); roiManager("Select", 4); roiManager("Measure"); roiManager("Select", 5); roiManager("Measure"); roiManager("Select", 6); roiManager("Measure"); roiManager("Select", 7); roiManager("Measure"); roiManager("Select", 8); roiManager("Measure"); roiManager("Deselect"); updateResults(); String.copyResults(); waitForUser("Finished with thresholds?"); selectWindow("ROI Manager"); roiManager("Save", dir+"RoiSet"+x+"TH"+".zip"); selectWindow("preimage.raw"); saveAs("tiff", dir+"preimage"+x); selectWindow("Working.TIF"); saveAs("tiff", dir+"Working"+x); roiManager("Select", 3); roiManager("Delete"); roiManager("Select", 3); roiManager("Delete"); roiManager("Select", 3); roiManager("Delete"); roiManager("Select", 3); roiManager("Delete"); roiManager("Select", 3); roiManager("Delete"); roiManager("Select", 3); roiManager("Delete"); roiManager("Select", 0); getSelectionBounds(xini1,yini1,rubbish,rubbish2); roiManager("Show All"); roiManager("Show None"); roiManager("Show All"); roiManager("UseNames", "true"); setTool("point"); waitForUser("Please identify superior RV insertion point"); getSelectionBounds(xini,yini,rubbish,rubbish2); roiManager("select", newArray(0,1)); roiManager("XOR"); run("Add to Manager "); roiManager("Select", 3); roiManager("Rename", "Epi-Endo"); roiManager("Select", 1); getSelectionBounds(xini2,yini2,rubbish,rubbish2); x1=xini-xini2; y1=yini-yini2; x3=xini1-xini2; y3=yini1-yini2; run("Duplicate...", "title=working.raw"); run("In"); run("In"); run("In"); run("In"); roiManager("Select", 3); setSelectionLocation(0, 0); roiManager("Update"); roiManager("Select", 0); setSelectionLocation(x3, y3); roiManager("Update"); roiManager("Select", 1); setSelectionLocation(0, 0); roiManager("Update"); getSelectionBounds(x,y,width,height); x2=0.5*width; y2=0.5*height; theta2=asin((y2-y1)/y2); theta=acos(((x2-x1)/x2)); pi=3.14159265358932384626; makePolygon(x2-(2*(cos(theta)*x2)),y2-(2*(sin(theta)*y2)),x2,y2,x2-(2*(cos(theta+(pi/3))*x2)),y2-(2*(sin(theta+(pi/3)))*y2)); roiManager("Add"); roiManager("Select", 4); roiManager("Rename", "1"); makePolygon(x2-(2*(cos(theta)*x2)),y2-(2*(sin(theta)*y2)),x2,y2,x2-(2*(cos(theta-(pi/3))*x2)),y2-(2*(sin(theta-(pi/3)))*y2)); roiManager("Add"); roiManager("Select", 5); roiManager("Rename", "2"); makePolygon(x2-(2*(cos(theta-(pi/3))*x2)),y2-(2*(sin(theta-(pi/3)))*y2),x2,y2,x2-(2*(cos(theta-(2*pi/3))*x2)),y2-(2*(sin(theta-(2*pi/3)))*y2)); roiManager("Add"); roiManager("Select", 6); roiManager("Rename", "3"); makePolygon(x2,y2,x2-(2*(cos(theta-(2*pi/3))*x2)),y2-(2*(sin(theta-(2*pi/3)))*y2),x2-(2*(cos(theta-(3*pi/3))*x2)),y2-(2*(sin(theta-(3*pi/3)))*y2); roiManager("Add"); roiManager("Select", 7); roiManager("Rename", "4"); 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); roiManager("Add"); roiManager("Select", 8); roiManager("Rename", "5"); makePolygon(x2,y2,x2-(2*(cos(theta-(4*pi/3))*x2)),y2-(2*(sin(theta-(4*pi/3)))*y2),x2-(2*(cos(theta-(5*pi/3))*x2)),y2-(2*(sin(theta-(5*pi/3)))*y2); roiManager("Add"); roiManager("Select", 9); roiManager("Rename", "6"); roiManager("select", newArray(3,4)); roiManager("AND"); roiManager("Add"); roiManager("Deselect"); roiManager("Select", 4); roiManager("Delete"); roiManager("Deselect"); roiManager("Select", 9); roiManager("Rename", "1"); wait(10); roiManager("select", newArray(3,4)); roiManager("AND"); roiManager("Add"); roiManager("Deselect"); roiManager("Select", 4); roiManager("Delete"); roiManager("Deselect"); roiManager("Select", 9); roiManager("Rename", "2"); wait(10); roiManager("select", newArray(3,4)); roiManager("AND"); roiManager("Add"); roiManager("Deselect"); roiManager("Select", 4); roiManager("Delete"); roiManager("Deselect"); roiManager("Select", 9) roiManager("Rename", "3"); wait(10); roiManager("select", newArray(3,4)); roiManager("AND") roiManager("Add"); roiManager("Deselect"); roiManager("Select", 4); roiManager("Delete"); roiManager("Deselect"); roiManager("Select", 9) roiManager("Rename", "4"); wait(10); roiManager("select", newArray(3,4)); roiManager("AND"); roiManager("Add"); roiManager("Deselect"); roiManager("Select", 4); roiManager("Delete"); roiManager("Deselect"); roiManager("Select", 9); roiManager("Rename", "5"); wait(10); roiManager("select", newArray(3,4)); roiManager("AND"); roiManager("Add"); roiManager("Deselect"); roiManager("Select", 4) roiManager("Delete"); roiManager("Deselect"); roiManager("Select", 9); roiManager("Rename", "6"); wait(10); roiManager("Select", 3); roiManager("Measure"); mean1 = getResult("Mean"); SD = getResult("StdDev") t1c= 3*SD + mean1 setThreshold(t1c,1000) run("Threshold..."); roiManager("Show All"); roiManager("Show None"); roiManager("Show All"); roiManager("Select", 3); setAutoThreshold("Triangle dark"); waitForUser("Edit segments and update in Roi Manager"); roiManager("Deselect"); roiManager("Select", 0); getSelectionBounds(x4,y4,widthendo,heightendo) widthblood=widthendo*0.5 heightblood=heightendo*0.5 xblood=x4*2 yblood=y4*2 makeOval(xblood, yblood, widthblood, heightblood) setTool("oval"); waitForUser("Edit Blood"); run("Add to Manager "); roiManager("Select", 10); roiManager("Rename", "Blood"); roiManager("Deselect"); roiManager("Select", 0); roiManager("Measure"); roiManager("Select", 4); roiManager("Measure"); roiManager("Select", 5); roiManager("Measure"); roiManager("Select", 6); roiManager("Measure"); roiManager("Select", 7); roiManager("Measure"); roiManager("Select", 7); roiManager("Measure"); roiManager("Select", 8); roiManager("Measure"); roiManager("Select", 9); roiManager("Measure"); roiManager("Show All"); roiManager("Show None"); roiManager("Show All"); roiManager("select",2); roiManager("Rename", "Manual Roi"); roiManager("Measure"); selectWindow("Results"); run("Close"); } else { setOption("Show All",true); roiManager("Select", 0); roiManager("Measure"); roiManager("Measure"); roiManager("Measure"); roiManager("Select", 1); roiManager("Measure"); roiManager("Deselect"); setResult("calibration", 4, 0); setResult("calibration", 5, 0); setResult("calibration", 6, Dim); setResult("calibration", 7, calw); setResult("calibration", 8, calh); updateResults(); String.copyResults(); waitForUser("Paste to Excel NOW - Finished?"); selectWindow("preimage.raw"); saveAs("tiff", dir+"preimage"+x); close(); selectWindow("Working.TIF"); saveAs("tiff", dir+"Working"+x); close(); selectWindow("Results"); run("Close"); selectWindow("ROI Manager"); roiManager("Save", dir+"RoiSet"+x+".zip"); run("Close"); } |
Hi,
since it said "line 324", that should have been enough. Your lines are too long, so they were wrapped and I did not want to spend time to unwrap them, so I guess this here is the culprit: On Mon, 9 Jan 2012, flettster wrote: > SD = getResult("StdDev") > t1c= 3*SD + mean1 > setThreshold(t1c,1000) These three lines all lack a semicolon at the end, as the error message suggests. Ciao, Johannes P.S.: Even if ImageJ's default editor lacks line numbers (if you want a nicer editor, try Fiji's Script Editor), it still has the Edit>Goto Line... menu entry. |
Hi,
On Jan 9, 2012, at 7:51 PM, Johannes Schindelin wrote: > Hi, > > since it said "line 324", that should have been enough. Your lines are too > long, so they were wrapped and I did not want to spend time to unwrap > them, so I guess this here is the culprit: > > On Mon, 9 Jan 2012, flettster wrote: > >> SD = getResult("StdDev") >> t1c= 3*SD + mean1 >> setThreshold(t1c,1000) > > These three lines all lack a semicolon at the end, as the error message > suggests. > In addition, it appears that some of the lines that start with makePolygon (one of which is on line 324!) have unmatched parentheses. Cheers, Ben > Ciao, > Johannes > > P.S.: Even if ImageJ's default editor lacks line numbers (if you want a > nicer editor, try Fiji's Script Editor), it still has the Edit>Goto > Line... menu entry. |
Hi Andy,
May I suggest using Notepad++ as your editor It has all the major features necessary to help you avoid these frustrating errors. I find it very useful for writing plugins and it is completely free! http://notepad-plus-plus.org/ Best, Mike On Tue, Jan 10, 2012 at 10:11 AM, Ben Tupper <[hidden email]> wrote: > Hi, > > On Jan 9, 2012, at 7:51 PM, Johannes Schindelin wrote: > > > Hi, > > > > since it said "line 324", that should have been enough. Your lines are > too > > long, so they were wrapped and I did not want to spend time to unwrap > > them, so I guess this here is the culprit: > > > > On Mon, 9 Jan 2012, flettster wrote: > > > >> SD = getResult("StdDev") > >> t1c= 3*SD + mean1 > >> setThreshold(t1c,1000) > > > > These three lines all lack a semicolon at the end, as the error message > > suggests. > > > > In addition, it appears that some of the lines that start with makePolygon > (one of which is on line 324!) have unmatched parentheses. > > Cheers, > Ben > > > > > > Ciao, > > Johannes > > > > P.S.: Even if ImageJ's default editor lacks line numbers (if you want a > > nicer editor, try Fiji's Script Editor), it still has the Edit>Goto > > Line... menu entry. > |
Free forum by Nabble | Edit this page |