Class UnsignedByteFromUnsignedInt


public class UnsignedByteFromUnsignedInt extends ToUnsignedByteWithScaling
Converts data of type unsigned int to unsigned byte.

If more than 8-bits are being used in the input values, scaling is applied to map the range of effective-bits (how many bits are used) to an 8-bit range.

Author:
Owen Feehan
  • Constructor Details

    • UnsignedByteFromUnsignedInt

      public UnsignedByteFromUnsignedInt(int effectiveBits)
      Create with a number of effective-bits.
      Parameters:
      effectiveBits - the number of bits that are used in the input-type e.g. 8 or 12 or 16.
  • Method Details

    • bytesPerVoxel

      protected int bytesPerVoxel()
      Description copied from class: ConvertTo
      The number bytes to describe each source-voxel.
      Specified by:
      bytesPerVoxel in class ConvertTo<UnsignedByteBuffer>
      Returns:
      the number of bytes.
    • extractScaledValue

      protected int extractScaledValue(byte[] sourceArray, int index, boolean littleEndian)
      Description copied from class: ToUnsignedByteWithScaling
      Extracts a value from the source-array, and apply any scaling and clamping.
      Specified by:
      extractScaledValue in class ToUnsignedByteWithScaling
      Parameters:
      sourceArray - the bytes from which some values are extracted.
      index - the offset in sourceArray from which a value is read.
      littleEndian - true iff the bytes in source are in little-endian order.
      Returns:
      the extracted value.