Class BinaryVoxels<T>

Object
BinaryVoxels<T>
Type Parameters:
T - buffer-type
All Implemented Interfaces:
BinaryOnOffSetter

public abstract class BinaryVoxels<T> extends Object implements BinaryOnOffSetter
Like Voxels but should only contain two distinct intensity-values representing on and off. states.
Author:
Owen Feehan
  • Constructor Details

    • BinaryVoxels

      public BinaryVoxels(Voxels<T> voxels, BinaryValuesInt binaryValues)
      Creates a new BinaryVoxels instance.
      Parameters:
      voxels - Voxels that should only have two intensity-values (representing on and off states). This is not checked as a precondition.
      binaryValues - Which two intensity values represent off and on states.
  • Method Details

    • invert

      public void invert()
      Changes the off state to be the on state and vice-versa.

      Only the binaryValues (acting as an index to the intensity values) is changed; the voxels remain themselves unchanged.

    • extent

      public Extent extent()
      The size of the voxels across three dimensions.
      Returns:
      the size.
    • hasOnVoxel

      public boolean hasOnVoxel()
      At least one voxel exists with an on value.
      Returns:
      true iff at least one such voxel exists.
    • hasOffVoxel

      public boolean hasOffVoxel()
      At least one voxel exists with an off value.
      Returns:
      true iff at least one such voxel exists.
    • duplicate

      public abstract BinaryVoxels<T> duplicate()
      Deep-copy of the object, including duplicating voxel buffers in memory.
      Returns:
      a deep-copy.
    • sliceBuffer

      public T sliceBuffer(int z)
      A buffer corresponding to a particular z-slice.

      This buffer is either a NIO or other classes that wraps the underlying array storing voxel intensities.

      Parameters:
      z - the index (beginning at 0) of all z-slices.
      Returns:
      the corresponding buffer for z.
    • slice

      public VoxelBuffer<T> slice(int z)
      A VoxelBuffer corresponding to a particular z-slice.
      Parameters:
      z - the index (beginning at 0) of all z-slices.
      Returns:
      the corresponding buffer for z.
    • sliceBinary

      public BinaryVoxels<T> sliceBinary(int z)
      A particular z-slice, wrapped into a BinaryVoxels.
      Parameters:
      z - the index (beginning at 0) of all z-slices.
      Returns:
      a newly created BinaryVoxels wrapping the single z-slice at position z.
    • binaryVoxelsFor

      protected abstract BinaryVoxels<T> binaryVoxelsFor(Voxels<T> voxels, BinaryValuesInt binaryValues)
      Creates a BinaryVoxels corresponding to a particular voxels and BinaryValuesInt.
      Parameters:
      voxels - the voxels.
      binaryValues - the binary-values.
      Returns:
      the newly created BinaryVoxels.
    • assignOn

      public VoxelsAssigner assignOn()
      Creates an assigner that may set the on state in subsequently specified regions of the voxels.
      Returns:
      a newly created assigner.
    • assignOff

      public VoxelsAssigner assignOff()
      Creates an assigner that may set the off state in subsequently specified regions of the voxels.
      Returns:
      a newly created assigner.
    • countOn

      public int countOn()
      Counts the number of voxels with an on state.
      Returns:
      the total number of voxels with an on state.
    • countOff

      public int countOff()
      Counts the number of voxels with an off state.
      Returns:
      the total number of voxels with an off state.
    • extract

      public VoxelsExtracter<T> extract()
      Interface that allows read/copy/duplication operations to be performed regarding the voxels intensities.
      Returns:
      the interface.
    • slices

      public SliceBufferIndex<T> slices()
      An index mapping slice of voxels (in the z dimension) to a particular buffer with the corresponding voxel intensities.
      Returns:
      the index.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • voxels

      public Voxels<T> voxels()
      Voxels that should only have two intensity-values (representing on and off states). This is not checked as a precondition.
    • binaryValues

      public BinaryValuesInt binaryValues()
      Which two intensity values represent off and on states.