// Plot Image Calibration macro // A dialog allows to define existing plot dimensions // This 'calibration' is stored in Image Metadata // And reused is the Measure Graph Tool macro "Calibrate Action Tool - C000T0b12cT6b10aTbb10lTfb10."{ if (selectionType!=0) exit("Rectangular Selection Required"); getBoundingRect(x,y,w,h); Dialog.create("Plot calibration"); Dialog.addNumber("xmin",400); Dialog.addNumber("xmax",700); Dialog.addNumber("ymin",0); Dialog.addNumber("ymax",500); Dialog.show; xmin = Dialog.getNumber(); xmax = Dialog.getNumber(); ymin = Dialog.getNumber(); ymax = Dialog.getNumber(); List.clear; List.set("panel",""+xmin+","+xmax+","+ymin+","+ymax); List.set("rectangle",""+x+","+y+","+w+","+h); setMetadata(List.getList()); run("Select None"); setTool(15); } macro "Measure Graph Tool - C000T0f20M"{ do { getCursorLoc(x, y, z, modifiers); List.setList(getMetadata()); panel=List.get("panel"); p=split(panel,','); rectangle =List.get("rectangle"); r=split(rectangle,','); xg = 1*p[0]+(x-1*r[0])*(1*p[1]-1*p[0])/(1*r[2]); yg = 1*p[2]+(1*r[1]-y+1*r[3])*(1*p[3]-1*p[2])/(1*r[3]); showStatus("X:"+toString(xg,2)+" Y:"+toString(yg,2)); } while (modifiers&16==16); print("xGraph="+toString(xg,2)+" yGraph="+toString(yg,2)); }