These are chat archives for bigdataviewer/bigdataviewer-core

14th
Sep 2017
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 15:00
@tpietzsch Is there a method like ViewerPanel.requestRepaint, but for overlays only?
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 18:59
@tpietzsch I almost got gradient background to work for ViewerPanel by drawing a very first layer before the data in the AccumulatorProjector:
fart.png
Unfortunately, this does not work 100% as hoped (and will never do, as far as I can tell):
  • background gets re-drawn whenever viewer transform is changed (vs only when canvas size changes)
  • with the projector that I use for this example, data get accumulated by ARGB and background will "shine through"
I propse that we have three layers of rendering:
  • background that only gets drawn on changes of canvas size
  • data that gets accumulated independent of background and then will be copied into background (no blending of data and background)
  • overlays so we can re-draw overlays without re-painting the data
Christian Dietz
@dietzc
Sep 14 2017 19:04
Fart.png :-D
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 19:04
:D
look at the image and check out the title bar and icon
:D
Christian Dietz
@dietzc
Sep 14 2017 19:06
Please tell me that this is a acronym for some super useful plugin which everybody has to use
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 19:06
yes
"Fabulous Annotation and Reconstruction Tool"
or something along these lines
:D
Christian Dietz
@dietzc
Sep 14 2017 19:06
I solved this problem with fart
:-D
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 19:07
:sparkles:
Because of the issues that I listed above, I will not create a PR. For anyone who is interested, this is the commit that allows you to do such a thing in bdv:
hanslovsky/bigdataviewer-core@1237c4f
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 19:13
And this commit implements an explicit gradient background:
saalfeldlab/bigcat@c755e41
But they will be obsolete soon, anyway.
tpietzsch
@tpietzsch
Sep 14 2017 20:05
@hanslovsky just do the swing repaint. Look in ViewerPanel, there are a bunch of display.repaint();
these trigger repainting of overlays
@dietzc @hanslovsky ... "I solved this problem with fart" ... LOL
:+1:
@hanslovsky problem is that we cannot easily distiguish between what is data and what isn't
all sources are extended to infinity so basically from renderer view it's all data
currently extension happens first then conversion to ARGB
tpietzsch
@tpietzsch
Sep 14 2017 20:11
if we could do it the other way around, we could extend with ARGB constant value with alpha=0
but the the conversion to ARGB would need to happen between extension and interpolation
(ideally)
if you have full control over what sources you pass in, you can fake it
tpietzsch
@tpietzsch
Sep 14 2017 20:17
assuming something standard (nothing generated, inherently infinite, ...) wrap your Source<T>s as Source<ARGBType>.
The Source<ARGBType>.getInterpolatedSource should then
Source<T>.getSource(), convert it to ARGBType (with alpha=255), extend it with alpha=0, interpolate it
For the converter part of the SourceAndConverter you then just pass identity converter
and do the right thing in AccumulatorProjector
The only slight problem with this approach is that interpolation happens in ARGB space, not in the original T space
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 20:22
I changed the call to ViewerPanel.requestRepaint to ViewerPanel.getDisplay().repaint() and it works as expected, thank you!
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 20:49
@tpietzsch I have a method that passes the Source< ? > on to the ViewerPanel, so in principle I could convert everything to ARGBType first.
For my project, I'd like to use alpha composition of the sources. If I understand correctly, I would need to copy the pixel values of the bottom source onto the background image (gradient, ...) where the image is defined (i.e. non-zero alpha), and ignore all other pixels (zero alpha). On top of that, we would like to do alpha composition of our sources (currently, we use the CompositeProjector for that. When we have sources with different sizes, this would fail, I think. :(
Also, generating the gradient with every changed transform seems wasteful. That's why I would like to render and cache the background image separately. Then, compose all sources into another buffer via alpha composition, and finally write that composed sources buffer into the background image. This would also require that the sources are zero alpha extended.
Thinking about it, maybe that is exactly what you meant, not sure.
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 22:10
@tpietzsch I have a preliminary version that does, but with a little hack:
I modified TransformAwareBufferedImageOverlayRenderer to have a background image and I render the bufferedImage into a temporary image. In the temporary image, I replace any value that has zero alpha value or all of rgb zero.
That was just a proof of principle, and it seems to work now
That means that I can probably go about with a real working implementation tomorrow.
fart2.png
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 22:16
This is the commit:
hanslovsky/bigdataviewer-core@8bd01a1
Unfortunately, that would only work if we pre-convert the sources to ARGB and extend with zero alpha as you mentioned.
Philipp Hanslovsky
@hanslovsky
Sep 14 2017 22:22
@axtimwalde Background gradient works now, in principle, but with the restrictions as pointed out by @tpietzsch above
Stephan Saalfeld
@axtimwalde
Sep 14 2017 23:41
@hanslovsky nice. Regarding FART, this of course somehow funny but may put people off in an unintended way. I suggest to strike Fabulous (ART) or some other consonants (BigART, BART, CART, BigCART, DART, START) but not too negative or disgusting, i.e. no WART, no BigOT, no Breitbart
anyways, more interested in a direct JavaFX renderer...