/* Puts a nondestructive overlay of concentric circles on the image. In this version, the center circle has a diamter of 30 um and the spacing between each circle is 15 um. Running the macro automatically removes the previous overlays. To get remove of overlay, use Image > Overlay > Remove Overlay. 1. Use any region of interest tool (small rectangle, oval, click a point) to put a ROI on an image. 2. Type q or Plugins > Macros to run "draw concentric circles [q]" */ var spacing = 15; // units are um; this was originally written for .czi files from a 800 confocal var nCircles = 10; macro "draw concentric circles [q]" { print(""); run("Remove Overlay"); getVoxelSize(xwidth, height, depth, unit); print(xwidth); spaceBetweenCircles = spacing / xwidth; // this is in pixels setVoxelSize(1, 1, 1, "pixel"); run("Set Measurements...", "centroid redirect=None decimal=3"); run("Measure"); xc = getResult("X", nResults-1); yc = getResult("Y", nResults-1); // toUnscaled(xc,yc); for (i=1; i<=nCircles; i++) { diameter = i * 2 *spaceBetweenCircles; print (i, " ", diameter, " ", spaceBetweenCircles); xcorner = xc - (diameter / 2); ycorner = yc - (diameter / 2); Overlay.drawEllipse(xcorner, ycorner, diameter, diameter); Overlay.add; Overlay.show; } // for i run("Select None"); setVoxelSize(xwidth, height, depth, unit); } // end "draw concentric circles [q]" //=================================== macro "Save ROI Manager [F7]" { if ( getInfo("window.type") != "Image" ) exit("Make sure running macro from image window."); dir = getDirectory("image"); // where to save results if (lengthOf(dir) < 1) exit("Make sure the image was opened from disk."); title = getTitleStripExtension(); newName =dir + title + ".zip"; // add command to select none in ROIManager to mae sure all saved? roiManager("Save", newName); roiManager("reset"); } // end Save ROI Manager [F7] /==================================== // Use this function to strip any number of extensions // off images. // Returns the title without the extension. //==================================== function getTitleStripExtension() { t = getTitle(); extensions = newArray(".tif", ".tiff", ".lif", ".lsm", ".czi", ".nd2", ".ND2"); for(i=0; i