question about ResultsTable.getValue()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

question about ResultsTable.getValue()

Aryeh Weiss
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
Reply | Threaded
Open this post in threaded view
|

Re: question about ResultsTable.getValue()

Aryeh Weiss
I made some progress here:

On 7/27/15 3:34 PM, Aryeh Weiss wrote:

> 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 use
int(rt.getStringValue("NUMBER_SPOTS", i))
  then it works as expected. I guess the tables that trackmate generates
have string entries.


>
>
> Also, is there a way other than
>
> IJ.renameResults("Track statistics","Results")
> rt = ResultsTable.getResultsTable()
>
> to access "TrackStatistics" as a results table?
>
--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