T
- the desired type of the pixel labels, for instance Integer
to number objects or String
for user-assigned label names.public class LabelingType<T> extends Object implements Type<LabelingType<T>>, Set<T>
LabelingType
represents a labeling of a pixel with zero or more
labels of type T. Each label names a distinct object in the image space.Modifier and Type | Class and Description |
---|---|
protected static class |
LabelingType.ModCount |
Modifier and Type | Field and Description |
---|---|
protected LabelingType.ModCount |
generation |
protected LabelingMapping<T> |
mapping |
protected IntegerType<?> |
type |
Modifier | Constructor and Description |
---|---|
protected |
LabelingType(IntegerType<?> type,
LabelingMapping<T> mapping,
LabelingType.ModCount modCount)
Constructor for mirroring state with another labeling
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T label) |
boolean |
addAll(Collection<? extends T> c) |
void |
clear() |
boolean |
contains(Object label) |
boolean |
containsAll(Collection<?> labels) |
LabelingType<T> |
copy()
Note: The copy shares the mapping of this
LabelingType . |
LabelingType<T> |
createVariable()
Note: This creates an "independent"
LabelingType
instance that has its own LabelingMapping . |
<L> LabelingType<L> |
createVariable(Class<? extends L> newType)
Creates a new
LabelingType based on the underlying
IntegerType of the existing LabelingType with a different
label type L |
boolean |
equals(Object obj) |
int |
getGeneration()
The underlying storage has an associated generation which is incremented
every time the storage is modified.
|
IntegerType<?> |
getIndex() |
LabelingMapping<T> |
getMapping() |
int |
hashCode() |
boolean |
isEmpty() |
Iterator<T> |
iterator()
Note: the returned iterator reflects the label set at the time this
method was called.
|
boolean |
remove(Object label) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
void |
set(LabelingType<T> c)
Sets the value of another
Type . |
int |
size() |
Object[] |
toArray() |
<T1> T1[] |
toArray(T1[] a) |
String |
toString() |
boolean |
valueEquals(LabelingType<T> t) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
spliterator
parallelStream, removeIf, stream
protected final LabelingType.ModCount generation
protected final LabelingMapping<T> mapping
protected IntegerType<?> type
protected LabelingType(IntegerType<?> type, LabelingMapping<T> mapping, LabelingType.ModCount modCount)
type
- Wrapped typemapping
- Mapping from wrapped type to LabelingListmodCount
- Generation of the typepublic void set(LabelingType<T> c)
Type
Type
.set
in interface Type<LabelingType<T>>
c
- the new valuepublic LabelingType<T> createVariable()
LabelingType
instance that has its own LabelingMapping
.createVariable
in interface Type<LabelingType<T>>
Type
variablepublic LabelingType<T> copy()
LabelingType
. The
rationale is that clients will use this to remember the value at a given
position, and this.set( this.copy() )
will be fast if the copy
has the same mapping. If this causes problems, we may change it later.copy
in interface Type<LabelingType<T>>
Type
variablepublic int getGeneration()
public LabelingMapping<T> getMapping()
public IntegerType<?> getIndex()
IntegerType
holding the current index at the position of
the LabelingType.
NB: The returned IntegerType
should be used read-only.
Don't write to this type. The value of the IntegerType
refers to a key in the LabelingMapping
. Writing to this
type may invalidate the caching of the
LabelingROIStrategy
.public boolean add(T label)
public boolean addAll(Collection<? extends T> c)
public void clear()
public boolean contains(Object label)
public boolean containsAll(Collection<?> labels)
containsAll
in interface Collection<T>
containsAll
in interface Set<T>
public boolean isEmpty()
public Iterator<T> iterator()
LabelingType
or the label set are not reflected!public boolean remove(Object label)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public int size()
public Object[] toArray()
public <T1> T1[] toArray(T1[] a)
public int hashCode()
public boolean equals(Object obj)
public <L> LabelingType<L> createVariable(Class<? extends L> newType)
LabelingType
based on the underlying
IntegerType
of the existing LabelingType
with a different
label type LnewType
- the type of the labels of the created LabelingType
LabelingType
public boolean valueEquals(LabelingType<T> t)
valueEquals
in interface ValueEquals<LabelingType<T>>
Copyright © 2015–2022 ImgLib2. All rights reserved.