Login  Register

Re: Transpose Table in Image J help

Posted by Rasband, Wayne (NIH/NIMH) [E] on Oct 03, 2015; 4:02am
URL: http://imagej.273.s1.nabble.com/Transpose-Table-in-Image-J-help-tp5014534p5014537.html

> On Oct 2, 2015, at 7:10 PM, Jacob Lewis <[hidden email]> wrote:
>
> Hi All,
>
> I am using the multi-measure tool in ROI manager, the table format it produces does not work with the plug in written for our group I was wondering if anyone could help with this. I need to transpose the table from default Image J columns to rows.
>
> Any help our advise would be much appreciated.

Hi Jacob,

The following JavaScript code transposes the the Results table. You will need to upgrade to the latest daily build (1.50d6) to transpose tables that have a "Label" column.

-wayne

  rt1 = Analyzer.getResultsTable();
  rt2 = new ResultsTable();
  hdr = rt1.getHeadings();
  for (i=0; i<rt1.getCounter(); i++) {
     for (j=0; j<hdr.length; j++) {
        if (i==0) rt2.setValue("Column", j, hdr[j])
        value = rt1.getStringValue(hdr[j], i);
        rt2.setValue(""+(i+1), j, value)
     }
  }
  rt2.showRowNumbers(false);
  rt2.show("Results");
     

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