Changing labels on Results table using Jython

jython
results-table
label
macro
fiji
Tags: #<Tag:0x00007fb87bd25e98> #<Tag:0x00007fb87bd25d58> #<Tag:0x00007fb87bd25c18> #<Tag:0x00007fb87bd25ad8> #<Tag:0x00007fb87bd25998>

#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!