Class ApplyKernel
Object
ApplyKernel
Applies various kinds of
Kernel to BinaryVoxels.- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptionstatic BinaryVoxels<UnsignedByteBuffer> apply(BinaryKernel kernel, BinaryVoxels<UnsignedByteBuffer> voxels, KernelApplicationParameters parameters) Apply the kernel toBinaryVoxels<UnsignedByteBuffer>using the same binary-values asvoxelsto calculate a value for each voxel.static intapplyForCount(BinaryKernel kernel, BinaryVoxels<UnsignedByteBuffer> voxels, KernelApplicationParameters parameters) Applies aBinaryKernelto voxels and counts how many true values occur en aggregate.static intapplyForCount(CountKernel kernel, BinaryVoxels<UnsignedByteBuffer> voxels, KernelApplicationParameters parameters) Applies the kernel to voxels and sums the returned value.static intapplyForCount(CountKernel kernel, BinaryVoxels<UnsignedByteBuffer> voxels, BoundingBox box, KernelApplicationParameters parameters) Applies the kernel to voxels and sums the returned value.static booleanapplyUntilPositive(CountKernel kernel, BinaryVoxels<UnsignedByteBuffer> voxels, BoundingBox box, KernelApplicationParameters parameters) Applies the kernel to voxels until a positive value is returned, then exits with true.
-
Method Details
-
apply
public static BinaryVoxels<UnsignedByteBuffer> apply(BinaryKernel kernel, BinaryVoxels<UnsignedByteBuffer> voxels, KernelApplicationParameters parameters) Apply the kernel toBinaryVoxels<UnsignedByteBuffer>using the same binary-values asvoxelsto 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 asvoxels.
-
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 aBinaryKernelto 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.
-