/* This macro measures the length of a line selection and displays the ratio (as a percent) of the length of the line and the length of the previously measured line. You can create a "Measure Relative Length" command in the Plugins menu by saving this macro in the plugins folder as "Measure_Relative_Length.txt" and running Help>Refresh menus. The command will not have a keyboard shortcut but you can run it repeatedly by running it once and then pressing shift-r (Process>Repeat command). Or you can add a "Measure Relative Length [1]" command, with a keyboard shortcut of "1", to the Plugins>Macros menu by adding this macro to the end of the ImageJ/macros/StartupMacros.txt file and restarting ImageJ. */ macro "Measure Relative Length [1]" { run("Measure"); length1 = getResult('Length', nResults-1); if (length1==0 || isNaN(length1)) exit("Line selection required"); length2 = getResult('Length', nResults-2); setResult('Percent', nResults-1, length1*100/length2); updateResults(); }