Example #1
0
    def test_merge_overlaps_with_threshold(self):
        ll = LabelList(idx='test', labels=[
            Label('c', 9.0, 12.0),
            Label('c', 12.05, 14.0),
        ])

        ll.merge_overlaps(threshold=0.1)

        expected = LabelList(idx='test', labels=[
            Label('c', 9.0, 14.0),
        ])

        assert ll == expected
Example #2
0
    def test_merge_overlaps_when_fully_contained(self):
        ll = LabelList(idx='test', labels=[
            Label('a', 0.0, 4.0),
            Label('b', 4.0, 8.0),
            Label('b', 5.0, 7.3),
            Label('b', 7.9, 8.7),
            Label('c', 9.0, 12.0),
        ])

        ll.merge_overlaps()

        expected = LabelList(idx='test', labels=[
            Label('a', 0.0, 4.0),
            Label('b', 4.0, 8.7),
            Label('c', 9.0, 12.0),
        ])

        assert ll == expected
Example #3
0
    def test_merge_overlaps_with_multiple_overlapping(self):
        ll = LabelList(idx='test', labels=[
            Label('a', 0.0, 4.0),
            Label('b', 4.0, 8.0),
            Label('b', 6.2, 9.3),
            Label('b', 7.1, 10.9),
            Label('c', 9.0, 12.0),
        ])

        ll.merge_overlaps()

        expected = LabelList(idx='test', labels=[
            Label('a', 0.0, 4.0),
            Label('b', 4.0, 10.9),
            Label('c', 9.0, 12.0),
        ])

        assert ll == expected
Example #4
0
    def test_merge_overlaps(self):
        ll = LabelList(idx='test', labels=[
            Label('a', 0.0, 4.0),
            Label('b', 4.0, 8.0),
            Label('b', 7.9, 9.3),
            Label('c', 9.0, 12.0),
            Label('c', 12.05, 14.0),
        ])
        ll.merge_overlaps()

        expected = LabelList(idx='test', labels=[
            Label('a', 0.0, 4.0),
            Label('b', 4.0, 9.3),
            Label('c', 9.0, 12.0),
            Label('c', 12.05, 14.0),
        ])

        assert ll == expected