// Facilitates capture of array grid coordinates to assign arrayed conditions. // // (1) Open a composite of your rotated channel images. This image must must contain clearly identifiable arrayed conditions at the top left and bottom right corners. // (2) Activate the multi-point tool (https://imagej.nih.gov/ij/docs/guide/146-19.html#sec:Multi-point-Tool). // Select the origin, which corresponds to the top left arrayed condition --- usually dextran-rhodamine or another fluorescent marker. // Next select the reverse origin, which corresponds to the bottom right arrayed condition --- either a fluorescent marker or cell island. // (3) Run the code. Note that if you installed the macro, you can press "g" to run the code. // // A table containing the results is produced, which can readily be saved in your format of choice (e.g., XLS, XLSX, CSV, etc.). //-----------------------------------------------------------------------------------------------// macro "array_gridding [g]" { // creates keyboard shortcut, "g" run("Enhance Contrast...", "saturated=0.4"); // enhances contrast temporarily run("Set Scale...", "distance=0 known=0 pixel=1 unit=pixel global"); // resets the scale s = selectionType(); if (s==-1) { exit("There was no selection."); } else if (s!=10) { exit("There was no point selection."); } else { getSelectionCoordinates(x, y); // obtains coordinates of selected points if (lengthOf(x)==2) { // creates variables to be assigned to the table x1=x[1]; y1=y[1]; x2=x[0]; y2=y[0]; if (x1 < x2) { // compensates for when the (x,y) reverse origin is picked first i=nResults; // allows adding another row of the coordinates when code is re-run setResult("x_origin",i,x1); setResult("y_origin",i,y1); setResult("x_right",i,x2); setResult("y_bottom",i,y2); } else { i=nResults; setResult("x_origin",i,x2); setResult("y_origin",i,y2); setResult("x_right",i,x1); setResult("y_bottom",i,y1); } } }