Class ApplyKernel

Object
ApplyKernel

public class ApplyKernel extends Object
Applies various kinds of Kernel to BinaryVoxels.
Author:
Owen Feehan
  • Method Details

    • apply

      Apply the kernel to BinaryVoxels<UnsignedByteBuffer> using the same binary-values as voxels to calculate a value for each voxel.
      Parameters:
      kernel - the kernel to apply.
      voxels - the voxels to apply the kernel on.
      parameters - parameters influencing how the kernel is applied.
      Returns:
      a newly created BinaryVoxels<UnsignedByteBuffer> that is the result of applying the kernel, and using the same binary-values as voxels.
    • applyForCount

      public static int applyForCount(CountKernel kernel, BinaryVoxels<UnsignedByteBuffer> voxels, KernelApplicationParameters parameters)
      Applies the kernel to voxels and sums the returned value.
      Parameters:
      kernel - the kernel to be applied.
      voxels - the voxels to iterate over.
      parameters - parameters that affect how the kernel is applied.
      Returns:
      the sum of the count value returned by the kernel over all iterated voxels.
    • applyForCount

      public static int applyForCount(CountKernel kernel, BinaryVoxels<UnsignedByteBuffer> voxels, BoundingBox box, KernelApplicationParameters parameters) throws OperationFailedException
      Applies the kernel to voxels and sums the returned value.
      Parameters:
      kernel - the kernel to be applied.
      voxels - the voxels to iterate over.
      box - a bounding-box (coordinates relative to voxels) that restricts where iteration occurs. Must be contained within voxels.
      parameters - parameters that affect how the kernel is applied.
      Returns:
      the sum of the count value returned by the kernel over all iterated voxels.
      Throws:
      OperationFailedException - if the operation cannot complete successfully.
    • applyUntilPositive

      public static boolean applyUntilPositive(CountKernel kernel, BinaryVoxels<UnsignedByteBuffer> voxels, BoundingBox box, KernelApplicationParameters parameters) throws OperationFailedException
      Applies the kernel to voxels until a positive value is returned, then exits with true.
      Parameters:
      kernel - the kernel to be applied.
      voxels - the voxels to iterate over.
      box - a bounding-box (coordinates relative to voxels) that restricts where iteration occurs. Must be contained within voxels.
      parameters - parameters that affect how the kernel is applied.
      Returns:
      true if a positive-value is encountered, 0 if it never is encountered.
      Throws:
      OperationFailedException - if the operation cannot complete successfully.
    • applyForCount

      public static int applyForCount(BinaryKernel kernel, BinaryVoxels<UnsignedByteBuffer> voxels, KernelApplicationParameters parameters)
      Applies a BinaryKernel to voxels and counts how many true values occur en aggregate.
      Parameters:
      kernel - the kernel to be applied.
      voxels - the voxels to iterate over.
      parameters - parameters that affect how the kernel is applied.
      Returns:
      the total number of true values, after the kernel is applied to every voxel.