Search in sources :

Example 1 with DefaultResultsTable

use of net.imagej.table.DefaultResultsTable in project imagej-plugins-commands by imagej.

the class TableDemo method createBigTable.

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);
        }
    }
}
Also used : DefaultResultsTable(net.imagej.table.DefaultResultsTable)

Example 2 with DefaultResultsTable

use of net.imagej.table.DefaultResultsTable in project imagej-plugins-commands by imagej.

the class ShowLUTAsTable method run.

// -- Command methods --
@Override
public void run() {
    final DatasetView view = imgDispService.getActiveDatasetView(display);
    final List<ColorTable> colorTables = view.getColorTables();
    final Position planePos = view.getPlanePosition();
    long pos = planePos.getIndex();
    if (pos < 0 || pos >= colorTables.size())
        pos = 0;
    final ColorTable colorTable = colorTables.get((int) pos);
    final int rowCount = colorTable.getLength();
    final int componentCount = colorTable.getComponentCount();
    final int colCount = componentCount + 1;
    table = new DefaultResultsTable(colCount, rowCount);
    table.setColumnHeader(0, "Index");
    // use here.
    for (int x = 0; x < componentCount; x++) {
        table.setColumnHeader(x + 1, "CH" + x);
    }
    // fill in values
    for (int y = 0; y < rowCount; y++) {
        table.setValue(0, y, y);
        for (int x = 0; x < componentCount; x++) {
            final double value = colorTable.get(x, y);
            table.setValue(x + 1, y, value);
        }
    }
}
Also used : DatasetView(net.imagej.display.DatasetView) DefaultResultsTable(net.imagej.table.DefaultResultsTable) Position(net.imagej.Position) ColorTable(net.imglib2.display.ColorTable)

Example 3 with DefaultResultsTable

use of net.imagej.table.DefaultResultsTable in project imagej-plugins-commands by imagej.

the class TableDemo method createBaseballTable.

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]);
        }
    }
}
Also used : DefaultResultsTable(net.imagej.table.DefaultResultsTable)

Aggregations

DefaultResultsTable (net.imagej.table.DefaultResultsTable)3 Position (net.imagej.Position)1 DatasetView (net.imagej.display.DatasetView)1 ColorTable (net.imglib2.display.ColorTable)1