bigdataviewer / bigdataviewer-core

ImgLib2-based viewer for registered SPIM stacks and more
BSD 2-Clause "Simplified" License
33 stars 35 forks source link

Generic renderer revised #99

Closed tpietzsch closed 4 years ago

tpietzsch commented 4 years ago

This PR incorporates many ideas from #59, mainly the new methods ViewerPanel.requestRepaint(Interval) and MultiResolutionRenderer.requestRepaint(Interval) which trigger a re-rendering of parts of the screen.

One goal of #59 was to make BDV more re-usable for paintera. All AWT specifics have been removed from MultiResolutionRenderer to make that possible.

The other major change is the purge of the imglib2-ui dependency. The imglib2-ui classes have been incorporated into BDV, slimmed down, simplified, and some bugs fixed. This leads to API breakage, because classes have moved to different packages. For example net.imglib2.ui.OverlayRenderer is now bdv.viewer.OverlayRenderer, net.imglib2.ui.TransformListener is now bdv.viewer.TransformListener, etc.

Other minor API breakage occurs because listeners have been replaced to use https://github.com/scijava/scijava-listeners. For example, instead of viewer.getDisplay().removeOverlayRenderer( o ), it is now viewer.getDisplay().overlays().remove( o ). Where it was easy the old methods have been left in and deprecated.

TransformEventHandlers have been revised to always be based on https://github.com/scijava/ui-behaviour. With https://github.com/scijava/ui-behaviour-javafx, this should also make re-use easier in paintera.

To get an idea of the necessary change it is, here are the changes required in vistools: https://github.com/bigdataviewer/bigdataviewer-vistools/pull/45/commits/6b05ad87abb8db3caae025a79a65e8d2f56f8360

The rendering projectors have been revised to directly manipulate the int[] arrays underlying the rendered ArrayImg<ARGBType>s (with fallback to the old behaviour if the rendered RAIs are not of that type). This speeds up rendering overall, in particular blending of multiple sources.