Cannot delete rows in ResultsTable?

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

Cannot delete rows in ResultsTable?

Cspr
This is the code currently employed:

ResultsTable rt = new ResultsTable();
ParticleAnalyzer pa = new ParticleAnalyzer(options, measurements, rt, micronsize, Double.POSITIVE_INFINITY);

pa.analyze(imp3);

After which I aim to delete all the content in the ResultsTable. As surprisingly easy it might sound that does not seem to work.
Doing a simple for-loop

for(int i = 0; i < rt.getCounter(); i++){
    rt.deleterow(j)
}

does not work at all. I'm completely unable to manipulate the ResultsTable in any way. Also trying to use the instance of the ResultsTable used by the ParticleAnalyzer method does not work i.e.

ResultsTable rt = ResultsTable.getResultsTable();
System.out.println(rt.getValue("Mean",15)); // To check if anything is present. There IS a "Mean" Column.

results in nothing. What am I missing?

Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: Cannot delete rows in ResultsTable?

Gabriel Landini
On Wednesday 03 Mar 2010  11:08:20 you wrote:

> After which I aim to delete all the content in the ResultsTable. As
> surprisingly easy it might sound that does not seem to work.
> Doing a simple for-loop
>
> for(int i = 0; i < rt.getCounter(); i++){
>     rt.deleterow(j)
> }
>
> does not work at all.

Maybe this has to do with trying to delete row j, instead of row i?

G.
Reply | Threaded
Open this post in threaded view
|

Re: Cannot delete rows in ResultsTable?

Cspr
Horrible mistake to make in a post. This is not the case in code however. There is loops over the actual counter.
Reply | Threaded
Open this post in threaded view
|

Re: Cannot delete rows in ResultsTable?

Gabriel Landini
On Wednesday 03 Mar 2010  11:29:51 you wrote:
> Horrible mistake to make in a post. This is not the case in code however.
> There is loops over the actual counter.

Well, it is difficult for anybody to be able help without knowing exactly what
you are doing...

Do you update the results window?

G.
Reply | Threaded
Open this post in threaded view
|

Re: Cannot delete rows in ResultsTable?

Michael Doube
In reply to this post by Gabriel Landini
Perhaps it has to do with rt.getCounter() changing value each time you
delete a row? Better to use an int rather than multiple calls; so

int nRows = rt.getCounter();
for (int i = 0; i < nRows;  i++){
...

Michael

>> After which I aim to delete all the content in the ResultsTable. As
>> surprisingly easy it might sound that does not seem to work.
>> Doing a simple for-loop
>>
>> for(int i = 0; i < rt.getCounter(); i++){
>>     rt.deleterow(j)
>> }
>>
>> does not work at all.
Reply | Threaded
Open this post in threaded view
|

Re: Cannot delete rows in ResultsTable?

Michael Schmid
In reply to this post by Cspr
Hi anonymous,

after doing changes, you have to update the display. This applies to  
both images (ImagePlus.updateAndDraw) as to the ResultsTable:

...in ResultsTable.java (also in the API description):
/** Updates the Results window. */
public void updateResults()

Michael
________________________________________________________________

On 3 Mar 2010, at 12:01, Cspr wrote:

> This is the code currently employed:
>
> ResultsTable rt = new ResultsTable();
> ParticleAnalyzer pa = new ParticleAnalyzer(options, measurements, rt,
> micronsize, Double.POSITIVE_INFINITY);
>
> pa.analyze(imp3);
>
> After which I aim to delete all the content in the ResultsTable. As
> surprisingly easy it might sound that does not seem to work.
> Doing a simple for-loop
>
> for(int i = 0; i < rt.getCounter(); i++){
>     rt.deleterow(j)
> }
>
> does not work at all. I'm completely unable to manipulate the  
> ResultsTable
> in any way. Also trying to use the instance of the ResultsTable  
> used by the
> ParticleAnalyzer method does not work i.e.
>
> ResultsTable rt = ResultsTable.getResultsTable();
> System.out.println(rt.getValue("Mean",15)); // To check if anything is
> present. There IS a "Mean" Column.
>
> results in nothing. What am I missing?
>
> Thanks.
>
>
> --
> View this message in context: http://n2.nabble.com/Cannot-delete- 
> rows-in-ResultsTable-tp4666791p4666791.html
> Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Cannot delete rows in ResultsTable?

Michael Doube
In reply to this post by Michael Doube
rt.deleteRow() also has a big 'R' for row

>>>     rt.deleterow(j)
Reply | Threaded
Open this post in threaded view
|

Re: Cannot delete rows in ResultsTable?

Cspr
In reply to this post by Michael Schmid
Thank you for all the suggestions.

To address things in turn:
I'm trying to get some ROI's calculated on a black/white image, then delete the content of the resultstable, select another image, apply the ROI's calculated to that image, and perform measurements on that image.

One thing continues to elude me and that is why the call

ResultsTable rt = ResultsTable.getResultsTable();

returns nothing. Calling getCounter() on it results in 0. Somehow I dont seem to be able to grab a hold of the reference.
Reply | Threaded
Open this post in threaded view
|

Re: Cannot delete rows in ResultsTable?

Cspr
It seems that IJ.run("Clear Results","") did the job.

In the table prior to calling IJ.run("Clear Results",""), I have the columns: Area, Mean, Std_Dev, Min, Max.

However after running the above command, if I hit "Measure" in the ROI Manager again, the column Std_Dev disappears. Why is that happening?