I am trying to determine the surface area of a 3D volume by using pyqtgraph and numpy using isosurfaces in Python . The problem is not in the generation of isosurface, but in calculating the field from the vector.
If properly understood, the cross product of 2 vectors (AXB) defines the area of parallologlog in the magnitude of the product. Similarly, the determinant of a 3x3 matrix, where the first line unit vectors determines the area of paralaglogram of the vectors determined by the second 2 rows.
I am using the code given below, but I am getting different answers (though of the same magnitude)
np.linalg.norm (n, Ord = 1)
185088.05
triarea = (np.abs (np.linalg) .det (tryges)) Original = np.sum (triarea)
289059.69600568933 Anyone have any ideas on what's happening here?
The following is the full Python code I am using.
#import tiff file print ("Loading volume ...") Img = tifffile.imread (r "C: \ Users \ Nachiket \ Desktop \ C1-confocal-series." Tif ") print (print" expired ") (" Isis is generating isosfres ... ") verts, faces = pg.isosurface (Img, img.max () / 5.) Print (" full ") # vertical Creating an indexed array of tris = verts [faces] #calculate from the generic area n = np.cross (tris [::,, 1] - tris [:: ,, 0], tris [::, 2] - tris [::, 0]) narea = np.linalg.norm (n, ord = 1) trycc = np.zeros (tris .shape) using #ccalculate unit vectors tryges [::, 0] = ([[1 , 1,1]] #unit vectors tryges [::, 1] = (tris [::, 1] - tris [::, 0]) Tryges [::, 2] = (tris [::, 2] - Tris [::, 0]) triarea = np.abs (np.linalg.det (tryges)) tot = np.sum (np.abs (triarea))
P E> tryges [::, 0] = ([[1,1,1]] #unit vectors tryges [::, 1] = (tris [::,, 1] - tris [::, 0] Tryges [^, 2] = (tris [::, 2] - tris [::, 0])
type
tryges [0, ::] = ([[1,1,1]] #unit vectors [1, ::] = (tris [1, ::] - tris [0, ::]) tryges [2, :: ] = (Tris [2, ::] - tris [0, ::]) To define this field, for determiners, the definition of the vector with the line Committee should Matrix but you are specifying the vector arm in the columns of the matrix