Login  Register

Help needed: Copy entire Results Table (with custom string columns) to JTable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Help needed: Copy entire Results Table (with custom string columns) to JTable

joshkh
Hello all,

I'm attempting to run ParticleAnalyzer on a selection in my stack and then essentially "scrape" the Results window and copy all of the results into a JTable embedded in my Java plugin. I'm struggling with getting all of the data, particularly columns that I've added that aren't a typical measurement.

For instance I have a column called "Threshold Type" where I've labeled the particular threshold in use:

private static ResultsTable rt = ResultsTable.getResultsTable();
ImagePlus impTempLi = new ImagePlus("selected region", imp.getProcessor().crop());
IJ.setAutoThreshold(impTempLi, "Li dark");
ParticleAnalyzer pa = new ParticleAnalyzer(ParticleAnalyzer.SHOW_RESULTS, Measurements.ELLIPSE, rt, 10, Double.MAX_VALUE, 0,1);
rt.setValue("Threshold Type", 0, "Li dark");

But the following code returns NaN:
IJ.log("Threshold Label: " + rt.getValue("Threshold Type", 0));

What am I doing wrong while attempting to get a string value from a "custom" measurement? And better yet, is there a way to dump the Results table into some sort of java tabular data structure (including custom columns)?

Thanks for saving my sanity.