public class Labelings extends Object
Constructor and Description |
---|
Labelings() |
Modifier and Type | Method and Description |
---|---|
static <T> LabelingMapping<T> |
getLabelingMapping(RandomAccessibleInterval<LabelingType<T>> labeling)
|
static <T,I extends IntegerType<I>> |
getOccurringPixelSets(ImgLabeling<T,I> img)
Return a
Set of occurring pixel values in the ImgLabeling index image. |
static <T,I extends IntegerType<I>> |
hasIntersectingLabels(ImgLabeling<T,I> img)
Check if the image labeling
img has intersecting labels. |
static <T,U,I extends IntegerType<I>> |
remapLabels(ImgLabeling<T,I> labeling,
Function<T,U> function)
Create a new
ImgLabeling from an input labeling, with the labels
transformed according to the provided Function . |
static <T,U,I extends IntegerType<I>> |
remapLabels(ImgLabeling<T,I> labeling,
Map<T,U> mapping)
Create a new
ImgLabeling from an input labeling, with the labels
transformed according to the provided Map . |
public static <T> LabelingMapping<T> getLabelingMapping(RandomAccessibleInterval<LabelingType<T>> labeling)
labeling
- The label imagepublic static <T,U,I extends IntegerType<I>> ImgLabeling<U,I> remapLabels(ImgLabeling<T,I> labeling, Function<T,U> function)
ImgLabeling
from an input labeling, with the labels
transformed according to the provided Function
.
The mapping function needs to be an injective function (i.e. no
duplicates are allowed in the result of the mapping), otherwise an
IllegalArgumentException
will be thrown.labeling
- The ImgLabeling
to be transformedfunction
- The Function
providing the mapping from input to
output labelsImgLabeling
public static <T,U,I extends IntegerType<I>> ImgLabeling<U,I> remapLabels(ImgLabeling<T,I> labeling, Map<T,U> mapping)
ImgLabeling
from an input labeling, with the labels
transformed according to the provided Map
.
The map needs to be injective/bijective (i.e. no duplicates are allowed
in the result of the mapping), otherwise an
IllegalArgumentException
will be thrown.labeling
- The ImgLabeling
to be transformedmapping
- The Map
mapping input to output labelsImgLabeling
public static <T,I extends IntegerType<I>> Set<I> getOccurringPixelSets(ImgLabeling<T,I> img)
Set
of occurring pixel values in the ImgLabeling
index image.T
- The type of labels assigned to pixelsI
- The pixel type of the backing imageimg
- Image labeling from which to extract the occurring pixel valuesSet
of occurring pixel valuespublic static <T,I extends IntegerType<I>> boolean hasIntersectingLabels(ImgLabeling<T,I> img)
img
has intersecting labels. Two labels intersect if there
is at least one pixel in the image labeled with both labels.T
- The type of labels assigned to pixelsI
- The pixel type of the backing imageimg
- Image labelingCopyright © 2015–2022 ImgLib2. All rights reserved.