Roi, choosing between custom label names

Hello all, my question will be about RoiManager.
After completing selections, I am exporting roi coordinate results as text file, in the macro.
What I want to additionally do is, adding another column to results table to serve as custom label for each roi.
Example, a photo of apples and pears. “During” creation of apple rois, I want the word “apple” stored for all of them somewhere, then continue selecting pears and need “pear” word attached to relevant records, probably in results table. Is it possible to do this within same macro? (I mean switch between apple and pear, during roi selection process? )

Thanks for all the help,

Alp

How are your input files named?

You can use the following command in the ROI manager
roiManager(“Save”,apples.zip");

I have used the following where I define the directory and tt previously in the code in my case tt corresponds to a string in the oringal file (In your case could pull possibly either an apple or pear label from a label name?)

roiManager("Save", dir3 + tt +"roi"+n +".zip");

Hello Susan, thank you for your response, I have solved the problem by injecting the following critical code pieces to where necessary :slight_smile: . Thanks again.


run("Set Measurements...", "bounding  display redirect=mainTitle decimal=3");

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

labeltype=getResultString("Label",row);