Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 42 commits into
base: develop
Choose a base branch
from

Conversation

measty
Copy link
Collaborator

@measty measty commented Feb 21, 2024

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.

Copy link

codecov bot commented Feb 21, 2024

Codecov Report

Attention: Patch coverage is 28.09917% with 174 lines in your changes missing coverage. Please review.

Project coverage is 97.92%. Comparing base (621a857) to head (7768414).
Report is 1 commits behind head on develop.

Files Patch % Lines
...ox/visualization/bokeh_app/templates/stats_plot.py 0.00% 73 Missing ⚠️
...visualization/bokeh_app/templates/bar_plot_grid.py 0.00% 45 Missing ⚠️
...ox/visualization/bokeh_app/templates/image_grid.py 0.00% 30 Missing ⚠️
tiatoolbox/visualization/bokeh_app/main.py 68.57% 19 Missing and 3 partials ⚠️
tiatoolbox/visualization/ui_utils.py 81.81% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #789      +/-   ##
===========================================
- Coverage    99.89%   97.92%   -1.98%     
===========================================
  Files           69       72       +3     
  Lines         8650     8864     +214     
  Branches      1653     1685      +32     
===========================================
+ Hits          8641     8680      +39     
- Misses           1      173     +172     
- Partials         8       11       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shaneahmed shaneahmed changed the title ENH: add reading slide-level info from provided csv 🆕 Add Reading slide-level info for Visualization tool Feb 22, 2024
@shaneahmed shaneahmed added the enhancement New feature or request label Feb 22, 2024
@shaneahmed shaneahmed added this to the Release v1.6.0 milestone Feb 22, 2024
@measty measty marked this pull request as draft March 13, 2024 16:32
@measty measty changed the title 🆕 Add Reading slide-level info for Visualization tool 🆕 Add Reading slide-level info & simple plugins for Visualization tool Mar 13, 2024
@@ -2102,6 +2170,7 @@ def setup_doc(self: DocConfig, base_doc: Document) -> tuple[Row, Tabs]:
base_doc.add_root(control_tabs)
base_doc.add_root(popup_table)
base_doc.add_root(slide_info)
base_doc.add_root(extra_layout)
base_doc.title = "Tiatoolbox Visualization Tool"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
base_doc.title = "Tiatoolbox Visualization Tool"
base_doc.title = "TIAToolbox Visualization Tool"

@@ -0,0 +1 @@
"""plugins and templates for bokeh visualization app."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""plugins and templates for bokeh visualization app."""
"""Plugins and templates for bokeh visualization app."""


Returns:
list: A list containing the new children of the extra layout
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""
"""


Returns:
list: A list containing the new children of the extra layout
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""
"""

file found within a folder for each slide.
- StatsPlot: Displays a histogram of the distributions of properties of annotations
contained within the selected box-shaped region of the slide.
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""
"""

@shaneahmed shaneahmed changed the title 🆕 Add Reading slide-level info & simple plugins for Visualization tool 🆕 Add Reading Slide-level info & Simple Plugins for Visualization Tool Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants