# Limeseg 3D curvature calculation

Hi,

I have had some really nice results from Limeseg and would like to use the obtained surfaces to calculate the 3D curvature and was wondering what would be the easiest way to do it using the output of Limeseg. Ideally I wanted to calculate the curvature from Matlab (which I am the most familiar with), but the 2 functions I found the Matlab file exchange forum 1) does not seem to give correct results or 2) takes a 2D arrays as an input which appears challenging from the point cloud obtained from Limeseg. I am open for any suggestion!

Arnaud

2 Likes

Hi @Arnaud,

Can you tell us more about what youâ€™re trying to accomplish, and what you plan to use the curvature measure to do?

What functions did you find?

Can you explain why it seems wrong?

The thing is, measuring curvature in 3d is not super straightforward, in fact, there are different curvatures that measure different things:

and what is appropriate will depend on what you want to do with it.

By the way, thereâ€™s a Fiji plugin for finding curvatures, but as youâ€™ll see itâ€™s in need of documentation

John

Edit:
The curvatures above are all related (i.e. not totally different, but they are different)

2 Likes

Hi @bogovicj -thanks for the swift reply!

Yes, so the final goal would be to use the results of limeseg from @NicoKiaru to compute the 3D curvature (Gaussian or mean) and display it in 3D. Ideally next step from there would be to correlate this with the intensity for each point of the point cloud.

The first one:

Returns the normals and the curvature of a pointcloud. The normal values that the function returns are different than the normal values from the built-in function https://www.mathworks.com/help/vision/ref/pcnormals.html

The other one : https://www.mathworks.com/matlabcentral/fileexchange/11168-surface-curvature
takes a 2D arrays as an input and frankly I donâ€™t see how I will translate my .ply pointcloud to a 2D arrays.

Ideally I would like to get the Gaussian and/or the mean curvature.

That would be the dream any indication on how I could get it to work? I would still have to read one way or another the output of Limeseg no?

I hope this all somehow makes sense, many thanks for your help!

Cheers,
Arnaud

1 Like

Hi Arnaud,

Would it work for you if the curvature is calculated on 2D slices of the 3D object?

If the second function takes the surface as 2D arrays, I would assume it is using the standard Matlab format. Indeed, the comments regarding the packing include a discussion from other users about converting from point clouds to the required 2D arrays. I havenâ€™t read though them in detail but you might be able to find a solution to convert your point cloud to the 2D arrays. If you want to know more about how the 2D array representation of a surface works in Matlab I can try to explain. I had to deal with them in order to make pretty 3D histograms.

Hi,

for computing curvatures on 3D surface meshes within Matlab, I would recommend the Toolbox Graph from Gabriel Peyre:

While somehow old, it contains many options for computing and representing mean or gaussian curvatures.
Note that if you want to compute curvatures, you need to have information about the connectivity of the vertices. Therefore a face array will be required, or, the assumption that the vertices are organized into a regular grid embedded into a 3D space (as in the second link you posted).

1 Like

I think this would be very interesting to include these curvature measurements within LimeSeg. Itâ€™s not my priority though so keep looking. Iâ€™ll let you know in this thread if I manage to get something.

4 Likes

Yes, really the goal here would be to do it in 3D.

It appeared that it would be possible to export a Mesh from Limeseg and as far as I understand that would make the use of the Matlab functions much easier.

I was not aware of this Toolbox, it looks very interesting, thanks! I will try out the suggestions now thanks!

Arnaud

Wait I do-not get it, if you have a 3D object you can either fit function in 3D and then go next or you can make 2D slices of the 3D object and fit functions in 2D and then go next. Both the approaches are very different and without knowing what the actual question is, it is for you to decide which of the two approaches would work for you.

Glad youâ€™re getting nice suggestions here.
The package from @dlegland looks really nice.

Two short follow ups from me:
Regarding the fiji plugin - imo itâ€™s not the right tool for you because, after peeking at the source youâ€™ll have to convert the limeseg output into a 3d image to get the curvatures, and even once you do that, you wonâ€™t directly get the curvature of the surface, but some related curvatures from the intenisites of the image you make.

Second, it sounds like you already have two ways to get the curvature from matlab packages - is that right?? you said:

Which makes it sounds like you got an answer from both the built in package and the file exchange library. Are they completely different? Or a little bit different?

I would encourage you to think about what you want to use the curvature measure for, and whether the outputs of the packages you already have will do the trick. Of course if theyâ€™re giving you complete garbage, its another story. But if the output is reasonable, then it may work for your task.

Good luck
John

1 Like