Login  Register

question about ResultsTable.getValue()

Posted by Aryeh Weiss on Jul 27, 2015; 12:34pm
URL: http://imagej.273.s1.nabble.com/question-about-ResultsTable-getValue-tp5013755.html

I have the following snippet of python code, which  renames a table
called "Track Statistics" to "Results", and tries to use the
ResultsTable methods to read it.

IJ.renameResults("Track statistics","Results")
rt = ResultsTable.getResultsTable()
print rt    # this correctly prints the column  headings
trackLengths = []
numberOfTracks =  rt.getCounter()        # this correctly gets the
number of entries in the table
for i in range(numberOfTracks):
     trackLength = rt.getValue("NUMBER_SPOTS", i)
     trackLengths.append(trackLength)
     print i, trackLengths[i], trackLength

###############

This code correctly prints the header and number of entires, so
apparently rt points to the correct  table.

However, rt.getValue("NUMBER_SPOTS", i)  always returns NaN.
Also, rt.getValueAsDouble(2,2) returns NaN ( 2,2 was justa way of being
sure that the indices are valid).

If I replace "NUMBER_SPOTS" with "NUMBER_SPOTS ", I will correctly get
an error,  saying that "NUMBER_SPOTS " cannot be found.

What am I missing here?

Also, is there a way other than

IJ.renameResults("Track statistics","Results")
rt = ResultsTable.getResultsTable()

to access "TrackStatistics" as a results table?

Thank in  advance.
--aryeh

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html