Question

I use ImageJ to measure length of different parts of biological organism. I draw straight or segmented line over image, add line to ROI Manager, and set name to it (rename the standard name of a label). After drawing some lines I measure them. The results (lines length) are put into table, and the first table column contains numbers, not label names.

How to put label names in this first column instead of numbers?

I know how to show label names with the name of image file as a prefix (like, image-file.jpg:labelA). In “Set Measurements” dialog check “Display Label” and new column “Label” will be added to result table.

But how to remove image file name from this column?

Was it helpful?

Solution

Tiago Ferreira, the author of "ROI Manager Tools" plugin for ImageJ, suggests the solution.

It is necessary to add the following macro to ImageJ that removes filename prefix from the label names in Results table.

macro "Rename Labels in Results Table" {
  for (i=0; i<nResults; i++) {
    oldLabel = getResultLabel(i);
    delimiter = indexOf(oldLabel, ":");
    newLabel = substring(oldLabel, delimiter+1);
    setResult("Label", i, newLabel);
  }
}

Save it to text file "Rename_Labels_in_Results_Table.txt" and put to "ImageJ\plugins\Analyze" directory.

Call it after the ROI manager's "Measure" command when the Results table is appeared. (Don't forget to set "Display Labels" checkbox in "Set Measurements" dialog before measurements.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top