コード例 #1
0
ファイル: TableDemo.java プロジェクト: MeiChunLo/imagej
 private void createBaseballTable() {
   final double[][] data = {
     {1978, 21, .273},
     {1979, 22, .322},
     {1980, 23, .304},
     {1981, 24, .267},
     {1982, 25, .302},
     {1983, 26, .270},
     {1984, 27, .217},
     {1985, 28, .297},
     {1986, 29, .281},
     {1987, 30, .353},
     {1988, 31, .312},
     {1989, 32, .315},
     {1990, 33, .285},
     {1991, 34, .325},
     {1992, 35, .320},
     {1993, 36, .332},
     {1994, 37, .341},
     {1995, 38, .270},
     {1996, 39, .341},
     {1997, 40, .305},
     {1998, 41, .281},
   };
   baseball = new DefaultResultsTable(data[0].length, data.length);
   baseball.setColumnHeader(0, "Year");
   baseball.setColumnHeader(1, "Age");
   baseball.setColumnHeader(2, "BA");
   baseball.setRowHeader(9, "Best");
   for (int row = 0; row < data.length; row++) {
     for (int col = 0; col < data[row].length; col++) {
       baseball.setValue(col, row, data[row][col]);
     }
   }
 }
コード例 #2
0
ファイル: TableDemo.java プロジェクト: MeiChunLo/imagej
 private void createBigTable() {
   final int colCount = 10, rowCount = 10000;
   big = new DefaultResultsTable(colCount, rowCount);
   for (int col = 0; col < colCount; col++) {
     statusService.showProgress(col, colCount);
     for (int row = 0; row < rowCount; row++) {
       big.setValue(col, row, row + col);
     }
   }
 }
コード例 #3
0
 private ColorTable legacyTextLUT(final BufferedInputStream is) throws IOException {
   ResultsTable table = new TableLoader().valuesFromTextFile(is);
   if (table == null) return null;
   byte[] reds = new byte[256];
   byte[] greens = new byte[256];
   byte[] blues = new byte[256];
   int cols = table.getColumnCount();
   int rows = table.getRowCount();
   if (cols < 3 || cols > 4 || rows < 256 || rows > 258) return null;
   int x = cols == 4 ? 1 : 0;
   int y = rows > 256 ? 1 : 0;
   for (int r = 0; r < 256; r++) {
     reds[r] = (byte) table.getValue(x + 0, y + r);
     greens[r] = (byte) table.getValue(x + 1, y + r);
     blues[r] = (byte) table.getValue(x + 2, y + r);
   }
   return new ColorTable8(reds, greens, blues);
 }