amaazetools 0.1.7__tar.gz → 0.1.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {amaazetools-0.1.7/amaazetools.egg-info → amaazetools-0.1.9}/PKG-INFO +1 -1
- {amaazetools-0.1.7 → amaazetools-0.1.9}/amaazetools/trimesh.py +17 -5
- {amaazetools-0.1.7 → amaazetools-0.1.9/amaazetools.egg-info}/PKG-INFO +1 -1
- {amaazetools-0.1.7 → amaazetools-0.1.9}/pyproject.toml +1 -1
- {amaazetools-0.1.7 → amaazetools-0.1.9}/LICENSE +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/MANIFEST.in +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/README.md +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/amaazetools/__init__.py +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/amaazetools/dicom.py +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/amaazetools/edge_detection.py +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/amaazetools/mesh_segmentation.py +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/amaazetools/svi.py +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/amaazetools.egg-info/SOURCES.txt +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/amaazetools.egg-info/dependency_links.txt +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/amaazetools.egg-info/requires.txt +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/amaazetools.egg-info/top_level.txt +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/setup.cfg +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/setup.py +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/src/cextensions.c +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/src/memory_allocation.c +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/src/memory_allocation.h +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/src/mesh_operations.c +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/src/mesh_operations.h +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/src/svi_computations.c +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/src/svi_computations.h +0 -0
- {amaazetools-0.1.7 → amaazetools-0.1.9}/src/vector_operations.h +0 -0
|
@@ -43,14 +43,22 @@ def marching_cubes(volume,level=None,spacing=(1,1,1)):
|
|
|
43
43
|
points of triangulation
|
|
44
44
|
t : (m,3) int
|
|
45
45
|
triangles of triangulation
|
|
46
|
+
n : (n,3) float
|
|
47
|
+
vertex normals of triangulated surface
|
|
48
|
+
val : (n) float
|
|
49
|
+
isosurface values
|
|
46
50
|
"""
|
|
47
51
|
|
|
48
|
-
p,t,n,val = measure.marching_cubes(volume,level=level,spacing=spacing)
|
|
52
|
+
p,t,n,val = measure.marching_cubes(volume,level=level,spacing=spacing,allow_degenerate=False)
|
|
49
53
|
|
|
50
54
|
#sometimes marching cubes produces... artifacts... so here's a very basic intro to mesh cleaning!
|
|
51
55
|
#first: eliminate repeated points:
|
|
56
|
+
'''
|
|
52
57
|
p,index,inv = np.unique(p,axis=0, return_index=True,return_inverse=True)
|
|
53
58
|
|
|
59
|
+
n = n[index,:]
|
|
60
|
+
val = val[index]
|
|
61
|
+
|
|
54
62
|
#next: rid triangulation of non-triangles:
|
|
55
63
|
t = inv[t]
|
|
56
64
|
badt = (t[:,0]==t[:,1])+(t[:,1]==t[:,2])+(t[:,2]==t[:,0])
|
|
@@ -60,9 +68,13 @@ def marching_cubes(volume,level=None,spacing=(1,1,1)):
|
|
|
60
68
|
ind = -1*np.ones(p.shape[0],int)
|
|
61
69
|
uni = np.unique(t.flatten()) #these are already sorted for numpy
|
|
62
70
|
ind[uni] = np.arange(uni.shape[0])
|
|
63
|
-
p = p[ind>-1,:]
|
|
64
|
-
t = ind[t]
|
|
65
71
|
|
|
72
|
+
L = ind>-1
|
|
73
|
+
p = p[L,:]
|
|
74
|
+
n = n[L,:]
|
|
75
|
+
val = val[L]
|
|
76
|
+
t = ind[t]
|
|
77
|
+
'''
|
|
66
78
|
#finally, check right hand rule... this works for ~convex objects, anyway...
|
|
67
79
|
#m = tm.mesh(p,t)
|
|
68
80
|
|
|
@@ -72,7 +84,7 @@ def marching_cubes(volume,level=None,spacing=(1,1,1)):
|
|
|
72
84
|
#cent = m.points.mean(0)
|
|
73
85
|
#fliporder = np.sum(tn*(tc-cent),1)<0
|
|
74
86
|
#t[fliporder,1:3] = t[fliporder,2:0:-1]
|
|
75
|
-
return p,t
|
|
87
|
+
return p,t,n,val
|
|
76
88
|
|
|
77
89
|
def withiness(x):
|
|
78
90
|
""" Computes withiness (how well 1-D data clusters into two groups).
|
|
@@ -582,7 +594,7 @@ class mesh:
|
|
|
582
594
|
newtri = newtri[ np.sum(newtri<0,1) ==0, :]
|
|
583
595
|
|
|
584
596
|
newpts = pts[pt_ind2keep,:]
|
|
585
|
-
return newpts, newtri
|
|
597
|
+
return mesh(newpts, newtri)
|
|
586
598
|
|
|
587
599
|
#Returns unit normal vectors to vertices (averaging adjacent faces and normalizing)
|
|
588
600
|
def vertex_normals(self):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|