Spaces:
Runtime error
Runtime error
Upload 4 files
Browse files- .gitattributes +1 -0
- app.py +33 -16
- dental-labels4.json +0 -0
- file.obj +3 -0
- requirements.txt +1 -4
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
file.obj filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -1,17 +1,34 @@
|
|
1 |
-
import
|
2 |
-
import
|
3 |
-
import
|
4 |
-
from pyvista import examples
|
5 |
-
pyvista.start_xvfb()
|
6 |
-
mesh = examples.load_uniform()
|
7 |
-
pl = pyvista.Plotter(shape=(1,2))
|
8 |
-
_ = pl.add_mesh(mesh, scalars='Spatial Point Data', show_edges=True)
|
9 |
-
pl.subplot(0,1)
|
10 |
-
_ = pl.add_mesh(mesh, scalars='Spatial Cell Data', show_edges=True)
|
11 |
-
pl.export_html('pyvista.html') # doctest:+SKIP
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pyvista as pv
|
2 |
+
import json
|
3 |
+
from stpyvista import stpyvista
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
# Load the .obj file
|
6 |
+
mesh = pv.read('file.obj')
|
7 |
+
|
8 |
+
# Load the JSON file
|
9 |
+
with open('output/dental-labels4.json', 'r') as file:
|
10 |
+
labels_data = json.load(file)
|
11 |
+
|
12 |
+
# Assuming labels_data['labels'] is a list of labels
|
13 |
+
labels = labels_data['labels']
|
14 |
+
|
15 |
+
# Make sure the number of labels matches the number of vertices or faces
|
16 |
+
assert len(labels) == mesh.n_points or len(labels) == mesh.n_cells
|
17 |
+
|
18 |
+
# If labels correspond to vertices
|
19 |
+
if len(labels) == mesh.n_points:
|
20 |
+
mesh.point_data['Labels'] = labels
|
21 |
+
# If labels correspond to faces
|
22 |
+
elif len(labels) == mesh.n_cells:
|
23 |
+
mesh.cell_data['Labels'] = labels
|
24 |
+
|
25 |
+
# Create a pyvista plotter
|
26 |
+
plotter = pv.Plotter()
|
27 |
+
|
28 |
+
# Add the mesh to the plotter with labels as a scalar field
|
29 |
+
plotter.add_mesh(mesh, scalars='Labels', show_scalar_bar=True, cmap='jet')
|
30 |
+
|
31 |
+
# Show the plot
|
32 |
+
#plotter.show()
|
33 |
+
## Send to streamlit
|
34 |
+
stpyvista(plotter)
|
dental-labels4.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
file.obj
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:581b9a026e2ce734f6335f34aa900e8114dc33e2a83541ebd6bb26536382545e
|
3 |
+
size 18769177
|
requirements.txt
CHANGED
@@ -1,7 +1,4 @@
|
|
1 |
streamlit
|
2 |
pyvista
|
3 |
pythreejs
|
4 |
-
|
5 |
-
trame==3.3.0
|
6 |
-
trame-vuetify
|
7 |
-
nest_asyncio
|
|
|
1 |
streamlit
|
2 |
pyvista
|
3 |
pythreejs
|
4 |
+
stpyvista==0.0.11
|
|
|
|
|
|