Class FloatFromUnsignedByte
Convert to a float buffer, given an unsigned-byte source buffer.
- 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 int
The number bytes to describe each source-voxel.protected void
copyChangeOrientation
(ByteBuffer source, boolean littleEndian, int channelIndexRelative, FloatBuffer destination, OrientationChange orientationCorrection) Copy the bytes, changing orientation.protected void
copyKeepOrientation
(ByteBuffer source, boolean littleEndian, int channelIndexRelative, FloatBuffer destination) Copy the bytes, without changing orientation.protected void
setupBefore
(Dimensions dimensions, ImageFileEncoding encoding) Always called before any batch of calls toConvertTo.convertSliceOfSingleChannel(java.nio.ByteBuffer, int, org.anchoranalysis.image.core.dimensions.OrientationChange)
.Methods inherited from class org.anchoranalysis.io.bioformats.copyconvert.tofloat.ToFloat
supportsMultipleChannelsPerSourceBuffer
Methods inherited from class org.anchoranalysis.io.bioformats.copyconvert.ConvertTo
convert, convertSliceOfSingleChannel, copyAllChannels
-
Constructor Details
-
FloatFromUnsignedByte
public FloatFromUnsignedByte()
-
-
Method Details
-
setupBefore
Description copied from class:ConvertTo
Always called before any batch of calls toConvertTo.convertSliceOfSingleChannel(java.nio.ByteBuffer, int, org.anchoranalysis.image.core.dimensions.OrientationChange)
.- Overrides:
setupBefore
in classConvertTo<FloatBuffer>
- Parameters:
dimensions
- the final dimensions of the image.encoding
- how voxels are stored in the source-image.- Throws:
IOException
- if a particular combination of parameters is unsupported.
-
bytesPerVoxel
protected int bytesPerVoxel()Description copied from class:ConvertTo
The number bytes to describe each source-voxel.- Specified by:
bytesPerVoxel
in classConvertTo<FloatBuffer>
- Returns:
- the number of bytes.
-
copyKeepOrientation
protected void copyKeepOrientation(ByteBuffer source, boolean littleEndian, int channelIndexRelative, FloatBuffer destination) throws IOException 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 classConvertTo<FloatBuffer>
- Parameters:
source
- the buffer we copy all channels from.littleEndian
- true iff the bytes insource
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.- Throws:
IOException
- when the operation fails due to read or write IO problems.
-
copyChangeOrientation
protected void copyChangeOrientation(ByteBuffer source, boolean littleEndian, int channelIndexRelative, FloatBuffer destination, OrientationChange orientationCorrection) throws IOException Description copied from class:ConvertTo
Copy the bytes, changing orientation.- Specified by:
copyChangeOrientation
in classConvertTo<FloatBuffer>
- Parameters:
source
- the buffer we copy all channels from.littleEndian
- true iff the bytes insource
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.- Throws:
IOException
- when the operation fails due to read or write IO problems.
-