Direct Known Subclasses:
UnsignedShortFromSignedShort, UnsignedShortFromUnsignedShort

public abstract class ToUnsignedShort extends ConvertTo<UnsignedShortBuffer>
Base class for implementations of ConvertTo that convert to unsigned short buffers.
Author:
Owen Feehan
  • Constructor Details

    • ToUnsignedShort

      protected ToUnsignedShort()
      Constructor populating super-class with necessary values.
  • Method Details

    • supportsMultipleChannelsPerSourceBuffer

      protected boolean supportsMultipleChannelsPerSourceBuffer()
      Description copied from class: ConvertTo
      Whether the source buffer can encode more than one channel?
      Specified by:
      supportsMultipleChannelsPerSourceBuffer in class ConvertTo<UnsignedShortBuffer>
      Returns:
      true if this possible (either with interleaving or with RGB-encoded voxels), false if a buffer will always describe one channel only.
    • convertValue

      protected abstract short convertValue(short value)
      Converts a value retrieved from the source buffer to the destination form.
      Parameters:
      value - the value retrieved from the source buffer.
      Returns:
      the converted value in the form to match the destination.
    • copyKeepOrientation

      protected void copyKeepOrientation(ByteBuffer source, boolean littleEndian, int channelIndexRelative, UnsignedShortBuffer destination)
      Description copied from class: ConvertTo
      Copy the bytes, without changing orientation.

      This is kept separate to ConvertTo.copyChangeOrientation(java.nio.ByteBuffer, boolean, int, T, org.anchoranalysis.image.core.dimensions.OrientationChange) as it can be done slightly more efficiently.

      Specified by:
      copyKeepOrientation in class ConvertTo<UnsignedShortBuffer>
      Parameters:
      source - the buffer we copy all channels from.
      littleEndian - true iff the bytes in source are in little-endian order.
      channelIndexRelative - 0 if the buffer is non interleaved, or otherwise the index of the channel among the interleaved channels.
      destination - finds an appropriate destination channel for a particular relative-channel-index.
    • copyChangeOrientation

      protected void copyChangeOrientation(ByteBuffer source, boolean littleEndian, int channelIndexRelative, UnsignedShortBuffer destination, OrientationChange orientationCorrection)
      Description copied from class: ConvertTo
      Copy the bytes, changing orientation.
      Specified by:
      copyChangeOrientation in class ConvertTo<UnsignedShortBuffer>
      Parameters:
      source - the buffer we copy all channels from.
      littleEndian - true iff the bytes in source are in little-endian order.
      channelIndexRelative - 0 if the buffer is non interleaved, or otherwise the index of the channel among the interleaved channels.
      destination - finds an appropriate destination channel for a particular relative-channel-index.
      orientationCorrection - any correction of orientation to be applied as bytes are converted.
    • bytesPerVoxel

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