|
6 | 6 | NEURONS_OBJ_FILE = "neurons.obj" |
7 | 7 |
|
8 | 8 |
|
9 | | -def add_virtualworm_muscles(plotter): |
| 9 | +def add_virtualworm_muscles(plotter, scale=20, translate=(-40, 0, 0)): |
10 | 10 | print("Adding virtual worm file %s..." % BODY_WALL_MUSCLE_OBJ_FILE) |
11 | 11 | mesh = pv.read(BODY_WALL_MUSCLE_OBJ_FILE) |
12 | | - mesh.scale(20, inplace=True) |
13 | | - mesh.translate((-40, 0, 0), inplace=True) |
14 | 12 |
|
15 | | - plotter.add_mesh(mesh, smooth_shading=True, color="green") |
| 13 | + mesh.scale(scale, inplace=True) |
| 14 | + mesh.translate((translate), inplace=True) |
16 | 15 |
|
| 16 | + conn = mesh.connectivity("all") |
17 | 17 |
|
18 | | -def add_virtualworm_neurons(plotter): |
19 | | - print("Adding virtual worm file %s..." % NEURONS_OBJ_FILE) |
20 | | - mesh2 = pv.read(NEURONS_OBJ_FILE) |
21 | | - mesh2.scale(20, inplace=True) |
22 | | - mesh2.translate((-80, 0, 0), inplace=True) |
| 18 | + plotter.add_mesh(conn, smooth_shading=True, color="green") |
23 | 19 |
|
24 | | - plotter.add_mesh(mesh2, smooth_shading=True, color="orange") |
25 | 20 |
|
26 | | - """ |
27 | | - conn = mesh.connectivity('all') |
28 | | - print(conn) |
29 | | - # Format scalar bar text for integer values. |
30 | | - scalar_bar_args = dict( |
31 | | - fmt='%.f', |
| 21 | +def add_virtualworm_neurons(plotter, scale=20, translate=(-80, 0, 0)): |
| 22 | + print("Adding virtual worm file %s..." % NEURONS_OBJ_FILE) |
| 23 | + mesh2 = pv.read(NEURONS_OBJ_FILE) |
| 24 | + mesh2.scale(scale, inplace=True) |
| 25 | + mesh2.translate(translate, inplace=True) |
| 26 | + |
| 27 | + # plotter.add_mesh(mesh2, smooth_shading=True, color="orange") |
| 28 | + conn = mesh2.connectivity("all") |
| 29 | + plotter.add_mesh( |
| 30 | + conn, |
| 31 | + smooth_shading=True, |
| 32 | + cmap="jet", |
32 | 33 | ) |
33 | 34 |
|
34 | | - cpos = [(10.5, 12.2, 18.3), (0.0, 0.0, 0.0), (0.0, 1.0, 0.0)] |
35 | | -
|
36 | | - |
37 | | - conn.plot( |
38 | | - categories=True, |
39 | | - cmap='jet', |
40 | | - scalar_bar_args=scalar_bar_args, |
41 | | - cpos=cpos, |
42 | | - )""" |
43 | | - |
44 | 35 |
|
45 | 36 | if __name__ == "__main__": |
46 | 37 | pl = pv.Plotter() |
47 | 38 |
|
48 | 39 | add_virtualworm_muscles(pl) |
| 40 | + add_virtualworm_neurons(pl) |
49 | 41 |
|
50 | 42 | pl.set_background("white") |
51 | 43 | pl.add_axes() |
|
0 commit comments