You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Intended for reading cuboid blocks out of an integral image.
20
+
*
21
+
* @author Albert Cardona
22
+
*
23
+
* @param <I> The {@code Type} of the {@code RandomAccessible} from which to read blocks.
24
+
*/
25
+
publicfinalclassBlockReadSource< IextendsRealType< I > > extendsViewableFunctionimplementsIFunction, RandomAccessOnly< I >
26
+
{
27
+
finalprivateRandomAccessible< I > src;
28
+
finalprivatelong[][] corners;
29
+
finalprivatebyte[] signs;
30
+
31
+
/**
32
+
* A block centered on a particular pixel.
33
+
*
34
+
* @param src A {@code RandomAccessible} such as an @{code IntegralImg}, presumably a {@code RandomAccessibleInterval} that was extended with an {@code OutOfBounds} strategy.
35
+
* @param blockRadius Array of half of the length of each side of the block.
36
+
*/
37
+
publicBlockReadSource( finalRandomAccessible< I > src, finallong[] blockRadius )
// All possible combinations to define all corners, sorted with lower dimensions being the slower-moving,
43
+
// following Gray code (see https://en.wikipedia.org/wiki/Gray_code )
44
+
for (intd = 0; d < src.numDimensions(); ++d )
45
+
{
46
+
finalintcycle = corners.length / ( int )Math.pow( 2, d + 1 );
47
+
longinc = blockRadius[ d ];
48
+
for (inti = 0; i < corners.length; ++i )
49
+
{
50
+
if ( 0 == i % cycle) inc *= -1;
51
+
corners[ i ][ d ] = inc;
52
+
//System.out.println("corners[" + i + "][" + d + "] = " + corners[i][d]);
53
+
}
54
+
}
55
+
this.signs = BlockReadSource.signsArray( src );
56
+
//for (int i=0; i<signs.length; ++i)
57
+
// System.out.println("signs[" + i + "] = " + signs[i]);
58
+
}
59
+
60
+
/**
61
+
* A block centered on a particular pixel.
62
+
*
63
+
* @param src A {@code RandomAccessible} such as an @{code IntegralImg}, presumably a {@code RandomAccessibleInterval} that was extended with an {@code OutOfBounds} strategy.
64
+
* @param blockRadius Half of the length of the side of the block in every dimension.
65
+
*/
66
+
publicBlockReadSource( finalRandomAccessible< I > src, finallongblockRadius )
0 commit comments