// This macro measures the current selection, outlines it in // the current foreground color and labels it with the // X, Y and Z coordinates. macro "Measure And Label With Coordinates" { dp = decimalPlaces = 2; lineWidth = 2; run("Measure"); fontSize = 12; setJustification("center"); setFont("SansSerif", fontSize); run("Line Width...", "line="+lineWidth); run("Draw", "slice"); x = getResult("X"); y = getResult("Y"); if (isNaN(x)) exit("'Centroid' must be checked in Analyze>Set Measurements"); z = getSliceNumber()-1; getVoxelSize(w, h, d, unit); z = z*d; label = ""+nResults+":("+d2s(x,dp)+", "+d2s(y,dp)+", "+d2s(z,dp)+")"; getBounds(xbase, ybase, width, height); drawString(label, xbase+width/2, ybase+height+1.5*fontSize); }