-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] GPU implementation of accurate Euclidean Distance Transforms #49
Comments
In case a CPU fallback is interesting, I have identified and modernised a suitable standalone package here: It is still missing support for anisotropic voxels though: |
HI @tvercaut , |
Fast marching is more generic but only provides an approximation. Felzenszwalb & Huttenlocher and PBA are both restricted to Euclidean distances but should be exact. I would thus keep both options in. |
okay, many thanks!, let me look into this... I will update with a PR in the coming days... For GPU, I need more time to understand and then implement the approach linked above. |
I just took a stab at supporting anisotrpic voxels in the CPU algorithm for exact Euclidean distance transforms. You can check it in this branch: |
On a related note, we could also consider implementing the Jump Flooding Algorithm (JFA): It provides a competitive lternative to PBA according to this reference and it seems easy to implement: Code for JFA can be found in several locations:
|
Is your feature request related to a problem? Please describe.
The package currently provide GPU-based approximations of Geodesic and Euclidean distance transforms.
Following #42 fast marching now allows for more accurate computations of Euclidean distance transforms but this is limited to CPU operations and remains an approximation.
Describe the solution you'd like
Having a GPU implementation of an exact Euclidean Distance Transform would strengthen the package.
Describe alternatives you've considered
Rely on third party libs for this. e.g. CUCIM, Tensorflow or PBA+
https://docs.rapids.ai/api/cucim/stable/api/#cucim.core.operations.morphology.distance_transform_edt
https://www.tensorflow.org/addons/api_docs/python/tfa/image/euclidean_dist_transform
https://github.com/orzzzjq/Parallel-Banding-Algorithm-plus
Having this integrated in FastGeodis withouth the need for external dependencies would nonetheless be nice and make the pytorch link tighter.
Additional context
This feature request has been voice earlier, e.g.:
#40 (comment)
Project-MONAI/MONAI#1332 (comment)
The CUCIM code, based on PBA+ is released under MIT, seems fairly standalone, and could thus be copy-pasted in this repo for convenience:
https://github.com/rapidsai/cucim/tree/main/python/cucim/src/cucim/core/operations/morphology
The text was updated successfully, but these errors were encountered: