T
- element-type, which must be an object-mask or an element containing an object-mask.public class LabelObjects<T> extends Object
An element can be an object-mask or any other class from which an object-mask can be derived.
Constructor and Description |
---|
LabelObjects(java.util.function.Function<T,ObjectMask> extractObject,
java.util.function.BiFunction<T,ReadableTuple3i,T> shiftElement) |
LabelObjects(Optional<java.util.function.UnaryOperator<T>> operationBeforeLabelling,
Optional<java.util.function.Consumer<OverlappingObject<T>>> overlappingObjectConsumer,
java.util.function.Function<T,ObjectMask> extractObject,
java.util.function.BiFunction<T,ReadableTuple3i,T> shiftElement) |
Modifier and Type | Method and Description |
---|---|
Channel |
createLabelledChannel(BoundedList<T> elements,
Optional<Map<Integer,T>> mapLabels)
Creates a channel that contains a unique integer (label) for each element's
object-representation.
|
void |
labelElements(Channel channel,
Iterable<T> elements,
Optional<Map<Integer,T>> mapLabels)
Replaces the contents of the channel so that all element's voxels are labelled with
successive unique integer identifiers 1,2,3 etc.
|
public LabelObjects(Optional<java.util.function.UnaryOperator<T>> operationBeforeLabelling, Optional<java.util.function.Consumer<OverlappingObject<T>>> overlappingObjectConsumer, java.util.function.Function<T,ObjectMask> extractObject, java.util.function.BiFunction<T,ReadableTuple3i,T> shiftElement)
public LabelObjects(java.util.function.Function<T,ObjectMask> extractObject, java.util.function.BiFunction<T,ReadableTuple3i,T> shiftElement)
public Channel createLabelledChannel(BoundedList<T> elements, Optional<Map<Integer,T>> mapLabels) throws CreateException
Specifically, a channel is created that is exactly the same-size as the bounding-box around a collection of element, and labels the background with 0, and each element in the list with an incrementing unique integer identifier.
elements
- the elements to write IDs for and a bounding-box that contains them all.mapLabels
- if set, an entry is added for every labelled element (unscaled) to the label
it is assigned.elements
and
with unique IDs for each element, and 0 for voxels not belonging to any element.CreateException
- if there are more than 255 objects, or if two objects overlap when
this cannot handled gracefully.public void labelElements(Channel channel, Iterable<T> elements, Optional<Map<Integer,T>> mapLabels) throws CreateException
channel
- the channel whose voxels will be replacedelements
- the element to write IDs for.mapLabels
- if set, an entry is added for every labelled element (unscaled) to the label
it is assignedCreateException
- if there are more than 255 objects, or if two objects overlap (and
overlappingObjectConsumer
is not set).Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.