python - ImageJ/Fiji: Iteration through and printing in results table -


i have problem jython-fiji plugin:

ij.run("set measurements...", "area centroid perimeter shape feret's area_fraction     redirect=none decimal=6") ij.run("analyze particles...") rt = resultstable.getresultstable()  roi in roimanager.getinstance().getroisasarray():   = rt.getvalue("feret", row)   b = rt.getvalue("minferet", row)   nu= 1   l = 1   p = 1   row = row + 1   s = (math.pi/4) * (1/(nu*l)) * math.pow(a, 3) * math.pow(b, 3) / (math.pow(a, 2) + math.pow(a, 2))*p   rt.addvalue("s", s) rt.show("results")  

normaly should add new column (named s) in oppinion values of s. unfortunatly last s value shows in column, while other rows of column filled 0. definetly missed something, @ moment dont know what. thanking in advance!

to make code run, had add import math , row=0 @ beginning.

i replaced resultstable.addvalue() function call resultstable.setvalue() adding current row parameter. see api documentation details.

import math ij.run("set measurements...", "area centroid perimeter shape feret's area_fraction     redirect=none decimal=6") ij.run("analyze particles...") rt = resultstable.getresultstable() row=0 roi in roimanager.getinstance().getroisasarray():   = rt.getvalue("feret", row)   b = rt.getvalue("minferet", row)   nu= 1   l = 1   p = 1   s = (math.pi/4) * (1/(nu*l)) * math.pow(a, 3) * math.pow(b, 3) / (math.pow(a, 2) + math.pow(a, 2))*p   rt.setvalue("s", row, s)   row = row + 1 rt.show("results") 

hope helps.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -