LIVIAETS / boundary-loss

Official code for "Boundary loss for highly unbalanced segmentation", runner-up for best paper award at MIDL 2019. Extended version in MedIA, volume 67, January 2021.
https://doi.org/10.1016/j.media.2020.101851
MIT License
647 stars 97 forks source link

Meaning of -1 in the calculation of distance maps #42

Closed aguirrejuan closed 3 years ago

aguirrejuan commented 3 years ago

Hi, nice paper

Could you explain to me why you use -1 ?

https://github.com/LIVIAETS/boundary-loss/blob/749602d822fcb097c79a7fb708805b8982c37030/utils.py#L271-L272

Thanks.

HKervadec commented 3 years ago

Hi,

I think this was already discussed in this thread: https://github.com/LIVIAETS/boundary-loss/issues/8

The rationale, when I implemented it, was that we compute the distance to the boundary. By this logic, the distance of the boundary wrt the boundary should be 0. Since this not the behavior of the SciPy function distance_transform_edt. I did that manually by shifting the distance by 1 on the distance to the positive mask.

To be fair, I do not think it would change (much) the results, since it is only shifting the distance values inside the object. But I did not had time to compare the impact of this implementation detail.

Does it answer your question?

Best,

Hoel

aguirrejuan commented 3 years ago

Thanks