Class IterateVoxelsBoundingBox

Object
IterateVoxelsBoundingBox

public class IterateVoxelsBoundingBox extends Object
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 Details

    • withPoint

      public static void withPoint(BoundingBox box, ProcessPoint process)
      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 bounds
      process - is called for each voxel within the bounding-box using global coordinates.
    • withPointAndIndex

      public static void withPointAndIndex(BoundingBox box, ProcessPointAndIndex process)
      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 bounds
      process - 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 bounds
      predicate - only voxels that match this predicate are processed.
      process - is called for each voxel that matches predicate within the bounding-box using global coordinates.
    • withBuffer

      public static <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 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 bounds
      voxels - 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, one VoxelBuffer and one Buffer
      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 bounds
      shiftForSecond - added to the current point in voxels1 to give a corresponding point in voxels2.
      voxels1 - voxels in which which box refers to a subregion.
      voxels2 - voxels in which which box + 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 new Point3i 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 for voxels1).
      T - buffer-type for the buffer (for voxels2).
      Parameters:
      box - the box that is used as a condition on what voxels to iterate i.e. only voxels within these bounds
      shiftForSecond - added to the current point in voxels1 to give a corresponding point in voxels2.
      voxels1 - voxels in which which box refers to a subregion.
      voxels2 - voxels in which which box + 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 new Point3i 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 occasion predicate evaluates to true. A new Point3i 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 bounds
      shiftForSecond - added to the current point in voxels1 to give a corresponding point in voxels2.
      voxels1 - voxels in which which box refers to a subregion.
      voxels2 - voxels in which which box + 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, or Optional.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 bounds
      shiftForSecond - added to the current point in voxels1 to give a corresponding point in voxels2.
      shiftForThird - added to the current point in voxels1 to give a corresponding point in voxels3.
      voxels1 - voxels in which which box refers to a subregion.
      voxels2 - voxels in which which box + shiftForSecond refers to a subregion.
      voxels3 - voxels in which which box + 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 new Point3i 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 a KernelPointCursor.
      Parameters:
      voxels - the voxels to iterator over
      box - the box to iterate over (with coordinates referring to voxels.
      parameters - to use when applying a kernel
      process - 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 a KernelPointCursor until a predicate returns true..
      Parameters:
      voxels - the voxels to iterator over
      box - the box to iterate over (with coordinates referring to voxels.
      parameters - to use when applying a kernel
      predicate - evaluates each position of the cursor.
      Returns:
      true as soon as any voxel evaluates true with the predicate, false if it never happens.