campaslab / napari-stress

Interactive surface analysis in napari for bio-mechanical stress measurement
https://campaslab.github.io/napari-stress/
BSD 3-Clause "New" or "Revised" License
17 stars 4 forks source link

Measure anisotropic stress #106

Closed jo-mueller closed 2 years ago

jo-mueller commented 2 years ago

The anisotropic stress at every (quadrature) point can be calculated as shown in the code here:

# This is the 2\gamma*(H-H0 we USE FOR OUR anisotropic stress analysis:
self.Anis_Stress_pts_lbdv = self.TwoGammaVal*(self.Mean_Curv_lbdv_pts - self.H0_Int_of_H_over_Area)     

Here, the variable TwoGammaVal (2$\gamma$) is a physical property of the experiment as described in the paper (Materials&Methods > Tissue-scale stresses). It needs to be given by the user as a (float) parameter.

This function should go into src/napari_stress/_measurements/stresses.py.

jo-mueller commented 2 years ago

Issue #110 needs to be fixed before this can move forward.

jo-mueller commented 2 years ago

@GrossBJ how's it going? Hope you're enjoying your trip!

I'd have a minor question about something related to the stress code (rather minor) I can't quite wrap my head around: In the originial stress code (here), the maximal tissue stress anisotropy is calculated as follows:

# Calculate 2\gamma*(H_3 - H_1), mirroring Ellipsoid max stress anisotropy:
Avg_H_lbdv_X_axis = (self.Mean_Curv_lbdv_pts[0,0] + self.Mean_Curv_lbdv_pts[1,0])/2.    
Avg_H_lbdv_Y_axis = (self.Mean_Curv_lbdv_pts[2,0] + self.Mean_Curv_lbdv_pts[3,0])/2.                            
Avg_H_lbdv_Z_axis = (self.Mean_Curv_lbdv_pts[4,0] + self.Mean_Curv_lbdv_pts[5,0])/2.

self.Anis_Stress_Drop_Ellips_e1_e3_Axes = self.TwoGammaVal*np.sum(np.multiply(self.Maj_Min_Axis, np.array([ Avg_H_lbdv_X_axis, Avg_H_lbdv_Y_axis, Avg_H_lbdv_Z_axis ])))

whereas self.Mean_Curv_lbdv_pts should be the curvature at every quadrature point, self.Maj_Min_Axis is of form [1, -1, -1] if the first axis is the major axis of the ellipsoid.

Now...what exactly is the significance of particularly the first 6 curvature values (i.e., Mean_Curv_lbdv_pts[0:5]) among all the curvatures? According to the paper this should probably reflect this section:

Capture

Thanks in advance for your help!

GrossBJ commented 2 years ago

Hi Johannes, To be honest I'm not sure, since a lot of things I wrote were based on specific comments someone in the lab may have made (even in passing). I would probably need to see how it was used in the main file to guess why I did that.  Thanks,Ben

Sent from Yahoo Mail on Android

On Thu, Aug 25, 2022 at 17:39, Johannes @.***> wrote:

@GrossBJ how's it going? I'd have a minor question about something related to the stress code (rather minor) I can't quite wrap my head around: In the originial stress code (here), the maximal tissue stress anisotropy is calculated as follows:

Calculate 2\gamma*(H_3 - H_1), mirroring Ellipsoid max stress anisotropy:

Avg_H_lbdv_X_axis = (self.Mean_Curv_lbdv_pts[0,0] + self.Mean_Curv_lbdv_pts[1,0])/2.
Avg_H_lbdv_Y_axis = (self.Mean_Curv_lbdv_pts[2,0] + self.Mean_Curv_lbdv_pts[3,0])/2.
Avg_H_lbdv_Z_axis = (self.Mean_Curv_lbdv_pts[4,0] + self.Mean_Curv_lbdv_pts[5,0])/2.

self.Anis_Stress_Drop_Ellips_e1_e3_Axes = self.TwoGammaVal*np.sum(np.multiply(self.Maj_Min_Axis, np.array([ Avg_H_lbdv_X_axis, Avg_H_lbdv_Y_axis, Avg_H_lbdv_Z_axis ]))) whereas self.Mean_Curv_lbdv_pts should be the curvature at every quadrature point, self.Maj_Min_Axis is of form [1, -1, -1] if the first axis is the major axis of the ellipsoid.

Now...what exactly is the significance of particularly the first 6 curvature values (i.e., Mean_Curv_lbdv_pts[0:5]) among all the curvatures? According to the paper this should probably reflect this section:

Thanks in advance for your help!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

jo-mueller commented 2 years ago

Hi @GrossBJ , sorry, I forgot to put the link to the location in the original code

GrossBJ commented 2 years ago

Ah now I see, thanks! Because the ellipsoidal coordinates are always along the major x, y, z axes we can use the fact that the first 6 lebedev points are along each of these axes to immediately get the mean curvatures there. Anotherwards we don't need to do any interpolation because the points we are interested in are perfectly aligned with the axes. Hope this helps!-Ben

Sent from Yahoo Mail on Android

On Fri, Aug 26, 2022 at 11:33, Johannes @.***> wrote:

Hi @GrossBJ , sorry, I forgot to put the link to the location in the original code

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

jo-mueller commented 2 years ago

we can use the fact that the first 6 lebedev points are along each of these axes

Ok cool, that wasn't quite evident from the code :) I implemented this measurement by using the formula for the mean curvature on the ellipsoid on the points that are at the tips of the major axes of the ellipsoid, which should be equivalent, right?

GrossBJ commented 2 years ago

Yep! For an ellipsoid it is very simple to calculate! It should give the same answer, but there are many different ways of writing it.

Sent from Yahoo Mail on Android

On Fri, Sep 2, 2022 at 15:47, Johannes @.***> wrote:

we can use the fact that the first 6 lebedev points are along each of these axes

Ok cool, that wasn't quite evident from the code :) I implemented this measurement by using the formula for the mean curvature on the ellipsoid on the points that are at the tips of the major axes of the ellipsoid, which should be equivalent, right?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

jo-mueller commented 2 years ago

Awesome @GrossBJ , I'll close this then 💯