Class Channel
This is one of the key image-processing classes in Anchor. An image may have one channel
(grayscale) or several. Channels of identical size can be bundled together to form a Stack
.
The channel's voxels have an underlying data-type that is not exposed as a templated
parameter, but can be accessed via getVoxelDataType()
. This is deliberate weak-typing.
Each channel has an associated size and optionally defines a physical size for each voxel, as
stored in the associated Dimensions
structure.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionChannel
(Voxels<?> voxels, Optional<Resolution> resolution) Creates for particular voxels and resolution. -
Method Summary
Modifier and TypeMethodDescriptionInterface that allows manipulation of voxel intensities via arithmetic operations.void
assignResolution
(Optional<Resolution> resolution) Assigns a new resolution.assignValue
(int valueToAssign) Interface that allows assignment of a particular value to all or subsets of the voxels.The size and voxel-resolution of the channel.A deep-copy.equalMask
(BoundingBox box, int equalValue) boolean
equalsDeep
(Channel other, boolean compareResolution) Are the two channels equal using a deep voxel by voxel comparison?extent()
The size of the voxels across three dimensions.extract()
Interface that allows read/copy/duplication operations to be performed regarding the voxels intensities.extractSlice
(int sliceIndex) Creates a newChannel
containing only one particular slice.The underlying data-type of the voxels in the channel, represented by aVoxelDataType
instance.A maximum-intensity projection across the z-slices.A mean-intensity projection across the z-slices.void
replaceVoxels
(Voxels<?> voxelsToAssign) Assigns new voxels to replace the existing voxels.resizeXY
(int x, int y, VoxelsResizer resizer) LikeresizeXY(Extent, VoxelsResizer)
but specifies the size viaint
parameters.resizeXY
(Extent extentToAssign, VoxelsResizer resizer) Resizes the dimensions of the channel, interpolating the existing voxel values to match.The resolution of the voxel that describes a physical size for each voxel.scaleXY
(ScaleFactor scaleFactor, VoxelsResizer resizer) Resizes the dimensions of the channel, by scaling the existing size by a factor.toString()
A string representation of a histogram of voxel-intensities in the channel.voxels()
The underlying voxels in the channel.voxelsEqualTo
(int equalToValue) Operations on whether particular voxels are equal to a particular value.voxelsGreaterThan
(int threshold) Operations on whether particular voxels are greater than a threshold (but not equal to).
-
Constructor Details
-
Channel
Creates for particular voxels and resolution.- Parameters:
voxels
- the voxels.resolution
- the resolution, if it is known.
-
-
Method Details
-
equalMask
Creates aObjectMask
representing all the voxels inbox
equal toequalValue
.The equal values in the box are assigned an on state, and all other values an off state.
- Parameters:
box
- the bounding-box to consider voxels within, and which forms the bounding-box for the createdObjectMask
.equalValue
- the value voxels must be equal to, so to be assigned an on state in theObjectMask
.- Returns:
- a newly created
ObjectMask
as per above.
-
voxels
The underlying voxels in the channel.- Returns:
- the voxels, wrapped in a class that facilitates friendly conversion.
-
replaceVoxels
Assigns new voxels to replace the existing voxels.- Parameters:
voxelsToAssign
- voxels to be assigned.- Throws:
IncorrectImageSizeException
- ifvoxelsToAssign
has a different size to the dimensions of the channel.
-
extractSlice
Creates a newChannel
containing only one particular slice.The existing
Voxels
are reused, without creating new buffers.- Parameters:
sliceIndex
- the index of the slice to extract (index in z-dimension).- Returns:
- a newly created
Channel
consisting of the slice atsliceIndex
only.
-
scaleXY
Resizes the dimensions of the channel, by scaling the existing size by a factor.Existing voxel values are interpolated to match the new size.
This is useful for quickly downscaling or upscaling by a particular factor.
It is an immutable operation, and the existing object state remains unchanged.
The z-dimension remains unchanged.
- Parameters:
scaleFactor
- the scaling-factor to be applied to the sizes.resizer
- an interpolator for resizing voxels.- Returns:
- a newly created
Channel
containing a resized version of the current.
-
resizeXY
Resizes the dimensions of the channel, interpolating the existing voxel values to match.It is an immutable operation, and the existing object state remains unchanged.
The z-dimension remains unchanged.
- Parameters:
extentToAssign
- the new size to assign. The z-component is ignored.resizer
- an interpolator for resizing voxels.- Returns:
- a newly created
Channel
containing a resized version of the current.
-
resizeXY
LikeresizeXY(Extent, VoxelsResizer)
but specifies the size viaint
parameters.- Parameters:
x
- the size along the x-axis.y
- the size along the y-axis.resizer
- an interpolator for resizing voxels.- Returns:
- a newly created
Channel
containing a resized version of the current.
-
projectMax
A maximum-intensity projection across the z-slices.- Returns:
- a newly created
Channel
with a newly created voxel-buffer.
-
projectMean
A mean-intensity projection across the z-slices.- Returns:
- a newly created
Channel
with a newly created voxel-buffer.
-
duplicate
A deep-copy.- Returns:
- newly created deep-copy.
-
voxelsEqualTo
Operations on whether particular voxels are equal to a particular value.- Parameters:
equalToValue
- the value all voxels should be equal to.- Returns:
- a newly instantiated object to perform queries on voxels who fulfill the above condition.
-
voxelsGreaterThan
Operations on whether particular voxels are greater than a threshold (but not equal to).- Parameters:
threshold
- voxel-values greater than this threshold are included.- Returns:
- a newly instantiated object to perform queries on voxels who fulfill the above condition.
-
assignResolution
Assigns a new resolution.This is a mutable operation that replaces existing state.
- Parameters:
resolution
- the resolution to assign.
-
getVoxelDataType
The underlying data-type of the voxels in the channel, represented by aVoxelDataType
instance.- Returns:
- an instance of
VoxelDataType
.
-
toString
A string representation of a histogram of voxel-intensities in the channel. -
equalsDeep
Are the two channels equal using a deep voxel by voxel comparison?- Parameters:
other
- the channel to compare with.compareResolution
- if true, image-resolution must also be equal, otherwise it is not compared.- Returns:
- true if they are deemed equal, false otherwise.
-
arithmetic
Interface that allows manipulation of voxel intensities via arithmetic operations.- Returns:
- the interface.
-
assignValue
Interface that allows assignment of a particular value to all or subsets of the voxels.- Parameters:
valueToAssign
- the value to assign.- Returns:
- the interface.
-
extract
Interface that allows read/copy/duplication operations to be performed regarding the voxels intensities.- Returns:
- the interface.
-
extent
The size of the voxels across three dimensions.- Returns:
- the size.
-
resolution
The resolution of the voxel that describes a physical size for each voxel.- Returns:
- the resolution, if it exists.
-
dimensions
The size and voxel-resolution of the channel.
-