/* * By Olivier Burri, BioImaging & Optics Platform EPFL * June 2016 * Provided as-is from a request on the ImageJ Forum * http://forum.imagej.net/t/dividing-circle-into-8-equal-areas/1995 */ var count = 0; // Variable to know which circle we are working on // If you install this macro, it will be mapped to the F2 Key macro "Draw Concentric Quadrants [F2]" { // Clean previous ROIs roiManager("Reset"); // Ask for user to draw a line, to define extents waitForUser("Draw a line"); // Get the line end points getSelectionCoordinates(x,y); // Ask for number of circles and number of quadrants Dialog.create("Parameters"); Dialog.addNumber("Number of Circles", 6); Dialog.addNumber("Number of Quadrants", 1); Dialog.show(); // Pick up user input nCircles = Dialog.getNumber(); nQuadrants = Dialog.getNumber(); // Get angle offset offset = atan2(y[1] - y[0], x[1] - x[0]); // Get Center cx = (x[0] + x[1]) /2; cy = (y[0] + y[1]) /2; // Get edge distance r = sqrt(pow(x[0] - x[1],2) + pow(y[0] - y[1],2)) / 2; // Set counter to 0 count = 0; // Make as many concenrtric donuts with quadrants as needed for (c=0; c