mobie / mobie-viewer-fiji

BSD 2-Clause "Simplified" License
30 stars 12 forks source link

Sort and filter table rows #65

Closed constantinpape closed 3 years ago

constantinpape commented 4 years ago

Add functionality to filter table rows by a threshold and sort the remaining entries.

constantinpape commented 4 years ago

This Feature Request arose from some mis-understanding of a panel in Figure7. I think this would still be nice to have, but we can put it on low priority.

imagejan commented 4 years ago

@constantinpape wrote:

functionality to filter table rows by a threshold and sort the remaining entries.

Is this generic functionality that could live in scijava-table, so that other projects can benefit from it as well?

(Sorry if this doesn't apply, I don't know details of how tables work in MMB.)

constantinpape commented 4 years ago

@constantinpape wrote:

functionality to filter table rows by a threshold and sort the remaining entries.

Is this generic functionality that could live in scijava-table, so that other projects can benefit from it as well?

I think yes, but I am not quite sure if @tischi is using scijave-table internally right now.

(Sorry if this doesn't apply, I don't know details of how tables work in MMB.)

We want this to be a useful and versatile resource for big image data-sets and every improvement we can contribute to upstream dependencies is definitely relevant.

(Side Note: We will probably focus on contributing some of the developments we needed to make to BigDataViewer first (esp. streaming n5 data from an aws bucket). For tables we still want to support some more functionality: loading tables from databases and lazy loading of the tables, so the table mechanism is still a bit WIP.)

tischi commented 3 years ago

Sorting is part of the JTable UI, little arrows on top, so that should be OK?!

Filtering would be nice though, seems to be easy enough: https://stackoverflow.com/questions/1107911/how-can-i-filter-rows-in-a-jtable

@imagejan what's the advantage of scijava-table over a "normal" JTable?

imagejan commented 3 years ago

@tischi javax.swing.JTable is part of the Java Swing UI, whereas scijava-table is entirely UI-agnostic (and the org.scijava.ui.swing.viewer.table package contains code to display tables in the Swing UI).

The separation of functionality and UI is useful e.g. in headless environment where there's no UI available. If we had e.g. sorting or filtering functionality in scijava-table, this could be useful for SciJava/ImageJ2 plugins that run in different contexts, e.g. as an auto-generated KNIME node, an Icy plugin, or via pyimagej etc.

tischi commented 3 years ago

@imagejan ok, cool! thanks for the information! Are there some projects that use the scijava table, which I could use for inspiration? For example, I think Mastodon and Bigstitcher should have quite some table functionalities, are they using scijava-table?

imagejan commented 3 years ago

I'm aware of these projects using org.scijava.table.Table:

tischi commented 3 years ago

Thanks a lot! I will have a look!

We'll need to attach KeyListeners, a RowColorModel and a RowSelectionModel to the table to enable such functionality:

https://www.youtube.com/watch?v=HENo-vq-6to

Any feeling for how easy that would be and whether this is within scope of scijava-table?

tischi commented 3 years ago

@imagejan I had a bit of a look and thought.

My current table model essentially is a List< TableRow > (see here: https://github.com/tischi/imagej-utils/tree/master/src/main/java/de/embl/cba/tables/tablerow). This design is at the heart of all the visualisations in the MoBIE project. The current architecture was the result of about 7 days uninterrupted hard work with little sleep and quite some consultancy from Tobias Pietzsch during a Fiji hackathon.

I am not 100% happy with the current design and it could be redesigned. Especially the JTable based view of the List< TableRow > currently is not done well at all (https://github.com/tischi/imagej-utils/blob/master/src/main/java/de/embl/cba/tables/view/TableRowsTableView.java). It would be great if such a redesign would be implemented in the scijava framework. On a subsequent hackathon I started some baby steps in this direction with @frauzufall but we did not get very far due to too many distractions.

Long story short, I think a proper redesign of my current architecture could be worthwhile, but I think realistically one would need a hackathon of at least 5 days where a couple of people only work on this together.

What do you think?

frauzufall commented 3 years ago

@tischi the LabelEditor has a LabelEditorTable which is synchronized with the labels in BDV. I copied the table implementation from our juglab/scijava-table-playground into the LabelEditor - it is a very basic version of your interactive tables, but based on scijava-table. It cannot sort, filtering should work though by clicking at the headers. But maybe still helpful in some way :shrug: I'd be very happy to continue to work on this jointly so that the table part I copied is properly released / integrated somewhere in the core and useful for others.

constantinpape commented 3 years ago

Closed in favor of #337