def area_normalize(points, faces, spectrum): """ Normalize a spectrum using areas as suggested in Reuter et al. (2006) Parameters ------------ points : list of lists of 3 floats x,y,z coordinates for each vertex of the structure faces : list of lists of 3 integers 3 indices to vertices that form a triangle on the mesh spectrum : list of floats LB spectrum of a given shape defined by _points_ and _faces_ Returns ----------- new_spectrum : list of floats LB spectrum normalized by area """ from mindboggle.guts.mesh import area_of_faces area = area_of_faces(points, faces) total_area = sum(area) new_spectrum = [x/total_area for x in spectrum] return new_spectrum
def area_normalize(points, faces, spectrum): """ Normalize a spectrum using areas as suggested in Reuter et al. (2006) Parameters ------------ points : list of lists of 3 floats x,y,z coordinates for each vertex of the structure faces : list of lists of 3 integers 3 indices to vertices that form a triangle on the mesh spectrum : list of floats LB spectrum of a given shape defined by _points_ and _faces_ Returns ----------- new_spectrum : list of floats LB spectrum normalized by area """ from mindboggle.guts.mesh import area_of_faces area = area_of_faces(points, faces) total_area = sum(area) new_spectrum = [x / total_area for x in spectrum] return new_spectrum
def area_normalize(points, faces, spectrum): """ Normalize a spectrum using areas as suggested in Reuter et al. (2006) Parameters ---------- points : list of lists of 3 floats x,y,z coordinates for each vertex of the structure faces : list of lists of 3 integers 3 indices to vertices that form a triangle on the mesh spectrum : list of floats LB spectrum of a given shape defined by _points_ and _faces_ Returns ------- new_spectrum : list of floats LB spectrum normalized by area Examples -------- >>> import numpy as np >>> from mindboggle.shapes.laplace_beltrami import area_normalize >>> from mindboggle.shapes.laplace_beltrami import fem_laplacian >>> # Define a cube: >>> points = [[0,0,0], [0,1,0], [1,1,0], [1,0,0], ... [0,0,1], [0,1,1], [1,1,1], [1,0,1]] >>> faces = [[0,1,2], [2,3,0], [4,5,6], [6,7,4], [0,4,7], [7,3,0], ... [0,4,5], [5,1,0], [1,5,6], [6,2,1], [3,7,6], [6,2,3]] >>> spectrum = fem_laplacian(points, faces, spectrum_size=3, ... normalization=None) >>> print(np.array_str(np.array(spectrum[1::]), ... precision=5, suppress_small=True)) [ 4.58359 4.8 ] >>> new_spectrum = area_normalize(points, faces, spectrum) >>> print(np.array_str(np.array(new_spectrum[1::]), ... precision=5, suppress_small=True)) [ 27.50155 28.8 ] """ from mindboggle.guts.mesh import area_of_faces area = area_of_faces(points, faces) total_area = sum(area) new_spectrum = [x*total_area for x in spectrum] return new_spectrum
def area_normalize(points, faces, spectrum): """ Normalize a spectrum using areas as suggested in Reuter et al. (2006) Parameters ---------- points : list of lists of 3 floats x,y,z coordinates for each vertex of the structure faces : list of lists of 3 integers 3 indices to vertices that form a triangle on the mesh spectrum : list of floats LB spectrum of a given shape defined by _points_ and _faces_ Returns ------- new_spectrum : list of floats LB spectrum normalized by area Examples -------- >>> import numpy as np >>> from mindboggle.shapes.laplace_beltrami import area_normalize >>> from mindboggle.shapes.laplace_beltrami import fem_laplacian >>> # Define a cube: >>> points = [[0,0,0], [0,1,0], [1,1,0], [1,0,0], ... [0,0,1], [0,1,1], [1,1,1], [1,0,1]] >>> faces = [[0,1,2], [2,3,0], [4,5,6], [6,7,4], [0,4,7], [7,3,0], ... [0,4,5], [5,1,0], [1,5,6], [6,2,1], [3,7,6], [6,2,3]] >>> spectrum = fem_laplacian(points, faces, spectrum_size=3, ... normalization=None) >>> print(np.array_str(np.array(spectrum[1::]), ... precision=5, suppress_small=True)) [ 4.58359 4.8 ] >>> new_spectrum = area_normalize(points, faces, spectrum) >>> print(np.array_str(np.array(new_spectrum[1::]), ... precision=5, suppress_small=True)) [ 27.50155 28.8 ] """ from mindboggle.guts.mesh import area_of_faces area = area_of_faces(points, faces) total_area = sum(area) new_spectrum = [x * total_area for x in spectrum] return new_spectrum