public class VoxelsUntyped extends Object
This is a convenience class to avoid using a templated parameter in Voxels
.
It stores the voxels in a weakly-typed manner, and gives convenience methods to convert to the desired type.
An IncorrectVoxelTypeException
is thrown when incorrect assumptions are made about the
type.
Constructor and Description |
---|
VoxelsUntyped(Voxels<?> voxels)
Creates to wrap a
Voxels of unspecified type. |
Modifier and Type | Method and Description |
---|---|
Voxels<?> |
any()
Exposes without any specific buffer type.
|
VoxelsArithmetic |
arithmetic()
Interface that allows manipulation of voxel intensities via arithmetic operations.
|
Voxels<UnsignedByteBuffer> |
asByte()
Casts to use a
UnsignedByteBuffer if the voxels contain this data-type, otherwise
throws a IncorrectVoxelTypeException . |
Voxels<FloatBuffer> |
asFloat()
Casts to use a
FloatBuffer if the voxels contain this data-type, otherwise throws a
IncorrectVoxelTypeException . |
Voxels<UnsignedIntBuffer> |
asInt()
Casts to use a
UnsignedIntBuffer if the voxels contain this data-type, otherwise
throws a IncorrectVoxelTypeException . |
Voxels<UnsignedShortBuffer> |
asShort()
Casts to use a
UnsignedShortBuffer if the voxels contain this data-type, otherwise
throws a IncorrectVoxelTypeException . |
VoxelsAssigner |
assignValue(int valueToAssign)
Interface that allows assignment of a particular value to all or subsets of the voxels.
|
Voxels<?> |
checkIdenticalDataType(VoxelDataType match)
Do the voxels have a data-type that is equal to
match ? |
void |
copyVoxelsTo(BoundingBox boxSource,
VoxelsUntyped destination,
BoundingBox boxDestination)
Copies the voxels into a
destination , but only those voxels inside a bounding-box. |
void |
copyVoxelsTo(ObjectMask objectSource,
VoxelsUntyped destination,
BoundingBox boxDestination)
Copies the voxels into a
destination , but only those voxels inside an ObjectMask . |
Extent |
extent()
The size of the voxels across three dimensions.
|
VoxelsExtracter<?> |
extract()
Interface that allows read/copy/duplication operations to be performed regarding the voxels
intensities.
|
VoxelDataType |
getVoxelDataType()
The underlying data-type of the voxels, represented by a
VoxelDataType instance. |
void |
replaceSlice(int sliceIndexToUpdate,
VoxelsUntyped sourceVoxels,
int sliceIndexSource,
boolean duplicate)
Copies one particular z-slice of voxels from a source into the current voxels.
|
<T> VoxelBuffer<T> |
slice(int z)
A
VoxelBuffer corresponding to a particular z-slice. |
void |
subtractFromMaxValue()
Subtracts all voxel-values from the maximum value associated with the data-type.
|
public Voxels<?> any()
public Voxels<?> checkIdenticalDataType(VoxelDataType match)
match
?match
- the data-type the voxel must equal.public Voxels<UnsignedByteBuffer> asByte()
UnsignedByteBuffer
if the voxels contain this data-type, otherwise
throws a IncorrectVoxelTypeException
.public Voxels<UnsignedShortBuffer> asShort()
UnsignedShortBuffer
if the voxels contain this data-type, otherwise
throws a IncorrectVoxelTypeException
.public Voxels<UnsignedIntBuffer> asInt()
UnsignedIntBuffer
if the voxels contain this data-type, otherwise
throws a IncorrectVoxelTypeException
.public Voxels<FloatBuffer> asFloat()
FloatBuffer
if the voxels contain this data-type, otherwise throws a
IncorrectVoxelTypeException
.public VoxelDataType getVoxelDataType()
VoxelDataType
instance.VoxelDataType
.public void copyVoxelsTo(BoundingBox boxSource, VoxelsUntyped destination, BoundingBox boxDestination)
destination
, but only those voxels inside a bounding-box.boxSource
- the bounding-box relative to the source voxels (the current voxels - from
where we copy from).destination
- the voxels we copy into.boxDestination
- the bounding-box relative to the destination voxels.public void copyVoxelsTo(ObjectMask objectSource, VoxelsUntyped destination, BoundingBox boxDestination)
destination
, but only those voxels inside an ObjectMask
.objectSource
- the object-mask relative to the source voxels, from where we copy from.destination
- the voxels we copy into.boxDestination
- the bounding-box relative to the destination voxels.public void subtractFromMaxValue()
i.e. each voxel value v
is updated to become maxDataTypeValue - v
public void replaceSlice(int sliceIndexToUpdate, VoxelsUntyped sourceVoxels, int sliceIndexSource, boolean duplicate)
The existing z-slice is replaced.
sliceIndexToUpdate
- slice-index to update in the current voxels.sourceVoxels
- voxels to copy a particular z-slice from.sliceIndexSource
- the z-slice in sourceVoxels
to copy from.duplicate
- if true, the source slice is duplicated before being assigned. Otherwise it
is reused.public <T> VoxelBuffer<T> slice(int z)
VoxelBuffer
corresponding to a particular z-slice.z
- the index (beginning at 0) of all z-slices.z
.public Extent extent()
public VoxelsArithmetic arithmetic()
public VoxelsAssigner assignValue(int valueToAssign)
valueToAssign
- the value to assign.public VoxelsExtracter<?> extract()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.