// "AdvancedPlots" macros // These macros demonstrate how to use the toUnscaled() // and toScaled() functions with plot windows. // They require ImageJ 1.45n or later. // // There are five macros: // "Highlight and Annotate Area [F1]" // "Qualify Roi [F2]" // "Filled Plot [F3]" // "Custom Markers [F4]" // "Zoom in Plot [F5]" // // vischer at science.uva.nl // 05.09.11 22:41 macro "Highlight and Annotate Area [F1]" { requires("1.45n"); left = -1; right = 5; bottom = -0.2; top = 1.2; nPoints = 200; range = right - left; xValues = newArray(nPoints); yValues = newArray(nPoints); Plot.create("Gauss-Ellipse-Match", "X", "Y"); Plot.setLimits(left, right, bottom, top ); sigma = 2; ampl = 1; x0 = 2; radiusX = sigma /sqrt(2);//horizontal radius for (p = 0; p < nPoints; p++){ x = p/nPoints * range + left; y = ampl * exp(-pow(x - x0, 2)/(sigma * sigma * 2)); xValues[p] = x; yValues[p] = y; } Plot.setColor("blue"); Plot.add("line", xValues, yValues); Plot.setColor("red"); Plot.drawLine(x0, ampl/2, x0+radiusX, ampl/2); Plot.show; hookLeft = x0-radiusX; hookTop = ampl; hookBottom = 0; hookRight = x0+radiusX; toUnscaled(hookLeft, hookTop); toUnscaled(hookRight, hookBottom); makeOval(hookLeft, hookTop, hookRight - hookLeft, hookBottom - hookTop); changeValues(0x00ffffff, 0x00ffffff, 0x00ccddff); run("Select None"); setColor(0xff0000); x = x0; y = ampl/2; toUnscaled(x, y); drawString("r = sigma / sqrt(2)", x, y-2); } macro "Qualify ROI [F2]" { k1000 = 1000; xValues = newArray(k1000); yValues = newArray(k1000); for (jj = 0; jj