Class IterateVoxelsObjectMask

Object
IterateVoxelsObjectMask

public class IterateVoxelsObjectMask extends Object
Utilities for iterating over the subset of voxels corresponding to an on state in an ObjectMask.

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(ObjectMask object, ProcessPoint process)
      Iterate over each voxel that is located on an object-mask
      Parameters:
      object - the object-mask that is used as a condition on what voxels to iterate
      process - process is called for each voxel with that satisfies the conditions using global coordinates.
    • withPoint

      public static void withPoint(ObjectMask firstMask, Optional<ObjectMask> secondMask, ProcessPoint process)
      Iterate over each point that is located on an object-mask AND optionally a second-mask

      If a second object-mask is defined, it is a logical AND condition. A voxel is only processed if it exists in both object-masks.

      Parameters:
      firstMask - the first-mask that is used as a condition on what voxels to iterate
      secondMask - an optional second-mask that can be a further condition
      process - is called for each voxel with that satisfies the conditions using GLOBAL coordinates for each voxel.
    • withBuffer

      public static <T> void withBuffer(ObjectMask object, Voxels<T> voxels, ProcessBufferUnary<T> process)
      Iterate over each voxel in an object-mask - with one associated buffer for each slice from Voxels.
      Type Parameters:
      T - buffer-type for voxels
      Parameters:
      object - the object-mask is used as a condition on what voxels to iterate i.e. only voxels within these bounds
      voxels - voxels where buffers extracted from be processed, and which define the global coordinate space
      process - is called for each voxel within the bounding-box using global coordinates.
    • withTwoBuffers

      public static <S, T> void withTwoBuffers(ObjectMask object, Voxels<S> voxels1, Voxels<T> voxels2, ProcessBufferBinary<S,T> process)
      Iterate over each voxel with a corresponding on value in an object-mask - and with two associated buffers for each slice covering the all the global space i.e. the entire image.

      The extent's of both voxels1 and voxels2 must be equal, and equal to the coordinate space object is defined on.

      Type Parameters:
      S - first buffer-type for voxels.
      T - second buffer-type for voxels.
      Parameters:
      object - an object-mask which restricts which voxels of voxels1 and voxels2 are iterated
      voxels1 - voxels in which which BoundingBox refers to a subregion, and which provides the first buffer
      voxels2 - voxels in which which BoundingBox refers to a subregion, and which provides the second buffer
      process - is called for each voxel within the bounding-box using global coordinates.
    • withVoxelBuffer

      public static <T> void withVoxelBuffer(ObjectMask object, Voxels<T> voxels, ProcessVoxelBufferUnary<T> process)
      Iterate over each voxel on an object-mask with one associated VoxelBuffer.

      Optionally, the iteration can be restricted to a sub-region of the object-mask.

      Type Parameters:
      T - buffer-type
      Parameters:
      object - the object-mask (global coordinates)
      voxels - voxels which provide a buffer passed to process
      process - processes each point that fulfills the conditions
    • withVoxelBuffer

      public static <T> void withVoxelBuffer(ObjectMask object, Voxels<T> voxels, Optional<BoundingBox> restrictTo, ProcessVoxelBufferUnary<T> process)
      Iterate over each voxel on an object-mask with one associated VoxelBuffer.

      Optionally, the iteration can be restricted to a sub-region of the object-mask.

      Type Parameters:
      T - buffer-type
      Parameters:
      object - the object-mask (global coordinates)
      voxels - voxels which provide a buffer passed to process
      restrictTo - optional sub-region of object-mask (global coordinates)
      process - processes each point that fulfills the conditions
    • withTwoVoxelBuffers

      public static <S, T> void withTwoVoxelBuffers(ObjectMask object, Voxels<S> voxels1, Voxels<T> voxels2, ProcessVoxelBufferBinary<S,T> process)
      Iterate over each voxel in an object-mask - with two associated voxel-buffers and for each slice.

      The extent's of both voxels1 and voxels2 must be equal.

      Type Parameters:
      T - buffer-type for voxels
      Parameters:
      object - the object-mask, with coordinates relative to both voxels1 and voxels2.
      voxels1 - voxels that provide the element from the first voxel-buffer.
      voxels2 - voxels that provide the element from the second voxel-buffer.
      process - is called for each voxel using global coordinates.
    • withTwoMixedBuffers

      public static <S, T> void withTwoMixedBuffers(ObjectMask object, Voxels<S> voxels1, Voxels<T> voxels2, ProcessVoxelBufferBinaryMixed<S,T> process)
      Iterate over each voxel in an object-mask - with one associated voxel-buffer and one associated buffer for each slice.

      The extent's of both voxels1 and voxels2 must be equal.

      Note that a new Point3i is created for each call to process.

      Type Parameters:
      T - buffer-type for voxels
      Parameters:
      object - the object-mask, with coordinates relative to both voxels1 and voxels2.
      voxels1 - voxels that provide the first element, the voxel-buffer.
      voxels2 - voxels that provide the second element, the buffer.
      process - is called for each voxel using global coordinates.
    • allMatchIntensity

      public static <T> boolean allMatchIntensity(ObjectMask object, Voxels<T> voxels, IntPredicate predicate)
      Do all points on an object-mask match a predicate on the point's voxel-intensity?

      The voxel-value of the current buffer is passed to the predicate.

      As soon as one voxel fails the predicate (i.e. the predicate returns false), the function immediately returns false.

      Type Parameters:
      T - buffer-type
      Parameters:
      object - the object-mask (global coordinates) to restrict which voxels are tested with the predicate
      voxels - voxels which provide a buffer passed to the predicate
      predicate - a predicate applied on the intensity of each voxel
      Returns:
      true if the predicate returns true for all points on the object-mask, false otherwise