What are the Column Names of the Results from the Extended Particle Analyzer?

Hello,

I am using the Extended Particle Analyzer from the BioVoxxel Plugins in my own Plugin.

I want to get the Results from the Results Table and work with this data in my own plugin.

My problem is, that I don’t know what number / name the columns in the results have :confused:

I tried:

double wert = 0;

  • wert = rt.getValueAsDouble(0, 1);
    ERROR: java.lang.IllegalArgumentException: Index out of range: 0,1

  • wert = rt.getValue("Area", 1);
    ERROR: java.lang.IllegalArgumentException: Row out of range

Why doesn’t work the second and what means this error? I have 55 results, so there have to be 55 rows… why is row 1 out of range?

Code:

IJ.run(originalbild, "Extended Particle Analyzer", "area=0-Infinity show=Nothing redirect=None keep=None display");

//Resultate auslesen:
ResultsTable rt = Analyzer.getResultsTable();	

//rt.show("Results");
//int counter = rt.getCounter();
int lastco = rt.getLastColumn();	// **why is this -1?**

System.out.print(lastco);
double wert = 0;

wert = rt.getValue("Area", 1);			
//rt.getValueAsDouble(0, 1); //Spalte,Zeile

System.out.print(wert);
System.out.print("\n");

Can anyone help me with this problem?

~Stefan

Hi @stefan_erben,

Analyzer.getResultsTable() returns the default ResultsTable. The ResultsTable created by Extended Analyze Particles, however, is not the default one (there is some copying of values going on, e.g. Extended_Particle_Analyzer.java#L619).

That said, I am not sure how to get a reference to the ResultsTable produced by Extended Analyze Particles. How do you handle such cases, @biovoxxel?

Best,
Stefan

Yes, it should be the default, as calling ResultsTable.show() with the parameter "Results" will replace the default results table in ImageJ1.

Oh, that’s interesting, I wasn’t aware of that. Thanks for the pointer @imagejan.

Then you can forget about my comment @stefan_erben.

Hi @stefan_erben

actually the results table of the Extrended Particle Analyzer (EPA) is the normal results table of ImageJ just extended by some. Thus, you should normally be able to read out the result values with the standard commands.

ResultsTable rt = ResultsTable.getResultsTable();
getValue(java.lang.String column, int row);

or you can get the headings by using

ResultsTable rt = ResultsTable.getResultsTable();
rt.getHeadings();

to get a String array and cycle through.

I actually figured out that in one of the newer versions of IJ (IJ-2.0.0-rc49/1.51d in my case) the EPA also displays the initial results table which is actually an internal one and should not be displayed.
I guess one day I will need to rewrite the EPA completely from scratch.

This is something I have to revise and change in a future version. Just, that at the moment I will not find the time to do so.But since there is actually also the Shape Filters from @twagner existing which create a similar output the question is if this pays off to have similar tools twice.

Thank you guys for your help.

The reason why I wanted to get the values from the result table of the extended particle analyzer was beacuase I needed the values of the circularity.

But I figured out, that most of the values in the extended particle analyzer can be calculated much quicker and easier if I use the normal particle analyzer an calculated the cirularity by my own.

Nevertheless, thank you for your help :slight_smile:
@stelfrich @imagejan @biovoxxel

Best,
Stefan

Actually, you don’t need to calculate the circularity. It is part of the standard results table and is represented by the column “circ.”

1 Like

as @biovoxxel said Circularity (circ.) is in the standard results table, you have to check “shape descriptors” in the “set measurements” menu.

Have a nice day
Emanuele

To complete the picture, here’s a minimal example illustrating how to use the ParticleAnalyzer API to get the circularity values in an array.

To try it, just paste the following code into the Script Editor, select Language > Groovy, threshold any image, and press Run:

// @ImagePlus imp

import ij.plugin.filter.ParticleAnalyzer
import ij.measure.ResultsTable

rt = new ResultsTable()
pa = new ParticleAnalyzer(ParticleAnalyzer.SHOW_NONE, ParticleAnalyzer.CIRCULARITY, rt, 0, Double.POSITIVE_INFINITY)
pa.analyze(imp)
circularityValues = rt.getColumn(ResultsTable.CIRCULARITY)

println(circularityValues)
2 Likes