Much faster creation & rendering of complex ROIs by petebankhead · Pull Request #1777 · qupath/qupath

@petebankhead

Inspired by CoverageUnion not quite working... it was very fast, but gave invalid results.
This code (still needs cleaned up!) avoids unioning many polygons by instead delaying polygonization until the final step.
This allows us to remove duplicates along tile boundaries before passing *everything* to a `Polygonizer`.

There is probably still scope for some optimizations (e.g. replacing `LineDissolver`) and a need to clean up the code and update the comments. But currently it shortens the time to trace ~8 million vertices to ~25 seconds on my laptop, rather than >> 100 seconds.

So committing this code now, lest I break it too badly...

@petebankhead

@petebankhead

This is especially important when displaying complex polygons in the viewer.
Squeezing out a bit more performance.
Readability suffering further...

@petebankhead

@petebankhead

@petebankhead

Calculate sequentially across downsamples & also improve caching.
Drop small regions/holes that aren't visible.

@petebankhead

@petebankhead

This speeds up the responsiveness of object lists

@petebankhead petebankhead changed the title Initial speed improvements for ContourTracing Much faster creation & rendering of complex ROIs

Mar 1, 2025

@petebankhead

This was referenced

Mar 2, 2025

Rylern