Dear All,
within a macro I need to execute "Analyze Particles..." by using a predefined size threshold (I call it "myDim") (command line = run("Analyze Particles...", "size=myDim-Infinity display exclude include add");). The macro analyzes an array of single images. When the macro encounters an image with no particles having size > myDim (and hence the Results table is empty), the macro stops and the window appears "The list is empty". This happens even if I write a conditional statement if (nResults > 0) { ... (statement) } I am using ImageJ 1.49v on a PC (Windows 7, Lenovo). I thank all that can help. Yours Stefano -- Dr. Stefano Morara Neuroscience Institute - C.N.R. c/o Dep. BIOMETRA, University of Milano Via Vanvitelli 32 20129 Milano ITALY -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Stefano,
Looking at the code snippet it seems you are using the ROI manager and probably have to check if the ROI manager is empty and not if the Results table is empty If (roiManager("count") > 0) { ... (statement) } Kees -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of s.morara Sent: 24 May 2016 19:10 To: [hidden email] Subject: Analyze Particles: "the list is empty" Dear All, within a macro I need to execute "Analyze Particles..." by using a predefined size threshold (I call it "myDim") (command line = run("Analyze Particles...", "size=myDim-Infinity display exclude include add");). The macro analyzes an array of single images. When the macro encounters an image with no particles having size > myDim (and hence the Results table is empty), the macro stops and the window appears "The list is empty". This happens even if I write a conditional statement if (nResults > 0) { ... (statement) } I am using ImageJ 1.49v on a PC (Windows 7, Lenovo). I thank all that can help. Yours Stefano -- Dr. Stefano Morara Neuroscience Institute - C.N.R. c/o Dep. BIOMETRA, University of Milano Via Vanvitelli 32 20129 Milano ITALY -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi there
I am having a similar problem and Haven't solved it yet. Basically a Macro is analyzing particles that can sometimes be empty. I was thinking to use : if (nResults == 0) { //do nothing } else { //Save the results } Would it be the best Approach?? A similar problem also occurs with the ROI. By using Image Calculator and AND function it can results in empty images. In this case the ROI can be saved but is empty which causes an error when trying to open it. Is there a way to Save an empty ROI? Maybe Should I use a dummy ROI if (CurrentSelection<0){ Makerestangle(floor(random*ImageWidth),floor(Random*ImageHeight),1,1); // Select a random pixel // Save as ROI } else { // Save the current selection (non empty) as ROI } Any tips would be appreciated |
This post was updated on .
Here are several walk around the problem:
1- Do not display the results. The Summary does not block the Macro so you can display the summary if you just need the counts and NOT need the detailed Particles data run("Analyze Particles...", "size=&MinParticleArea-&MaxParticleArea circularity=&MinParticleCircularity-&MaxParticleCircularity show=[Overlay Masks] summarize");With Min and Max MinParticleArea and Particle Circularity being pre-defined integers. 2- You can Clear the results and add a dummy value to the results table run("Clear Results"); setResult("Area",nResults,"0"); // Add a Dummy results line in the column area run("Analyze Particles...", "size=&MinParticleArea-&MaxParticleArea circularity=&MinParticleCircularity-&MaxParticleCircularity show=[Overlay Masks] display summarize"); // Do not use clear results IJ.deleteRows(0, 0); // Delete the Dummy Row from the ResultsAnalyze Particle should no longer stop in case no particle is detected. |
Free forum by Nabble | Edit this page |