DIAGNijmegen / pathology-whole-slide-data

A package for working with whole-slide data including a fast batch iterator that can be used to train deep learning models.
https://diagnijmegen.github.io/pathology-whole-slide-data/
Apache License 2.0
86 stars 24 forks source link

Patch label sampler fails with point annotation #45

Closed JoeySpronck closed 8 months ago

JoeySpronck commented 8 months ago

I was sampling patches that I used to sample correctly with WSD 0.15/0.16

However I got the following error: IndexError: index 1 is out of bounds for axis 0 with size 1

at this line: https://github.com/DIAGNijmegen/pathology-whole-slide-data/blob/0a20034f237ed154f0d74f75bbd15432c80ddcc3/wholeslidedata/samplers/patchlabelsampler.py#L146

Aparantly there is an incorrect point annotation (a TIL) in a segmentation class (stoma) that im sampling, but this didnt fail before, and I think it shouldnt fail

'coordinates' in this case = [[99.7655 78.5625]]

so I think uit should be: mask[int(coordinates[0][1]), int(coordinates[0][0])] instead of: mask[int(coordinates[1]), int(coordinates[0])]

JoeySpronck commented 8 months ago

Just tested it and it indeed solves the issue

martvanrijthoven commented 8 months ago

Thanks Joey, could you please make a PR for this fix?

martvanrijthoven commented 8 months ago

Thanks Joey!!

Fix by Joey #46