Clear list in for loop

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

Clear list in for loop

AJBell
Hi list...

I'm using List.setMeasurements in a macro to get some data without pulling up a results table, but it is causing problems later when I finally do want to write a results table.

In essence what happens is:

open image set A (sequentially)
Threshold to create ROI
use List.setMeasurements to get the information required to draw a box around each ROI
save ROI list as a zip file
close all open windows

open Image set B (sequentially)
open ROI.zip
run roiManager("Measure")

At this point, I should only have the data from the current image, but infact, all the measurements taken from image set A are present. I have tried closing the results table with

x = isOpen("Results");
if(x==1) {
selectWindow("Results");
run("Close");
}

And I hav tried clearing the list with List.clear();

However neither have worked. Has anyone got any suggestions as to the cause or solution?

Andrew
Reply | Threaded
Open this post in threaded view
|

Re: Clear list in for loop

Christian Liebig-2
Hi Andrew,

have you tried
run("Clear Results");
?

Best wishes,

Christian



On 14.02.2012 16:52, Andrew Bell wrote:

> Hi list...
>
> I'm using List.setMeasurements in a macro to get some data without pulling up a results table, but it is causing problems later when I finally do want to write a results table.
>
> In essence what happens is:
>
> open image set A (sequentially)
> Threshold to create ROI
> use List.setMeasurements to get the information required to draw a box around each ROI
> save ROI list as a zip file
> close all open windows
>
> open Image set B (sequentially)
> open ROI.zip
> run roiManager("Measure")
>
> At this point, I should only have the data from the current image, but infact, all the measurements taken from image set A are present. I have tried closing the results table with
>
> x = isOpen("Results");
> if(x==1) {
> selectWindow("Results");
> run("Close");
> }
>
> And I hav tried clearing the list with List.clear();
>
> However neither have worked. Has anyone got any suggestions as to the cause or solution?
>
> Andrew