Changing labels on Results table using Jython

fiji
jython
imagej
macro
results-table
label

#1

I’m trying to write the IJ1 Macro below

setResult('Label', 1, 'nameOfFileAnalyzed');

in Jython:

from ij.measure import ResultsTable
rt = ResultsTable.getResultsTable()
rt.setValue('Label', 1, 'nameOfFileAnalyzed')

There is no error when I click run but it’s not changing the value in the table, either. Here’s the table.

Any suggestion would be highly appreciated.


Modifying Results Table with Jython/Python
#2

You have to call rt.show('Results') (see javadoc for details). Try the following:

from ij.measure import ResultsTable
rt = ResultsTable.getResultsTable()
rt.setLabel('nameOfFileAnalyzed', 1)
rt.show('Results')

#3

Ah, rt.show(‘Results’)! That’s why I didn’t see any changes but still no error. I implemented your suggestion and it is all good. Thank you!