print("Morphology Picker v3.2"); print("Kyle Morris, University of Sussex, 2010"); print("--------------------"); Dialog.create("Calibration, warning: global scales will be first removed"); Dialog.addChoice("Magnification:", newArray("50,000X", "30,000X", "20,000X", "15,000X", "10,000X", "5,000X", "Manual")); Dialog.show(); run("Set Scale...", "distance=0 known=0 pixel=1 unit=pixel global"); Mag = Dialog.getChoice(); print(Mag); if (Mag=="5,000X") { boxwidthpx = 37.5; boxlengthpx = 300; } else if (Mag=="10,000X") { boxwidthpx = 75; boxlengthpx = 600; } else if (Mag=="15,000X") { boxwidthpx = 112.5; boxlengthpx = 900; } else if (Mag=="20,000X") { boxwidthpx = 150; boxlengthpx = 1200; } else if (Mag=="30,000X") { boxwidthpx = 225; boxlengthpx = 1800; } else if (Mag=="50,000X") { boxwidthpx = 375; boxlengthpx = 3000; } //Main function is embedded in while loop such that after each measurement user is asked if they want to repeat repeat = 1; do { //Line parameters are collected waitForUser("Make a line selection and then click OK:"); getLine(x1, y1, x2, y2, lineWidth); if (x1==-1) { exit("Can't find a line :*(, please restart macro"); } getPixelSize(unit, pw, ph); x1*=pw; y1*=ph; x2*=pw; y2*=ph; //Line parameters, x-y coordinates, length and angle are calculated dx = x2-x1; dy = y2-y1; length = sqrt(dx*dx+dy*dy); if (y1==y2) { if (x1