// "Radial Histogram" // Takes a CSV (comma-separated values) list of angles and values // and draws a radial histogram. A sample list is available at // http://rsb.info.nih.gov/ij/macros/data/angles.csv requires("1.37v"); progress("Open file, which must be a csv list in (angle, value) format", 1, 10); string = File.openAsString(""); start = getTime; progress("Split the CSV file into an array of lines", 2, 10); lines = split(string, "\n"); //initialise some variables n = lengthOf(lines); theta = newArray(n); r = newArray(n); //number of divisions Dialog.create("Set Divisions"); Dialog.addMessage("Your file contains "+n+" entries.\nEnter the number of graph divisions:"); Dialog.addNumber ("Divisions", 12); Dialog.show(); divs = Dialog.getNumber(); wedgetheta = 360 / divs; counts = newArray(divs); for (i=0; i=lower){ counts[j]++; } } //handle the half-div prior to 360 deg (-divs/2) upper = 360; lower = 360*(1-1/(divs*2)); if(theta[i]=lower){ counts[0]++; } } progress("Find the maximum count (to determine the outer boundary)", 3, 10); maxcount = 0; for(i=0; imaxcount) maxcount = counts[i]; } radius = 506; margin = 6; image = 2*(radius+margin); //Draw the new image setBatchMode(true); newImage("Untitled", "8-bit White", image, image, 1); if (File.exists(getDirectory("imagej")+"luts/Orange Hot.lut")) run("Orange Hot"); else run("Fire"); xp = newArray(divs); yp = newArray(divs); progress("Draw the points", 5, 10); for (i=0; i