masadcv / FastGeodis

Fast Implementation of Generalised Geodesic Distance Transform for CPU (OpenMP) and GPU (CUDA)
https://fastgeodis.readthedocs.io
BSD 3-Clause "New" or "Revised" License
91 stars 14 forks source link

[FEATURE] Add an API to provide signed distance maps #9

Closed tvercaut closed 2 years ago

tvercaut commented 2 years ago

Is your feature request related to a problem? Please describe. In several applications, having a signed distance map is helpful.

Describe the solution you'd like Providing a simple API to get signed distance maps in FastGeodis would be great.

Describe alternatives you've considered Compute two distance maps (one with the mask and another one with the inverted mask) and substract these

Additional context https://github.com/Project-MONAI/MONAI/discussions/4603

masadcv commented 2 years ago

Would this be equivalent to getting the output of these functions?

https://github.com/masadcv/FastGeodis/blob/d61aac07dd2323123a3c7195c512ba83c4b90dc5/FastGeodis/fastgeodis.cpp#L147-L153

and

https://github.com/masadcv/FastGeodis/blob/d61aac07dd2323123a3c7195c512ba83c4b90dc5/FastGeodis/fastgeodis.cpp#L168-L174

I can expose them through pytorch + python headers..

tvercaut commented 2 years ago

Nice. Yes, that looks right. I assume there might be a way to optimise things by running the raster scans with mask and 1-mask in parallel but this can be left for future improvements.

masadcv commented 2 years ago

Makes sense, yes let's look into it in future improvements!

masadcv commented 2 years ago

Closing this for now as it is addressed in #10 - we can reopen/look into improving this in future