bigdataviewer / bigdataviewer-vistools

Helpers to use BigDataViewer as a quick visualization tool in other projects.
BSD 2-Clause "Simplified" License
25 stars 17 forks source link

infinite source can skip renderer's bounding box intersection test #47

Closed bogovicj closed 4 years ago

bogovicj commented 4 years ago

Depends on: https://github.com/bigdataviewer/bigdataviewer-core/pull/110

Added a constructor to RandomAccessibleSource setting the value of an immutable flag.

Example

Test with the following:

FunctionRandomAccessible ra = new FunctionRandomAccessible<>( 3, 
            (x,v) -> v.set( x.getDoublePosition( 0 )) , 
            DoubleType::new );

RandomAccessibleSource srcFlag = new RandomAccessibleSource( 
        ra,
        new FinalInterval(50,50,50),
        new DoubleType(),
        "xcoord");

RandomAccessibleSource srcNoFlag = new RandomAccessibleSource( 
        ra,
        new FinalInterval(50,50,50),
        new DoubleType(),
        new AffineTransform3D(),
        "xcoord",
        false );

BdvStackSource bdv = BdvFunctions.show( srcFlag );
bdv.setDisplayRangeBounds( 0, 100 );

bdv = BdvFunctions.show( srcNoFlag, BdvOptions.options().addTo( bdv ));
bdv.setDisplayRangeBounds( 0, 100 );
tpietzsch commented 4 years ago

Why is the default doBoundingBoxCulling true for RandomAccessibleSource, but false for RealRandomAccessibleIntervalSource and RandomAccessibleSource4D?

In my opinion, the default should be true for ***IntervalSource and false for the others?

For completeness, could you also do the remaining RandomAccessibleIntervalMipmapSource RandomAccessibleIntervalSource RandomAccessibleIntervalSource4D VolatileRandomAccessibleIntervalMipmapSource?

I would add the doBoundingBoxCulling field and method override to AbstractSource, and then just pass constructor parameters from the above ***Source (which all extend AbstractSource)

bogovicj commented 4 years ago

Thanks @tpietzsch

I would add the doBoundingBoxCulling field and method override to AbstractSource, and then just pass constructor parameters from the above ***Source (which all extend AbstractSource)

Done. The ***IntervalSources now default to true, because that is the default state of the flag in AbstractSource. Others default to false - meaning constructors that don't take the flag as an argument set it to false.

One different case is RealRandomAccessibleIntervalSource, which defaults to false like the non-Interval sources. When @axtimwalde and I talked, we thought this made sense.

Why is the default doBoundingBoxCulling true for RandomAccessibleSource, but false for RealRandomAccessibleIntervalSource and RandomAccessibleSource4D?

My mistake. Fixed now. (My initial draft had the flag mean "skip", then switched it to "do" and I got confused / that flag got lost :-/ thanks for catching).

tpietzsch commented 4 years ago

thanks!