memory leak associated with ROI manager?

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

memory leak associated with ROI manager?

Crowell Elizabeth
Dear ImageJ group,

I have encountered an incomprehensible behavior of Analyze Particles
when the ROI Manager is open, and there appear to be memory leaks
causing the problem.

Very simply, I have generated a list of ROIs that are stored in the ROI
Manager.  Then I run a loop that should select the first ROI, duplicate
it to a new image, threshold, and run Analyze Particles.  Inexplicably,
the results table contains measurements for each ROI in the Manager
followed by the measurements of my thresholded image.  I did not
instruct ImageJ to measure the ROIs in the Manager, and it appears to do
this through the Analyze Particles command.

In order to work around this problem, I decided to reset the ROI Manager
before running Analyze Particles.  Here is the smoking gun --- I find
the exact same results in the measurements table!  The ROIs are still
being measured, although they should no longer exist...

The code is as follows:

for(j=0;j<length;j++) {
            roiManager("Select", j);
            roiManager("reset");
            run("Enlarge...", "enlarge=70");
            run("Duplicate...", "title=dup");
            run("Select None");
            run("OtsuThresholding 16Bit");
            selectImage("dup");
            run("Analyze Particles...", "size=10-5000
circularity=0.00-1.00 show=[Nothing]");
            saveAs("Measurements", dest+number+"_"+j);
            run("Clear Results");
            selectImage("dup");
            close();
            roiManager("open",roiset);
        }

I am running ImageJ v1.44i on a Mac OS X 10.6.4 with the latest version
of Java.

First, I cannot understand why the ROIs are being measured, and
secondly, why I fail to delete them using the command
roiManager("reset");  I am not an experienced Java programmer, so
perhaps there is a safer, cleaner way to write these instructions...

Any help would be greatly appreciated.

Sincerely,

Elizabeth CROWELL

----------------------------------------------------------------------
Membrane Traffic and Cell Division Research Group
Institut Pasteur
28 rue du Dr Roux
75015 PARIS, France

Tel :  01.44.38.94.07
Fax : 01.45.68.89.54
----------------------------------------------------------------------