Class UnsignedByteFromFloat
Converts a
ByteBuffer encoding a float type to unsigned byte type, as
expected in an Anchor VoxelBuffer.
Only values in the range 0 <= value <= 255 are preserved. Any values outside this
range are clamped to 0 or 255.
Any decimal component is dropped.
- Author:
- Owen Feehan
-
Field Summary
Fields inherited from class org.anchoranalysis.io.bioformats.copyconvert.ConvertTo
destinationSize, extent, sourceIncrement, sourceSize -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intThe number bytes to describe each source-voxel.protected voidcopyChangeOrientation(ByteBuffer source, boolean littleEndian, int channelIndexRelative, UnsignedByteBuffer destination, OrientationChange orientationCorrection) Copy the bytes, changing orientation.protected voidcopyKeepOrientation(ByteBuffer source, boolean littleEndian, int channelIndexRelative, UnsignedByteBuffer destination) Copy the bytes, without changing orientation.protected booleanWhether the source buffer can encode more than one channel?Methods inherited from class org.anchoranalysis.io.bioformats.copyconvert.ConvertTo
convert, convertSliceOfSingleChannel, copyAllChannels, setupBefore
-
Constructor Details
-
UnsignedByteFromFloat
public UnsignedByteFromFloat()
-
-
Method Details
-
bytesPerVoxel
protected int bytesPerVoxel()Description copied from class:ConvertToThe number bytes to describe each source-voxel.- Specified by:
bytesPerVoxelin classConvertTo<UnsignedByteBuffer>- Returns:
- the number of bytes.
-
supportsMultipleChannelsPerSourceBuffer
protected boolean supportsMultipleChannelsPerSourceBuffer()Description copied from class:ConvertToWhether the source buffer can encode more than one channel?- Specified by:
supportsMultipleChannelsPerSourceBufferin classConvertTo<UnsignedByteBuffer>- Returns:
- true if this possible (either with interleaving or with RGB-encoded voxels), false if a buffer will always describe one channel only.
-
copyKeepOrientation
protected void copyKeepOrientation(ByteBuffer source, boolean littleEndian, int channelIndexRelative, UnsignedByteBuffer destination) Description copied from class:ConvertToCopy 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:
copyKeepOrientationin classConvertTo<UnsignedByteBuffer>- Parameters:
source- the buffer we copy all channels from.littleEndian- true iff the bytes insourceare 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, UnsignedByteBuffer destination, OrientationChange orientationCorrection) Description copied from class:ConvertToCopy the bytes, changing orientation.- Specified by:
copyChangeOrientationin classConvertTo<UnsignedByteBuffer>- Parameters:
source- the buffer we copy all channels from.littleEndian- true iff the bytes insourceare 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.
-