Class UnsignedByteFromUnsignedInt
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
-
Field Summary
Fields inherited from class org.anchoranalysis.io.bioformats.copyconvert.tobyte.ToUnsignedByteWithScaling
scaling
Fields inherited from class org.anchoranalysis.io.bioformats.copyconvert.ConvertTo
destinationSize, extent, sourceIncrement, sourceSize
-
Constructor Summary
ConstructorsConstructorDescriptionUnsignedByteFromUnsignedInt
(int effectiveBits) Create with a number of effective-bits. -
Method Summary
Modifier and TypeMethodDescriptionprotected int
The number bytes to describe each source-voxel.protected int
extractScaledValue
(byte[] sourceArray, int index, boolean littleEndian) Extracts a value from the source-array, and apply any scaling and clamping.Methods inherited from class org.anchoranalysis.io.bioformats.copyconvert.tobyte.ToUnsignedByteWithScaling
copyChangeOrientation, copyKeepOrientation, supportsMultipleChannelsPerSourceBuffer
Methods inherited from class org.anchoranalysis.io.bioformats.copyconvert.ConvertTo
convert, convertSliceOfSingleChannel, copyAllChannels, setupBefore
-
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 classConvertTo<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 classToUnsignedByteWithScaling
- Parameters:
sourceArray
- the bytes from which some values are extracted.index
- the offset insourceArray
from which a value is read.littleEndian
- true iff the bytes insource
are in little-endian order.- Returns:
- the extracted value.
-