Class SlidingBuffer<T>

Object
SlidingBuffer<T>
Type Parameters:
T - buffer-type.

public final class SlidingBuffer<T> extends Object
An index that places a particular z-slice in local context.

It can slide along the z-dimension of Voxels tracking the current z-slice's buffer and neighboring buffers.

Specifically, three buffers are always tracked:

  1. the buffer for the current slice.
  2. the current slice minus 1.
  3. the current slice plus 1.

Can then be shifted (incremented) across all z-slices.

The shift() or seek(int) operations can be used to shift the buffer to focus on a particular z-slice.

  • Constructor Details

    • SlidingBuffer

      public SlidingBuffer(Voxels<T> voxels)
      Create for particular voxels.
      Parameters:
      voxels - the voxels to slide a buffer across the z-dimension.
  • Method Details

    • seek

      public void seek(int sliceIndexToSeek)
      Moves buffer to a particular z-slice.
      Parameters:
      sliceIndexToSeek - the index of the z-slice to move to.
    • shift

      public void shift()
      Increments the slice number by one.
    • bufferRelative

      public VoxelBuffer<T> bufferRelative(int relativeIndex)
      Returns the corresponding buffer at a relative z-slice index to the current focused z-slice.
      Parameters:
      relativeIndex - an index relative to the current focus's z-slice e.g. -1 or 0 or 1
      Returns:
      the corresponding buffer.
    • extent

      public Extent extent()
      The size of the voxels across three dimensions.

      Note this is not the size of an individual z-slice, but rather the size of all voxels.

      Returns:
      the size.
    • getVoxels

      public Voxels<T> getVoxels()
      The voxels from which buffers corresponding to slices are extracted.
    • getCenter

      public VoxelBuffer<T> getCenter()
      The buffer for the currently selected slice.
    • getPlusOne

      public VoxelBuffer<T> getPlusOne()
      The voxel-buffer for the slice with the currently selected slice's index +1 or null if it's the final slice.
    • getMinusOne

      public VoxelBuffer<T> getMinusOne()
      The voxel-buffer for the slice with the currently selected slice's index -1 or null if it's the first slice.