Login  Register

Re: can the summary table become a results table?

Posted by Rasband, Wayne (NIH/NIMH) [E] on Feb 27, 2015; 3:20am
URL: http://imagej.273.s1.nabble.com/how-to-update-ImagePlus-in-Python-tp5011768p5011796.html

On Feb 26, 2015, at 2:30 PM, Aryeh Weiss <[hidden email]> wrote:
>
> Wayne -- thank you for your explanation of the slice labels.
>
> I have a question about the Summary table generated by the analyzer.
>
> I would like to add a column to it, the way one might do with the results table.

The summary tables created by the particle analyzer are results tables. Here is a JavaScript example that creates a Summary table and adds two columns to it:

  img = IJ.openImage("http://imagej.nih.gov/ij/images/mri-stack.zip");
  title = img.getTitle();
  IJ.setAutoThreshold(img, "Huang dark");
  IJ.run(img, "Analyze Particles...", "size=1000 summarize stack");
  frame = WindowManager.getFrame("Summary of "+title);
  rt = frame.getTextPanel().getResultsTable();
  for (i=0; i<rt.size(); i++) {
     rt.setValue("Extra1", i, i*100);
     rt.setValue("Extra2", i, "Row "+(i+1));
  }
  rt.show("Summary of "+title);

-wayne


> I came up with the following:
>     IJ.renameResults("Summary", "Results")
>
>    rtSummary = ResultsTable.getResultsTable()
>
>    rtSummary.setValue("Slice", rtSummary.getCounter()-2, channelLabels[channel-1]+"_bg")
>    rtSummary.setValue("WeightedMean", rtSummary.getCounter()-2, bgMeanWeighted)
>    rtSummary.setValue("Slice", rtSummary.getCounter()-1, channelLabels[channel-1]+"_cells")
>    rtSummary.setValue("StdDev", rtSummary.getCounter()-1, stdDev)
>    IJ.renameResults("Results", "Summary")
>
> So I rename the summary table, and then I use getResultsTable() to assign it to rtSummary.
> This works -- each call to the analyzer adds to the Summary table, and then I add my items as above.
>
> It would be nice to  be able to hand the Summary table to a results table constructor, like:
> rtSummary = ResultsTable("Summary")
>
> Is there a better way to do this? (Or more correctly -- what is the best way to do this?)
>
> —aryeh



--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html