How to get the laplacian of a scalar field?

Click For Summary
SUMMARY

The discussion focuses on calculating the Laplacian of a scalar field in both 2D and 3D volumes, specifically in the context of reaction diffusion applied to images. The user initially applies weights to neighboring pixels in 2D but encounters issues when transitioning to 3D, particularly with weight selection and value stability. It is established that for 3D, the weights must account for 26 neighboring cells, and the positive and negative weights must balance, similar to the 2D case where the original cell has a weight of -1. The user successfully resolves their issue by referencing the discrete Laplace operator and adjusting their calculations accordingly.

PREREQUISITES
  • Understanding of reaction diffusion processes in image processing
  • Familiarity with the discrete Laplace operator
  • Basic knowledge of 3D volumetric data structures, such as OpenVDB
  • Experience with weight calculations in multi-dimensional grids
NEXT STEPS
  • Research the implementation of the discrete Laplace operator in OpenVDB
  • Explore techniques for stabilizing values in iterative calculations
  • Learn about weight normalization methods for neighbor contributions in 3D
  • Investigate advanced reaction diffusion models in 3D image processing
USEFUL FOR

Researchers, computer graphics developers, and anyone involved in image processing or volumetric data analysis who seeks to understand the application of the Laplacian operator in multi-dimensional contexts.

cvex
Messages
8
Reaction score
0
Hi,

I am trying to calculate the laplacian of a scalar field but I might actually need something else. So basically I am applying reaction diffusion on a 2d image. I am reading the neighbours, multiplying them with these weights and then add them.

4K0V1JA.png


This works great. I don't know if what I am doing is called laplacian but I was told that it is.

Now I am trying to do the same thing in 3d volumes:
http://www.openvdb.org/

But the problem is I don't know what weights to use to sum the neighbours. If I use the same weights on a 2d volume, it works just the same. But in 3d, I am not sure what the weights would be.

I also tried using actual laplacian (OpenVDB has tools to calculate it), but after 7-8 iterations the values in the volume go to infinity. Maybe what I need is not really laplacian. But whatever is coming from the neighbours has to be in balance so just like in the 2d image version, the values don't get bigger and bigger while nothing is getting smaller. That's my understanding.

I tried calculating the laplacian manually also by using the actual definition, and got different result that the build-in tools. Not sure if I am missing something:
http://paste.ofcode.org/QYUec5tu63AM6n2Bmax6C7

Do you guys know what I need?Cheers :)
 
Last edited by a moderator:
Physics news on Phys.org
Are the weights tied to the number of surrounding cells? So that for 3d you'd have 26 neighbors instead of 8 for 2d.

Or tied the number of lines through the point? so for 2d it would be 4 and for 3d it would be 4+9 or 13.

This is just my guess. It would be best if you knew how the weights are calculated.
 
Last edited:
  • Like
Likes   Reactions: cvex
Thanks a lot for replying. It's tied to the number of surrounding cells. So for 2d, it's 8 and for 3d it's 26 just like you said.

Also the positive and negative weights have to cancel out, which is why in 2d the original cell has a weight of -1 and the surrounding cells have a total weight of 1.

So in a way the 3d volume is like a stack of 2d images.
 
  • Like
Likes   Reactions: cvex
Thanks wolfman, I think that works. I tried it before I think but didn't divide the result by 6 :( Now it seems to work at least.

Thanks a lot :)
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
733
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
5
Views
4K
  • · Replies 15 ·
Replies
15
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K