Project-MONAI / MONAI

AI Toolkit for Healthcare Imaging
https://monai.io/
Apache License 2.0
5.69k stars 1.04k forks source link

BendingEnergyLoss #5939

Open ajoshiusc opened 1 year ago

ajoshiusc commented 1 year ago

Is your feature request related to a problem? Please describe. central difference approximation is used twice in the computation of double derivatives in functions BendingEnergyLoss

The computation of double derivatives using central difference two times could be unstable numerically. The finite difference template would be too large leading to artifacts.

Describe the solution you'd like The correct template kernel for the second difference would be [1 -2 1] for double derivative wrt same variable. And for mixed partials, you can use forward difference approx. for example, here http://www.holoborodko.com/pavel/2014/11/04/computing-mixed-derivatives-by-finite-differences/

wyli commented 1 year ago

thanks, would be interesting to compare the memory footprint as well, would you like to contribute an implementation? I think apply_filter and seperable_filtering in MONAI could be used:

https://github.com/Project-MONAI/MONAI/blob/f9842c0dda70714c826eeb8b12bbf93d987a0584/monai/networks/layers/simplelayers.py#L253

https://github.com/Project-MONAI/MONAI/blob/f9842c0dda70714c826eeb8b12bbf93d987a0584/monai/networks/layers/simplelayers.py#L208

ajoshiusc commented 1 year ago

Hi Wenqi, Yes, I am interested in contributing. Should I send pull requests, or is there another way? thanks, best, Anand

On Mon, Feb 6, 2023 at 1:22 AM Wenqi Li @.***> wrote:

thanks, would be interesting to compare the memory footprint as well, would you like to contribute an implementation? I think apply_filter and seperable_filtering in MONAI could be used:

https://github.com/Project-MONAI/MONAI/blob/f9842c0dda70714c826eeb8b12bbf93d987a0584/monai/networks/layers/simplelayers.py#L253 https://urldefense.com/v3/__https://github.com/Project-MONAI/MONAI/blob/f9842c0dda70714c826eeb8b12bbf93d987a0584/monai/networks/layers/simplelayers.py*L253__;Iw!!LIr3w8kk_Xxm!ukiCuquHz-QlcdmbxCY2McilzJsBJbJRuWrH-Eo0nGXCtmrQgDjh5PocY5_MWTUarZFFom5DisMHkb_6s8-Q86dZAQ$

https://github.com/Project-MONAI/MONAI/blob/f9842c0dda70714c826eeb8b12bbf93d987a0584/monai/networks/layers/simplelayers.py#L208 https://urldefense.com/v3/__https://github.com/Project-MONAI/MONAI/blob/f9842c0dda70714c826eeb8b12bbf93d987a0584/monai/networks/layers/simplelayers.py*L208__;Iw!!LIr3w8kk_Xxm!ukiCuquHz-QlcdmbxCY2McilzJsBJbJRuWrH-Eo0nGXCtmrQgDjh5PocY5_MWTUarZFFom5DisMHkb_6s8-F3Eg6jA$

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/Project-MONAI/MONAI/issues/5939*issuecomment-1418763387__;Iw!!LIr3w8kk_Xxm!ukiCuquHz-QlcdmbxCY2McilzJsBJbJRuWrH-Eo0nGXCtmrQgDjh5PocY5_MWTUarZFFom5DisMHkb_6s886atyBrA$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ADUILF4F7VT7DS5SZQI4WWDWWC7DVANCNFSM6AAAAAAURS4UFA__;!!LIr3w8kk_Xxm!ukiCuquHz-QlcdmbxCY2McilzJsBJbJRuWrH-Eo0nGXCtmrQgDjh5PocY5_MWTUarZFFom5DisMHkb_6s8-cLss11Q$ . You are receiving this because you authored the thread.Message ID: @.***>

wyli commented 1 year ago

thanks, please create a pull request, there are some steps to make the project's unit tests and coding styles consistent https://github.com/Project-MONAI/MONAI/blob/dev/CONTRIBUTING.md#preparing-pull-requests