T
- buffer-typepublic abstract class VoxelBuffer<T> extends Object
Voxels
.
The operations are modelled on the NIO Buffer
classes that can provide the underlying
buffers, but parameter T
need not strictly be a sub-class of Buffer
. This is
useful for automatically wrapping signed to unsigned values with custom buffers.
Constructor and Description |
---|
VoxelBuffer() |
Modifier and Type | Method and Description |
---|---|
abstract T |
buffer()
The associated buffer for storing the voxels.
|
abstract int |
capacity()
The capacity (i.e.
|
abstract void |
copyVoxelFrom(int destinationIndex,
VoxelBuffer<T> source,
int sourceIndex)
Copies one particular intensity-value from another
VoxelBuffer into this buffer. |
abstract VoxelDataType |
dataType()
Data-type of each voxel in the buffer.
|
abstract VoxelBuffer<T> |
duplicate()
Creates a deep copy of the current object, including deep-copying the associated buffer.
|
abstract int |
getInt(int index)
Gets an element from the buffer at a particular position, converting, if necessary, to an
int . |
abstract boolean |
hasRemaining()
Are there voxels remaining in a buffer?
|
abstract boolean |
isDirect()
Is this buffer direct or non-direct?
|
abstract void |
position(int newPosition)
Assigns a new position to the buffer.
|
abstract void |
putByte(int index,
byte value)
Puts a byte in the buffer at a particular position, converting, if necessary, to the buffer
type.
|
abstract void |
putInt(int index,
int value)
Puts a int in the buffer at a particular position, converting, if necessary, to the buffer
type.
|
String |
toString() |
abstract ByteBuffer |
underlyingBytes()
THe underlying bytes that describe the voxels.
|
public abstract VoxelDataType dataType()
public abstract T buffer()
This buffer is either a NIO or other classes that wraps the underlying array storing voxel intensities.
public abstract VoxelBuffer<T> duplicate()
public abstract int getInt(int index)
int
.
Note this can provide slower access than reading directly in the native buffer type.
The advantage is that all buffer-types implement getInt
and putInt
so no type-specific code needs to be written.
The disadvantage is that this can be less efficient, unless conversion to int
needs to occur anyway.
index
- the index in the buffer.index
in the buffer.public abstract void putInt(int index, int value)
Note this can provide slower access than reading directly in the native buffer type. See
the note in getInt(int)
.
index
- the index in the buffer.value
- value to put in the buffer.public abstract void putByte(int index, byte value)
index
- the index in the buffer.value
- value to put in the buffer.public abstract int capacity()
This is meant in the sense of Java's NIO Buffer
classes.
public abstract boolean hasRemaining()
This is meant in the sense of Java's NIO Buffer
classes.
public abstract void position(int newPosition)
This is meant in the sense of Java's NIO Buffer
classes.
newPosition
- the offset to assign as position.public abstract boolean isDirect()
This is meant in the sense of Java's NIO Buffer
classes.
public abstract ByteBuffer underlyingBytes()
ByteBuffer
with the voxels.public abstract void copyVoxelFrom(int destinationIndex, VoxelBuffer<T> source, int sourceIndex)
VoxelBuffer
into this buffer.destinationIndex
- the index in the current buffer to write to.source
- the buffer to copy the value from.sourceIndex
- the index of the voxel in source
to copy from.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.