Class IterateVoxelsBoundingBox
Object
IterateVoxelsBoundingBox
Utilities for iterating over the subset of image voxels within a bounding-box.
The utilities operate on one or more Voxels
. A processor is called on each selected
voxel.
- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
withBuffer
(BoundingBox box, Voxels<T> voxels, ProcessBufferUnary<T> process) Iterate over each voxel in a bounding-box - with one associated buffer for each slicestatic void
withCursor
(BinaryVoxels<UnsignedByteBuffer> voxels, BoundingBox box, KernelApplicationParameters parameters, ProcessKernelPointCursor process) Iterate over each voxel in a bounding-box using aKernelPointCursor
.static boolean
withCursorUntil
(BinaryVoxels<UnsignedByteBuffer> voxels, BoundingBox box, KernelApplicationParameters parameters, PredicateKernelPointCursor predicate) Iterate over each voxel in a bounding-box using aKernelPointCursor
until a predicate returns true..static void
withMatchingPoints
(BoundingBox box, Predicate<Point3i> predicate, ProcessPoint process) Iterate over each voxel in a bounding-box that matches a predicate.static void
withPoint
(BoundingBox box, ProcessPoint process) Iterate over each voxel in a bounding-boxstatic void
withPointAndIndex
(BoundingBox box, ProcessPointAndIndex process) Iterate over each voxel in a bounding-boxstatic <T> void
withThreeBuffers
(BoundingBox box, ReadableTuple3i shiftForSecond, ReadableTuple3i shiftForThird, Voxels<T> voxels1, Voxels<T> voxels2, Voxels<T> voxels3, ProcessBufferTernary<T> process) Iterate over each voxel in a bounding-box - with three associated buffers for each slice.static <T> void
withTwoBuffers
(BoundingBox box, ReadableTuple3i shiftForSecond, Voxels<T> voxels1, Voxels<T> voxels2, ProcessBufferBinary<T, T> process) Iterate over each voxel in a bounding-box - with two associated buffers for each slice, oneVoxelBuffer
and oneBuffer
withTwoBuffersUntil
(BoundingBox box, ReadableTuple3i shiftForSecond, Voxels<T> voxels1, Voxels<T> voxels2, PredicateBufferBinary<T> predicate) Iterate over each voxel in a bounding-box - with two associated buffers for each slice - until a predicate evaluates to true.static <S,
T> void withTwoMixedBuffers
(BoundingBox box, ReadableTuple3i shiftForSecond, Voxels<S> voxels1, Voxels<T> voxels2, ProcessBufferBinaryMixed<S, T> process) Iterate over each voxel in a bounding-box - with two associated buffers for each slice.
-
Method Details
-
withPoint
Iterate over each voxel in a bounding-box- Parameters:
box
- the box that is used as a condition on what voxels to iterate i.e. only voxels within these boundsprocess
- is called for each voxel within the bounding-box using global coordinates.
-
withPointAndIndex
Iterate over each voxel in a bounding-box- Parameters:
box
- the box that is used as a condition on what voxels to iterate i.e. only voxels within these boundsprocess
- is called for each voxel within the bounding-box using global coordinates.
-
withMatchingPoints
public static void withMatchingPoints(BoundingBox box, Predicate<Point3i> predicate, ProcessPoint process) Iterate over each voxel in a bounding-box that matches a predicate.- Parameters:
box
- the box that is used as a condition on what voxels to iterate i.e. only voxels within these boundspredicate
- only voxels that match this predicate are processed.process
- is called for each voxel that matchespredicate
within the bounding-box using global coordinates.
-
withBuffer
Iterate over each voxel in a bounding-box - with one associated buffer for each slice- Type Parameters:
T
- buffer-type for voxels- Parameters:
box
- the box that is used as a condition on what voxels to iterate i.e. only voxels within these boundsvoxels
- voxels in which which {code box} refers to a subregion.process
- is called for each voxel within the bounding-box using global coordinates.
-
withTwoBuffers
public static <T> void withTwoBuffers(BoundingBox box, ReadableTuple3i shiftForSecond, Voxels<T> voxels1, Voxels<T> voxels2, ProcessBufferBinary<T, T> process) Iterate over each voxel in a bounding-box - with two associated buffers for each slice, oneVoxelBuffer
and oneBuffer
- Type Parameters:
T
- buffer-type for voxels- Parameters:
box
- the box that is used as a condition on what voxels to iterate i.e. only voxels within these boundsshiftForSecond
- added to the current point invoxels1
to give a corresponding point invoxels2
.voxels1
- voxels in which whichbox
refers to a subregion.voxels2
- voxels in which whichbox + shiftForSecond
refers to a subregion.process
- is called for each voxel within the bounding-box where the point uses global coordinates without the shift. A newPoint3i
is not created on each iteration.
-
withTwoMixedBuffers
public static <S,T> void withTwoMixedBuffers(BoundingBox box, ReadableTuple3i shiftForSecond, Voxels<S> voxels1, Voxels<T> voxels2, ProcessBufferBinaryMixed<S, T> process) Iterate over each voxel in a bounding-box - with two associated buffers for each slice.- Type Parameters:
S
- buffer-type for the voxel-buffer forvoxels1
).T
- buffer-type for the buffer (forvoxels2
).- Parameters:
box
- the box that is used as a condition on what voxels to iterate i.e. only voxels within these boundsshiftForSecond
- added to the current point invoxels1
to give a corresponding point invoxels2
.voxels1
- voxels in which whichbox
refers to a subregion.voxels2
- voxels in which whichbox + shiftForSecond
refers to a subregion.process
- is called for each voxel within the bounding-box where the point uses global coordinates without the shift. A newPoint3i
is not created on each iteration.
-
withTwoBuffersUntil
public static <T> Optional<Point3i> withTwoBuffersUntil(BoundingBox box, ReadableTuple3i shiftForSecond, Voxels<T> voxels1, Voxels<T> voxels2, PredicateBufferBinary<T> predicate) Iterate over each voxel in a bounding-box - with two associated buffers for each slice - until a predicate evaluates to true.predicate
is called for each voxel within the bounding-box where the point uses global coordinates without the shift while it continues to evaluate to false. The routine exits on the first occasionpredicate
evaluates to true. A newPoint3i
is not created on each iteration.- Type Parameters:
T
- buffer-type for voxels- Parameters:
box
- the box that is used as a condition on what voxels to iterate i.e. only voxels within these boundsshiftForSecond
- added to the current point invoxels1
to give a corresponding point invoxels2
.voxels1
- voxels in which whichbox
refers to a subregion.voxels2
- voxels in which whichbox + shiftForSecond
refers to a subregion.predicate
- the predicate as described above.- Returns:
- the current point (relative to the corner of
box1
when the predicate first evaluates to true, orOptional.empty()
if no point satisfies the predicate.
-
withThreeBuffers
public static <T> void withThreeBuffers(BoundingBox box, ReadableTuple3i shiftForSecond, ReadableTuple3i shiftForThird, Voxels<T> voxels1, Voxels<T> voxels2, Voxels<T> voxels3, ProcessBufferTernary<T> process) Iterate over each voxel in a bounding-box - with three associated buffers for each slice.- Type Parameters:
T
- buffer-type for voxels- Parameters:
box
- the box that is used as a condition on what voxels to iterate i.e. only voxels within these boundsshiftForSecond
- added to the current point invoxels1
to give a corresponding point invoxels2
.shiftForThird
- added to the current point invoxels1
to give a corresponding point invoxels3
.voxels1
- voxels in which whichbox
refers to a subregion.voxels2
- voxels in which whichbox + shiftForSecond
refers to a subregion.voxels3
- voxels in which whichbox + shiftForThird
refers to a subregion.process
- is called for each voxel within the bounding-box where the point uses global coordinates without the shift. A newPoint3i
is not created on each iteration.
-
withCursor
public static void withCursor(BinaryVoxels<UnsignedByteBuffer> voxels, BoundingBox box, KernelApplicationParameters parameters, ProcessKernelPointCursor process) Iterate over each voxel in a bounding-box using aKernelPointCursor
.- Parameters:
voxels
- the voxels to iterator overbox
- the box to iterate over (with coordinates referring tovoxels
.parameters
- to use when applying a kernelprocess
- process is called for each voxel inside the extent using the same coordinates as the extent.
-
withCursorUntil
public static boolean withCursorUntil(BinaryVoxels<UnsignedByteBuffer> voxels, BoundingBox box, KernelApplicationParameters parameters, PredicateKernelPointCursor predicate) Iterate over each voxel in a bounding-box using aKernelPointCursor
until a predicate returns true..- Parameters:
voxels
- the voxels to iterator overbox
- the box to iterate over (with coordinates referring tovoxels
.parameters
- to use when applying a kernelpredicate
- evaluates each position of the cursor.- Returns:
- true as soon as any voxel evaluates true with the
predicate
, false if it never happens.
-