Generation of unrequested results using "Particle Analysis"

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

Generation of unrequested results using "Particle Analysis"

TimJ
Hello everyone,

 I'm pretty new to ImageJ macro writing and currently facing a problem during repeated measurements using Particle Analysis.
 Since error analysis within the last days didn't really help to solve the problem, may someone here does have a idea to help.
 Any input is highly appreciated.

 *What I want to do (briefly):*
 - perform several actions on image (duplicate, generate thresholded image)
 - generate a ROI-List using run("Analyze Particles...",...) to identify potential "particles"
 - measure several features of the generated ROI's (mean intensity, StdDev...) on the original image

 *What I observe from my code:*
 If I measure one image everything is fine. If I try to put the whole thing in a circle so measure e.g. all image sin a folder, I'm getting the "results" of the "Particle Analysis" in the results Window, although I do not explicitly ask for them. When measuring several images in a folder this is doubling ght amount of data from which 50% is waste.
 I hope you can reproduce the Error with the code fragment I provided (see below). I added some other observations I made as comments in the code.
 I'm searching for a solution for this since a few days already but I haven't been successful jet.

 Versioninfo: FIJI/ImageJ 1.46mJava 1.6.0_24 (64bit) on a Windows x64 machine (i5-2520M, 8GB, SSD).

 *A annotated fragment of macro-code to describe and reproduce my problem:*
 // open any image to process (for correct numbers see: )

 // retrieve example image to follow numbers if you want:
 // I'm using 8bit tif in the original analysis
 //open ("http://tim37.gmxhome.de/TestIMG4Macro.png");

 run("Duplicate...", "title=Mask.tif");

 setAutoThreshold("Default dark");
 setThreshold(40, 255);
 run("Convert to Mask");
 run("Watershed");

 run("Analyze Particles...", "size=20-400 circularity=0.70-1.00 show=[Overlay Masks] exclude add");
 close();

 roiManager("Measure");
 roiManager("Delete");
 // also tried with roiManager("reset");

 // to reproduce my error:
 // execute code 2 times on image (in reality I'd use two or more different images of course)
 // first execution will give 404 detected shapes
 // second execution (without closing the results window) on same image will then have 1212 reslts (!)
 // just taking an instant look it seems the measurement since it is shown all measurements are done on the image
 // (and not on the mask)
 // now store the results table as txt take a look into the file.
 // Results 405 between 808 are the result of "Mask.tif" WITHOUT(!) any ROI-ID given, afterwards, the results are given as wanted.
 // Valures of "Mask.tif" will also be added in this pattern if you repeat for more images.
 // My guess:
 // -> the function "Analyze Particles" is adding values to the results table (after processing of first image), although those values are not expicitly measured/requested...

 // Measurement works correctly if resutls table is closed after execution of code for every image (wich will lead to a lot of 1-image-result files but I'd like to have all measurement results of all images in ONE datafile (ideally with unique numbers).

 // How do i do the measurement as suggested up there without getting the results from the Analyze Particles function?

 *Other comments*
 One possible workaround would be to generate ROI-Lists for all images, then close the results-file and open and measure all images by loading ROI-file and image (without running Particle Analysis in between). But this will generate a lot of computing work. Since my problem is just how to "avoid" information, may you can help.

 Looking forward for your comments.

 Björn
Reply | Threaded
Open this post in threaded view
|

Re: Generation of unrequested results using "Particle Analysis"

TimJ
Hey everyone,

could anyone reproduce my observations?
Anyone has an idea how to alter the way of measuring?

Thank you in advance,
Bjoern


to full Article:
http://imagej.1557.n6.nabble.com/Generation-of-unrequested-results-using-quot-Particle-Analysis-quot-td4915869.html

TimJ wrote
 *What I observe from my code:*
 If I measure one image everything is fine. If I try to put the whole thing in a circle so measure e.g. all image sin a folder, I'm getting the "results" of the "Particle Analysis" in the results Window, although I do not explicitly ask for them. When measuring several images in a folder this is doubling ght amount of data from which 50% is waste.
 I hope you can reproduce the Error with the code fragment I provided (see below). I added some other observations I made as comments in the code.
 I'm searching for a solution for this since a few days already but I haven't been successful jet.
[...]
run("Duplicate...", "title=Mask.tif");

 setAutoThreshold("Default dark");
 setThreshold(40, 255);
 run("Convert to Mask");
 run("Watershed");

 run("Analyze Particles...", "size=20-400 circularity=0.70-1.00 show=[Overlay Masks] exclude add");
 close();

 roiManager("Measure");
 roiManager("Delete");