Class BinaryVoxels<T>
Object
BinaryVoxels<T>
- Type Parameters:
T
- buffer-type
- All Implemented Interfaces:
BinaryOnOffSetter
Like
Voxels
but should only contain two distinct intensity-values representing on
and off. states.- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryVoxels
(Voxels<T> voxels, BinaryValuesInt binaryValues) Creates a newBinaryVoxels
instance. -
Method Summary
Modifier and TypeMethodDescriptionCreates an assigner that may set the off state in subsequently specified regions of the voxels.assignOn()
Creates an assigner that may set the on state in subsequently specified regions of the voxels.Which two intensity values represent off and on states.protected abstract BinaryVoxels
<T> binaryVoxelsFor
(Voxels<T> voxels, BinaryValuesInt binaryValues) Creates aBinaryVoxels
corresponding to a particular voxels andBinaryValuesInt
.int
countOff()
Counts the number of voxels with an off state.int
countOn()
Counts the number of voxels with an on state.abstract BinaryVoxels
<T> Deep-copy of the object, including duplicating voxel buffers in memory.extent()
The size of the voxels across three dimensions.extract()
Interface that allows read/copy/duplication operations to be performed regarding the voxels intensities.boolean
At least one voxel exists with an off value.boolean
At least one voxel exists with an on value.void
invert()
Changes the off state to be the on state and vice-versa.slice
(int z) AVoxelBuffer
corresponding to a particular z-slice.sliceBinary
(int z) A particular z-slice, wrapped into aBinaryVoxels
.sliceBuffer
(int z) A buffer corresponding to a particular z-slice.slices()
An index mapping slice of voxels (in the z dimension) to a particular buffer with the corresponding voxel intensities.toString()
voxels()
Voxels that should only have two intensity-values (representing on and off states).
-
Constructor Details
-
BinaryVoxels
Creates a newBinaryVoxels
instance.- Parameters:
voxels
- Voxels that should only have two intensity-values (representing on and off states). This is not checked as a precondition.binaryValues
- Which two intensity values represent off and on states.
-
-
Method Details
-
invert
public void invert()Changes the off state to be the on state and vice-versa.Only the
binaryValues
(acting as an index to the intensity values) is changed; the voxels remain themselves unchanged. -
extent
The size of the voxels across three dimensions.- Returns:
- the size.
-
hasOnVoxel
public boolean hasOnVoxel()At least one voxel exists with an on value.- Returns:
- true iff at least one such voxel exists.
-
hasOffVoxel
public boolean hasOffVoxel()At least one voxel exists with an off value.- Returns:
- true iff at least one such voxel exists.
-
duplicate
Deep-copy of the object, including duplicating voxel buffers in memory.- Returns:
- a deep-copy.
-
sliceBuffer
A buffer corresponding to a particular z-slice.This buffer is either a NIO or other classes that wraps the underlying array storing voxel intensities.
- Parameters:
z
- the index (beginning at 0) of all z-slices.- Returns:
- the corresponding buffer for
z
.
-
slice
AVoxelBuffer
corresponding to a particular z-slice.- Parameters:
z
- the index (beginning at 0) of all z-slices.- Returns:
- the corresponding buffer for
z
.
-
sliceBinary
A particular z-slice, wrapped into aBinaryVoxels
.- Parameters:
z
- the index (beginning at 0) of all z-slices.- Returns:
- a newly created
BinaryVoxels
wrapping the single z-slice at positionz
.
-
binaryVoxelsFor
Creates aBinaryVoxels
corresponding to a particular voxels andBinaryValuesInt
.- Parameters:
voxels
- the voxels.binaryValues
- the binary-values.- Returns:
- the newly created
BinaryVoxels
.
-
assignOn
Creates an assigner that may set the on state in subsequently specified regions of the voxels.- Returns:
- a newly created assigner.
-
assignOff
Creates an assigner that may set the off state in subsequently specified regions of the voxels.- Returns:
- a newly created assigner.
-
countOn
public int countOn()Counts the number of voxels with an on state.- Returns:
- the total number of voxels with an on state.
-
countOff
public int countOff()Counts the number of voxels with an off state.- Returns:
- the total number of voxels with an off state.
-
extract
Interface that allows read/copy/duplication operations to be performed regarding the voxels intensities.- Returns:
- the interface.
-
slices
An index mapping slice of voxels (in the z dimension) to a particular buffer with the corresponding voxel intensities.- Returns:
- the index.
-
toString
-
voxels
Voxels that should only have two intensity-values (representing on and off states). This is not checked as a precondition. -
binaryValues
Which two intensity values represent off and on states.
-