This pull request adds an OverlappingLabels class that allows to quantify the overlap between all pairs of labels in a given ImgLabeling (by creating a confusion/co-occurrence matrix).
It makes use of FragmentProperties from LabelRegions, so we need to change the field visibility of indexToFragmentProperties to protected.
The test (OverlappingLabelsTest) illustrates the functionality, given the following test labeling:
1
1
2
123
1 3
3
3
The labels 1 and 3 overlap by 2 pixels.
The labels 2 and 3 overlap by 1 pixel, which corresponds to fractions of 0.5 (of label 2) and 0.25 (of label 3).
Let me know if this would be useful to have in imglib2-roi. I wasn't sure about the naming, so feel free to suggest changes.
This pull request adds an
OverlappingLabels
class that allows to quantify the overlap between all pairs of labels in a givenImgLabeling
(by creating a confusion/co-occurrence matrix).It makes use of
FragmentProperties
fromLabelRegions
, so we need to change the field visibility ofindexToFragmentProperties
toprotected
.The test (
OverlappingLabelsTest
) illustrates the functionality, given the following test labeling:The labels
1
and3
overlap by 2 pixels.The labels
2
and3
overlap by 1 pixel, which corresponds to fractions of0.5
(of label2
) and0.25
(of label3
).Let me know if this would be useful to have in
imglib2-roi
. I wasn't sure about the naming, so feel free to suggest changes.