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

Vectortile investigation #227

Closed
wants to merge 19 commits into from

Conversation

will-moore
Copy link
Member

@will-moore will-moore commented Jan 29, 2019

This is the first steps towards support of large numbers of ROIs in iviewer.

It uses a OpenLayers VectorTile layer to load shapes by tile.
NB: since we can't (yet) query Polygons by x & y coordinates, I used a hack for the DB query: I used a script (https://gist.github.com/will-moore/1255b6675b229fe799b2bb0b0f632ffc) to take each Polygon, Polyline, Retangle or Line find the centre point and create a Point at that location with the Polygon ID as the Shape label. This allowed me to query for Points within a tile, get the text (Shape ID) from each and to then get the Shapes within that tile. (Don't need to do this for Ellipses since they already have centre point).

This allows us to browse Shapes on images with large numbers of ROIs (see screenshot).
In this case, I had 22792 Polygons (from Orbit) and I created a Point for each (45584 ROIs in total).

See limitations below...

screen shot 2019-01-29 at 04 01 37

Limitations / questions:

  • This approach is only worth pursuing if we can expect to support spacial DB queries (PostGIS) in the near future?
  • Currently we only allow loading of Shapes for the 100% zoom level. We don't have a "Pyramid" of objects as we do for tiles. If we want to be able to browse the whole image to see which regions have some ROIs in them, we'll need to think how to store a Pyramid of ROIs. Currently, clicking on a shape in the ROI Table browses to that shape at 100% zoom so you can see it.
  • In this PR, if the image has more ROIs than a single "page" then we use a VectorTile layer and TiledRegions source instead of the Vector layer and source/Regions class. This means that all the shape drawing and manipulation code in the source/Regions class is not available, so we can't drag, edit or draw shapes. If we want to support this in future we could possibly:
    • Use a VectorTile layer for showing existing shapes and add a Vector layer + Regions overlay to allow drawing new shapes.
    • OR investigate the drawing and editing of shapes in a TiledRegions source. This would probably involve splitting the existing source/Regions class to separate the drawing & editing code from the ol.source.Vector base class to allow reuse. Possibly a lot of refactoring!

As discussed with @jburel, it's worth pursuing this work ahead of the backend DB support, in order to work out what the API needs to support.

Testing

I have imported the big svs image above and added ROIs from Obit: http://web-dev-merge.openmicroscopy.org/webclient/?show=image-160953 (user-3). Also I have created a multi-T image with lots of ROIs at http://web-dev-merge.openmicroscopy.org/webclient/?show=image-160872 (user-3) and populated it with ~17k ROIs generated by an ImageJ "Analyse Particles" script. Then I ran the rois_to_centre_points.py script (see link above) to create centre points for querying shapes by coordinates.

  • Open the image in iviewer. Should see ~34k ROI count (Polygons etc + Points)
  • Loading ROIs tab should load the first 500 ROIs as before, but with pagination controls that let you choose subsequent pages of ROIs.
  • Then the centre panel loads ROI tiles for current T index.
  • Moving through T should load ROI on the image for new Time-point.
  • Pagination controls above the ROI table should work as expected (previous < and next > buttons and a range slider) and reload ROIs for the chosen page.
  • Clicking Shapes in the ROI table should take you to that shape and show it selected. NB: the second half of all ROIs are Points used for querying other shapes and these don't show up on the image, but they do show up in the table for pages above page_count/2. Clicking these Points causes an error).
  • Clicking Shapes on the Image should select them and highlight the corresponding shape in the table (IF that shape is currently loaded in the table) - TODO: jump to the correct page of table.
  • Check that Tiled shapes look similar to the same shapes in an image with < 500 ROIs: http://web-dev-merge.openmicroscopy.org/webclient/img_detail/160951/. I ran the same scripts to create ROIs and add centre points on this image - you can see the centre-points.
  • See that show/hide of shapes is working (commits today - not in Tuesday's build)
  • Known issue: Labels aren't scaled correctly for Tiled ROIs - we don't have access to the image's scale in the same was as for Vector layer.
  • No creation or editing of ROIs is currently possible if > 500 ROIs. Otherwise this should behave as normal.

@will-moore
Copy link
Member Author

This was just to aid the discussion at ome/design#99, not to be merged or tested yet...

@will-moore
Copy link
Member Author

As discussed with @jburel, the ROI table pagination alone is a big win (allows access to all ROIs) and could be released ahead of the ROI Tiling. Moved that to #231.

@will-moore will-moore closed this Feb 6, 2019
will-moore added a commit to will-moore/omero-iviewer that referenced this pull request Feb 21, 2019
will-moore added a commit to will-moore/omero-iviewer that referenced this pull request Feb 21, 2019
@will-moore will-moore mentioned this pull request Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant