Constructor and Description |
---|
BoundedVoxels(BoundedVoxels<T> source)
Copy constructor.
|
BoundedVoxels(BoundingBox boundingBox,
Voxels<T> voxels)
Creates voxels with a corresponding bounding box.
|
BoundedVoxels(Voxels<T> voxels)
Creates voxels bounded to match the entire voxel-data at the origin.
|
Modifier and Type | Method and Description |
---|---|
VoxelsArithmetic |
arithmetic()
Interface that allows manipulation of voxel intensities via arithmetic operations.
|
VoxelsAssigner |
assignValue(int valueToAssign)
Assigns a value to a bounded-voxels accepting global coordinates for objects, boxes
etc.
|
BoundingBox |
boundingBox()
A bounding-box that associates voxels to a particular part of an image.
|
ReadableTuple3i |
cornerMin()
The minimum corner of the bounding box in each dimension.
|
BoundingBox |
dilate(boolean do3D,
Optional<Extent> clipRegion)
Grow bounding-box by 1 pixel in all directions.
|
BoundedVoxels<T> |
duplicate()
A deep-copy of the current structure.
|
boolean |
equalsDeep(BoundedVoxels<?> other)
Performs a deep equality check, that includes checking that each voxel has an
identical value.
|
Extent |
extent()
The size of the voxels across three dimensions, and also the size of the associated
bounding-box.
|
VoxelsExtracter<T> |
extract()
Extracts value from voxels using global coordinates (relative to the image as a
whole).
|
BoundedVoxels<T> |
extractSlice(int sliceIndex)
Extracts a particular slice.
|
BoundedVoxels<T> |
growBuffer(Point3i growthNegative,
Point3i growthPositive,
Optional<Extent> clipRegion,
VoxelsFactoryTypeBound<T> factory)
Grows the voxel buffer in the positive and negative directions by a certain amount.
|
BoundedVoxels<T> |
growToZ(int sizeZ,
VoxelsFactoryTypeBound<T> factory)
Grows a single z-sliced
BoundedVoxels by duplicating the slice across the z-dimension
sizeZ number of times. |
BoundedVoxels<T> |
mapBoundingBoxPreserveExtent(BoundingBox boundingBoxToAssign)
Applies a function to map the bounding-box to a new-value.
|
BoundedVoxels<T> |
projectMax()
A maximum-intensity projection (flattens in z dimension)
|
BoundedVoxels<T> |
region(BoundingBox box,
boolean reuseIfPossible)
A (sub-)region of the voxels.
|
BoundedVoxels<T> |
regionIntersecting(BoundingBox box,
int voxelValueForRest)
Like
region(org.anchoranalysis.spatial.box.BoundingBox, boolean) but only expects a bounding-box that intersects at least partially. |
BoundedVoxels<T> |
regionZ(int zMin,
int zMax,
VoxelsFactoryTypeBound<T> factory)
Creates an box with a subrange of the slices.
|
void |
replaceSlice(int sliceIndexToUpdate,
VoxelBuffer<T> bufferToAssign)
Assigns a new buffer for a slice.
|
BoundedVoxels<T> |
replaceVoxels(Voxels<T> voxelsToAssign)
Replaces the voxels in the box.
|
BoundedVoxels<T> |
scale(ScaleFactor scaleFactor,
VoxelsResizer resizer,
Optional<Extent> clipTo)
Creates a scaled-version (in XY dimensions only) of the current bounding-box.
|
T |
sliceBufferGlobal(int sliceIndexGlobal)
A slice buffer with global coordinates.
|
T |
sliceBufferLocal(int sliceIndexRelative)
A slice buffer with local coordinates.
|
String |
toString() |
Voxels<T> |
voxels()
Voxel-data that fits inside the bounding-box (its extent is invariant with the extent of the
bounding-box).
|
public BoundedVoxels(Voxels<T> voxels)
voxels
- voxel-data.public BoundedVoxels(BoundedVoxels<T> source)
It is a deep copy. The voxel memory buffer is duplicated.
source
- where to copy from.public BoundedVoxels(BoundingBox boundingBox, Voxels<T> voxels)
boundingBox
- bounding-box.voxels
- voxels which must have the same extent as boundingBox
.public boolean equalsDeep(BoundedVoxels<?> other)
other
- the voxels to check with.BoundedVoxels
instances have identical values and
bounding-boxes.public BoundedVoxels<T> replaceVoxels(Voxels<T> voxelsToAssign)
This is an immutable operation, and a new Voxels
are created.
voxelsToAssign
- voxels to be assigned.public BoundedVoxels<T> growToZ(int sizeZ, VoxelsFactoryTypeBound<T> factory) throws OperationFailedException
BoundedVoxels
by duplicating the slice across the z-dimension
sizeZ
number of times.sizeZ
- the size in the z-dimension to grow to i.e. the number of duplicated sizes.factory
- a factory to use to create the duplicated voxels.BoundedVoxels
with an identical corner, but with a 3D bounding-box (and
duplicated slices) instead of the previous 2D.OperationFailedException
- if the existing voxels aren't 2D (a single slice).public BoundingBox dilate(boolean do3D, Optional<Extent> clipRegion)
do3D
- 3-dimensions (true) or 2-dimensions (false).clipRegion
- a region to clip to, which we can't grow beyond.public BoundedVoxels<T> growBuffer(Point3i growthNegative, Point3i growthPositive, Optional<Extent> clipRegion, VoxelsFactoryTypeBound<T> factory) throws OperationFailedException
This operation is immutable.
growthNegative
- how much to grow in the negative direction (i.e. downards
direction on an axis).growthPositive
- how much to grow in the positive direction (i.e. upwards
direction on an axis).clipRegion
- if defined, clips the buffer to this region.factory
- a factory to create VoxelsFactoryTypeBound
.Voxels
with grown buffers.OperationFailedException
- if the voxels are located outside the clipping region.public BoundedVoxels<T> scale(ScaleFactor scaleFactor, VoxelsResizer resizer, Optional<Extent> clipTo)
This is an immutable operation.
scaleFactor
- what to scale X and Y dimensions by?resizer
- an interpolator for resizing voxels.clipTo
- an extent which the object-masks should always fit inside after scaling (to
catch any rounding errors that push the bounding box outside the scene-boundary).BoundedVoxels
box of specified size containing scaled contents of the
existing.public BoundedVoxels<T> projectMax()
This is an immutable operation.
public BoundedVoxels<T> duplicate()
public T sliceBufferLocal(int sliceIndexRelative)
sliceIndexRelative
- sliceIndex (z) relative to the associated bounding-box minimum
corner.public T sliceBufferGlobal(int sliceIndexGlobal)
sliceIndexGlobal
- sliceIndex (z) in global coordinates (relative to the image as a
whole).public Extent extent()
public BoundedVoxels<T> regionZ(int zMin, int zMax, VoxelsFactoryTypeBound<T> factory) throws CreateException
This will always reuse the existing voxel-buffers.
zMin
- minimum z-slice index, inclusive.zMax
- maximum z-slice index, inclusive.factory
- factory to use to create new voxels.CreateException
- if zMin
or zMax
are outside the permitted range.public BoundedVoxels<T> region(BoundingBox box, boolean reuseIfPossible) throws CreateException
The region may some smaller portion of the voxels, or the voxels in their entirety.
It should never be larger than the voxels.
box
- bounding-box in absolute coordinates.reuseIfPossible
- if true the existing box will be reused if possible, otherwise a new
box is always created.CreateException
- if the source box does not contain the target box.VoxelsExtracter.region(org.anchoranalysis.spatial.box.BoundingBox, boolean)
public BoundedVoxels<T> regionIntersecting(BoundingBox box, int voxelValueForRest) throws CreateException
region(org.anchoranalysis.spatial.box.BoundingBox, boolean)
but only expects a bounding-box that intersects at least partially.
This is a weakened condition compared to region(org.anchoranalysis.spatial.box.BoundingBox, boolean)
.
The region outputted will have the same size and coordinates as the bounding-box, but with
the correct voxel-values for the part within the voxels. Any other voxels are set to voxelValueForRest
.
A new voxel-buffer is always created for this operation i.e. the existing box is never
reused like sometimes in region(org.anchoranalysis.spatial.box.BoundingBox, boolean)
.
box
- bounding-box in absolute coordinates, that must at least partially intersect with
the current bounds.voxelValueForRest
- a voxel-value for the parts of the buffer not covered by the
intersection.CreateException
- if the boxes do not intersect.public BoundedVoxels<T> mapBoundingBoxPreserveExtent(BoundingBox boundingBoxToAssign)
The Extent
of the bounding-box should remain unchanged in value.
This is an immutable operation, but the existing voxel-buffers are reused in the new object.
boundingBoxToAssign
- the new bounding-box to assign.public BoundedVoxels<T> extractSlice(int sliceIndex)
This is an immutable operation, but the voxels-buffer for the slice is reused.
sliceIndex
- which slice to extract (z) in global coordinates.public ReadableTuple3i cornerMin()
public void replaceSlice(int sliceIndexToUpdate, VoxelBuffer<T> bufferToAssign)
This is a mutable operation.
sliceIndexToUpdate
- slice-index to update.bufferToAssign
- buffer to assign.public VoxelsArithmetic arithmetic()
public VoxelsAssigner assignValue(int valueToAssign)
valueToAssign
- value to assign.public final VoxelsExtracter<T> extract()
public BoundingBox boundingBox()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.