imagej / imagej/imagej-notebook
Add display function for ImageJ2 tables
- Dominant language
- Java
- Stars
- 4
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Beaker is so badass: it displays `List` of `List` as nicely formatted tables. It also displays `Map` as tables. Similarly, we want to display ImageJ2 `Table` implementations as nicely formatted tables in the same way. It _almost_ works, because a `Table` is a `List` of `Column` and a `Column` is a `List` of some type of object.
Suppose we have the following ImageJ2 table:

In Beaker, the table looks like:

Which it shows in plaintext as:
```json
{"type":"TableDisplay","columnNames":["c0","c1","c2","c3"],"values":[["Shanghai","Karachi","Bejing","Sao Paolo"],[24256800,23500000,21516000,21292893]],"subtype":"Matrix"}
```
One easy way of fixing this issue would be to implement a `NotebookService` method `display(Table)` which pivots the table, so that Beaker does the right thing. It probably also needs to do something so that the column header names are detected correctly; more investigation needed.
For ease of testing later, here is some code that generates the above table (stolen from @haesleinhuepf's lovely tables tutorial):
```groovy
import net.imagej.table.*
// we create two columns
GenericColumn nameColumn = new GenericColumn("Town");
DoubleColumn populationColumn = new DoubleColumn("Population");
// we fill the columns with information about the largest towns in the world.
nameColumn.add("Karachi");
populationColumn.add(23500000.0d);
nameColumn.add("Bejing");
populationColumn.add(21516000.0d);
nameColumn.add("Sao Paolo");
populationColumn.add(21292893.0d);
// but actually, the largest town is Shanghai,
// so let's add it at the beginning of the table.
nameColumn.add(0, "Shanghai");
populationColumn.add(0, 24256800.0d);
// After filling the columns, you can create a table
table = new DefaultGenericTable();
// and add the columns to that table
table.add(nameColumn);
table.add(populationColumn);
table
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the NotebookService display methods and reproduce the provided Groovy example with an ImageJ2 Table. Investigate how the table is pivoted and how column headers are detected, then verify that Beaker displays the table with the expected headers and values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100