tiatoolbox icon indicating copy to clipboard operation
tiatoolbox copied to clipboard

🆕 Add Reading Slide-level info & Simple Plugins for Visualization Tool

Open measty opened this issue 1 year ago • 1 comments

This PR adds in a feature from the most recent version of TIAViz to allow a .csv to be provided in the slides folder that can contain slide level predictions or ground truth labels/other slide level info.

When loading a slide in the UI, if the slide name (including suffix) appears in the "Image File" column of the .csv, any information in the corresponding row of the .csv will appear in the UI below the main window in a nicely formatted string.

Only the "Image File" column is required for this to work, the rest of the columns can be anything you need to have displayed.

Also adds entry in documentation describing feature.

In response to Mostafa's request for more flexibility in what sort of extra info you can add to the UI, i've also added some basic plugin functionality to this PR (and converted to draft for now as it has become much larger and needs tests/docs to be added over the coming weeks, and may be tweaked a bit).

Plugins are defined as a class following an ABC and can add a collection of bokeh UI elements and/or plots below the main view window (and can potentially also insert additional UI elements into the main controls section). This is pretty flexible and can add some quite complex extras in there as you have all the power of bokeh to work with.

I have added 3 pre-built plugins that will cover some use-cases, and provide examples which users can adapt or take inspiration from to make their own custom plugin.

The 3 provided are: ImageGrid: if each slide has a folder of images associated with it, this plugin will show the images in a grid-like layout below the slide view window. BarPLotGrid: makes a gridlike layout of bar charts from csv files associated with each slide StatsPlot: adds some UI elements to show a histogram showing the distribution of a property over the annotations in the selected box on the slide window

To add plugins when launching the tool, you can add one or more --plugin arguments each with a path pointing to the file where the plugin class is.

measty avatar Feb 21 '24 16:02 measty

Codecov Report

:x: Patch coverage is 22.60870% with 178 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 97.39%. Comparing base (adc18c9) to head (709c90f).

Files with missing lines Patch % Lines
...ox/visualization/bokeh_app/templates/stats_plot.py 0.00% 73 Missing :warning:
...visualization/bokeh_app/templates/bar_plot_grid.py 0.00% 44 Missing :warning:
...ox/visualization/bokeh_app/templates/image_grid.py 0.00% 30 Missing :warning:
tiatoolbox/visualization/bokeh_app/main.py 54.23% 21 Missing and 6 partials :warning:
tiatoolbox/visualization/ui_utils.py 81.81% 4 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #789      +/-   ##
===========================================
- Coverage    99.27%   97.39%   -1.89%     
===========================================
  Files           71       74       +3     
  Lines         9162     9375     +213     
  Branches      1195     1219      +24     
===========================================
+ Hits          9096     9131      +35     
- Misses          40      212     +172     
- Partials        26       32       +6     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Feb 21 '24 17:02 codecov[bot]