Interface VoxelsExtracter<T>

Type Parameters:
T - buffer-type

public interface VoxelsExtracter<T>
Provides methods to read/copy/duplicate regions of voxels.
Author:
Owen Feehan
  • Method Details

    • voxel

      default int voxel(int x, int y)
      Gets the value of one particular voxel.

      Note that this provides very slow access, compared to iterating through slice buffers, so use sparingly.

      The Z-coordinate is assumed to be 0.

      Parameters:
      x - coordinate of voxel in X-dimension.
      y - coordinate of voxel in Y-dimension.
      Returns:
      the value of a voxel (converted into an int).
    • voxel

      default int voxel(int x, int y, int z)
      Gets the value of one particular voxel.

      Note that this provides very slow access, compared to iterating through slice buffers, so use sparingly.

      Parameters:
      x - coordinate of voxel in X-dimension.
      y - coordinate of voxel in Y-dimension.
      z - coordinate of voxel in Z-dimension.
      Returns:
      the value of a voxel (converted into an int).
    • voxel

      int voxel(ReadableTuple3i point)
      Gets the value of one particular voxel.

      Note that this provides very slow access, compared to iterating through slice buffers, so use sparingly.

      Parameters:
      point - coordinates.
      Returns:
      the value of a voxel (converted into an int).
    • slice

      Voxels<T> slice(int sliceIndex)
      Creates a new Voxels with only particular slice.

      This is an immutable operation.

      Parameters:
      sliceIndex - index of slice in z-dimension.
      Returns:
      a channel containing the slice (reusing the existing voxel buffers).
    • region

      Voxels<T> region(BoundingBox box, boolean reuseIfPossible)
      A (sub-)region of the voxels.

      The region may some smaller portion of the voxels, or the voxels in their entirety.

      It should never be larger than the voxels.

      Depending on policy, an the existing box will be reused if possible (if the region requested is equal to the box as a whole), useful to avoid unnecessary new memory allocation.

      If reuseIfPossible is false, it is guaranteed that a new voxels will always be created.

      Parameters:
      box - a bounding-box indicating the regions desired (not be larger than the extent)
      reuseIfPossible - if true the existing box will be reused if possible,, otherwise a new box is always created.
      Returns:
      voxels corresponding to the requested region, either newly-created or reused
    • boxCopyTo

      void boxCopyTo(BoundingBox from, Voxels<T> voxelsDestination, BoundingBox destinationBox)
      Copies a bounding-box area to another Voxels.

      from and destinationBox must have identically-sized Extents.

      Parameters:
      from - box to copy from (relative to the current voxels).
      voxelsDestination - where to copy into.
      destinationBox - box to copy into (relative to voxelsDestination).
    • objectCopyTo

      void objectCopyTo(ObjectMask from, Voxels<T> voxelsDestination, BoundingBox destinationBox)
      Copies an area corresponding to an object-mask to another Voxels.

      Only copies voxels if part of an object, otherwise voxels in the destination-buffer are not changed.

      from's bounding-box and destinationBox must have identically-sized Extents.

      Parameters:
      from - only copies voxels which correspond to an on voxels in the object-mask.
      voxelsDestination - where to copy into.
      destinationBox - box to copy into (relative to voxelsDestination).
    • resizedXY

      Voxels<T> resizedXY(int sizeX, int sizeY, VoxelsResizer resizer)
      Creates a new voxels that are a resized version of the current voxels (only in X and Y dimensions), interpolating as needed.

      This is an immutable operation.

      Parameters:
      sizeX - new size in X dimension.
      sizeY - new size in Y dimension.
      resizer - an interpolator for resizing voxels.
      Returns:
      newly created voxels of specified size containing interpolated voxels from the current voxels.
    • projectMax

      Voxels<T> projectMax()
      A maximum intensity projection of all slices
      Returns:
      voxels with newly-created buffers containing projection (identical in XY dimensions but with a single slice).
    • projectMean

      Voxels<T> projectMean()
      A mean intensity projection of all slices.
      Returns:
      voxels with newly-created buffers containing projection (identical in XY dimensions but with a single slice).
    • voxelsEqualTo

      VoxelsPredicate voxelsEqualTo(int equalToValue)
      Operations on whether particular voxels are equal to a particular value.
      Parameters:
      equalToValue -
      Returns:
      a newly instantiated object to perform queries on voxels who fulfill the above condition.
    • voxelsGreaterThan

      VoxelsPredicate voxelsGreaterThan(int threshold)
      Operations on whether particular voxels are greater than a threshold (but not equal to).
      Parameters:
      threshold - voxel-values greater than this threshold are included.
      Returns:
      a newly instantiated object to perform queries on voxels who fulfill the above condition.
    • voxelWithMinIntensity

      long voxelWithMinIntensity()
      Finds the minimum-value of any voxel and rounding down (floor) to the nearest long.

      The computational cost of the operation is O(n) in the number of voxels. The result is not cached.

      Returns:
      the minimum-value.
    • voxelWithMaxIntensity

      long voxelWithMaxIntensity()
      Finds the maximum-value of any voxel and rounding up (ceiling) to the nearest long.

      The computational cost of the operation is O(n) in the number of voxels. The result is not cached.

      Returns:
      the maximum-value.
    • voxelsWithMinMaxIntensity

      MinMaxRange voxelsWithMinMaxIntensity()
      Finds the minimum-value and maximum of any voxel.

      The minimum is rounded down (floor) to the nearest long.

      The maximum is rounded up (ceil) to the nearest long.

      This is efficient than calling voxelWithMinIntensity() and voxelWithMaxIntensity() separately.

      The computational cost of the operation is O(n) in the number of voxels. The result is not cached.

      Returns:
      the minimum- and maximum values.