public class ObjectWithProperties extends Object
ObjectMask
with associated key-value properties.Constructor and Description |
---|
ObjectWithProperties(BoundingBox box)
Creates as a bounding-box with all corresponding mask voxels set to off.
|
ObjectWithProperties(ObjectMask object)
Creates with an existing
ObjectMask and empty properties. |
ObjectWithProperties(ObjectMask object,
Map<String,Object> properties) |
Modifier and Type | Method and Description |
---|---|
ObjectMask |
asObjectMask()
Exposes the underlying
ObjectMask ignoring any properties. |
BoundingBox |
boundingBox()
The bounding-box which gives a location for the object-mask on an image.
|
ObjectWithProperties |
duplicate()
Deep copies the current instance.
|
boolean |
equals(Object obj) |
void |
forEachProperty(java.util.function.BiConsumer<String,Object> consumer)
Executes a consumer on each property.
|
Map<String,Object> |
getProperties()
A mapping between keys and corresponding values.
|
<T> T |
getProperty(String name)
Retrieves the value of a property corresponding to a particular name.
|
int |
hashCode() |
boolean |
hasProperty(String name)
Whether a particular property exists with a particular name.
|
ObjectWithProperties |
map(java.util.function.UnaryOperator<ObjectMask> operator)
Maps the underlying object-mask to another object-mask, reusing the same properties object.
|
<T> void |
setProperty(String name,
T value)
Assigns a value to a property with a particular name.
|
UnsignedByteBuffer |
sliceBufferLocal(int sliceIndexRelative)
A slice buffer with local coordinates.
|
String |
toString() |
public ObjectWithProperties(BoundingBox box)
Default BinaryValuesInt
of (off=0, on=255) are used for the mask.
box
- bounding-box.public ObjectWithProperties(ObjectMask object)
ObjectMask
and empty properties.object
- the object.public ObjectWithProperties(ObjectMask object, Map<String,Object> properties)
public <T> void setProperty(String name, T value)
Any existing value with the same name is replaced.
T
- type of property-value.name
- the name of the property.value
- the value of the property.public <T> T getProperty(String name)
Note that the user must be careful to retreieve this property with the correct-type as it
is cast to <T>
without any checks.
T
- type of property-value.name
- the name of the property.name
or null
if no such value
exists.public boolean hasProperty(String name)
name
- the name.public void forEachProperty(java.util.function.BiConsumer<String,Object> consumer)
consumer
- a consumer accepting the name and the value of the property.public ObjectWithProperties map(java.util.function.UnaryOperator<ObjectMask> operator)
Note the properties are not duplicated, and the new object will reference the same properties.
This is an immutable operation.
operator
- the operator that performs the mapping.public ObjectWithProperties duplicate()
public BoundingBox boundingBox()
public ObjectMask asObjectMask()
ObjectMask
ignoring any properties.ObjectMask
reusing the existing data object.public UnsignedByteBuffer sliceBufferLocal(int sliceIndexRelative)
i.e. with coordinates relative to the bounding-box corner.
sliceIndexRelative
- sliceIndex (z) relative to the bounding-box of the object-mask.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.