Hi,
I am finding it difficult to figure out how to access the summary window via a Java plugin. I am able to access the ResultsTable from the ParticleAnalyzer but nowhere on any website or tutorial does it say anything about getting the summary. Anyone know how ? Thanks. -- George -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Aug 13, 2014, at 9:44 AM, George H wrote:
> Hi, > > I am finding it difficult to figure out how to access the summary window > via a Java plugin. I am able to access the ResultsTable from the > ParticleAnalyzer but nowhere on any website or tutorial does it say > anything about getting the summary. > > Anyone know how ? In the latest ImageJ daily build (1.49f5), the particle analyzer's "Summary" window has an associated ResultsTable and has "Rename" and "Duplicate" commands in its File and contextual (right-click) menus. The following JavaScript and macro examples run the particle analyzer on the 129 slice "T1 Head" sample stack and extract the particle count and percent area values from the "Summary" window. -wayne // JavaScript example imp = IJ.openImage("http://imagej.nih.gov/ij/images/t1-head.zip"); imp.setSlice(imp.getStackSize()/2); IJ.setAutoThreshold(imp, "Default dark"); IJ.run(imp, "Analyze Particles...", " clear summarize stack"); frame = WindowManager.getFrame("Summary of "+imp.getTitle()); rt = frame.getTextPanel().getResultsTable(); for (i=0; i<rt.size(); i++) { str = "count="+rt.getValue("Count",i); str += ", %area="+IJ.d2s(rt.getValue("%Area",i),2); print((i+1) + ": " + str); } // Macro example run("T1 Head (2.4M, 16-bits)"); setAutoThreshold("Default dark"); run("Analyze Particles...", " clear summarize stack"); IJ.renameResults("Results"); for (i=0; i<nResults; i++) { str = "count="+getResult("Count",i); str += ", %area="+d2s(getResult("%Area",i),2); print((i+1) + ": " + str); } -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thanks Wayne.
I also found out of the "Summarize" command that will add a summary at the end of your results table. I also figured out that in batch mode the summary window does not get hidden. Maybe that should be added in a future version of ImageJ. Thanks. -- George [hidden email] On Thu, Aug 14, 2014 at 5:20 AM, Rasband, Wayne (NIH/NIMH) [E] < [hidden email]> wrote: > On Aug 13, 2014, at 9:44 AM, George H wrote: > > > Hi, > > > > I am finding it difficult to figure out how to access the summary window > > via a Java plugin. I am able to access the ResultsTable from the > > ParticleAnalyzer but nowhere on any website or tutorial does it say > > anything about getting the summary. > > > > Anyone know how ? > > In the latest ImageJ daily build (1.49f5), the particle analyzer's > "Summary" window has an associated ResultsTable and has "Rename" and > "Duplicate" commands in its File and contextual (right-click) menus. The > following JavaScript and macro examples run the particle analyzer on the > 129 slice "T1 Head" sample stack and extract the particle count and percent > area values from the "Summary" window. > > -wayne > > // JavaScript example > imp = IJ.openImage("http://imagej.nih.gov/ij/images/t1-head.zip"); > imp.setSlice(imp.getStackSize()/2); > IJ.setAutoThreshold(imp, "Default dark"); > IJ.run(imp, "Analyze Particles...", " clear summarize stack"); > frame = WindowManager.getFrame("Summary of "+imp.getTitle()); > rt = frame.getTextPanel().getResultsTable(); > for (i=0; i<rt.size(); i++) { > str = "count="+rt.getValue("Count",i); > str += ", %area="+IJ.d2s(rt.getValue("%Area",i),2); > print((i+1) + ": " + str); > } > > // Macro example > run("T1 Head (2.4M, 16-bits)"); > setAutoThreshold("Default dark"); > run("Analyze Particles...", " clear summarize stack"); > IJ.renameResults("Results"); > for (i=0; i<nResults; i++) { > str = "count="+getResult("Count",i); > str += ", %area="+d2s(getResult("%Area",i),2); > print((i+1) + ": " + str); > } > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |