Skip to content

Commit dccaa1a

Browse files
committed
Add neuron.obj blender file
1 parent 9467283 commit dccaa1a

4 files changed

Lines changed: 2683294 additions & 174 deletions

File tree

.github/workflows/non_omv.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,5 @@ jobs:
2525
- name: Run Python scripts
2626
run: |
2727
echo "Running non OMV tests..."
28-
cd Python
2928
pip install -r requirements.txt
3029
./test.sh

app.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from neuromlmodel import add_neuroml_model # noqa: F401
22
from siberneticmodel import add_sibernetic_model # noqa: F401
33
from virtualworm import add_virtualworm_muscles # noqa: F401
4+
from virtualworm import add_virtualworm_neurons # noqa: F401
45

56
import pyvista as pv
67
import sys
@@ -37,12 +38,16 @@
3738

3839
plotter = pv.Plotter()
3940

40-
add_neuroml_model(plotter, somas_only=True)
41-
add_sibernetic_model(plotter)
41+
4242
add_virtualworm_muscles(plotter)
43+
# add_virtualworm_neurons(plotter)
44+
add_neuroml_model(plotter, "NeuroML2/c302_D_Full.net.nml", somas_only=True)
45+
add_sibernetic_model(plotter)
4346

4447

4548
plotter.set_viewup([0, 10, 0])
49+
# plotter.remove_scalar_bar("RegionId")
50+
# plotter.remove_scalar_bar("types")
4651

4752

4853
print("Created the scene...")

load.py

Lines changed: 15 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -1,181 +1,25 @@
11
import pyvista as pv
2-
32
import sys
43

5-
6-
'''
7-
8-
points = []
9-
10-
types = []
11-
12-
file = "pressure_buffer.txt"
13-
file = "position_buffer.txt"
14-
if len(sys.argv) == 2:
15-
file = sys.argv[1]
16-
17-
colours = {1.1: "lightblue", 2.1: "green", 2.2: "turquoise", 3: "#eeeeee"}
18-
colours = {1.1: "blue", 2.2: "turquoise"}
19-
20-
line_count = 0
21-
pcount = 0
22-
23-
all_points = []
24-
all_point_types = []
25-
26-
time_count = 0
27-
28-
logStep = None
29-
30-
include_boundary = False
31-
32-
for line in open(file):
33-
ws = line.split()
34-
# print(ws)
35-
if line_count == 6:
36-
numOfElasticP = int(ws[0])
37-
if line_count == 7:
38-
numOfLiquidP = int(ws[0])
39-
if line_count == 8:
40-
numOfBoundaryP = int(ws[0])
41-
if line_count == 9:
42-
timeStep = float(ws[0])
43-
if line_count == 10:
44-
logStep = int(ws[0])
45-
46-
if len(ws) == 4:
47-
type = float(ws[3])
48-
49-
if not (type == 3 and not include_boundary):
50-
points.append([float(ws[0]), float(ws[1]), float(ws[2])])
51-
types.append(type)
52-
53-
if logStep is not None:
54-
pcount += 1
55-
56-
if pcount == numOfBoundaryP + numOfElasticP + numOfLiquidP:
57-
print(
58-
"End of one batch of %i added, %i total points at line %i, time: %i"
59-
% (len(points), pcount, line_count, time_count)
60-
)
61-
all_points.append(points)
62-
all_point_types.append(types)
63-
64-
points = []
65-
types = []
66-
pcount = 0
67-
numOfBoundaryP = 0
68-
69-
time_count += 1
70-
71-
line_count += 1
72-
73-
# all_points_np = np.array(all_points)
74-
75-
print(
76-
"Loaded positions with %i elastic, %i liquid and %i boundary points (%i total), %i lines"
77-
% (
78-
numOfElasticP,
79-
numOfLiquidP,
80-
numOfBoundaryP,
81-
numOfElasticP + numOfLiquidP + numOfBoundaryP,
82-
line_count,
83-
)
84-
)
85-
86-
print("Num of time points found: %i" % len(all_points))
87-
88-
pl.set_background("lightgrey")
89-
90-
last_mesh = None
91-
92-
93-
import time
94-
95-
def create_mesh(step):
96-
step_count = step
97-
value = step_count
98-
global last_mesh
99-
index = int(value)
100-
101-
print("Changing to time point: %s (%s) " % (index, value))
102-
curr_points = all_points[index]
103-
curr_types = all_point_types[index]
104-
if last_mesh is None:
105-
last_mesh = pv.PolyData(curr_points)
106-
last_mesh["types"] = curr_types
107-
last_mesh.translate((0, -1000, 0), inplace=True)
108-
print(last_mesh)
109-
110-
# last_actor =
111-
pl.add_mesh(
112-
last_mesh,
113-
render_points_as_spheres=True,
114-
cmap=[c for c in colours.values()],
115-
point_size=3,
116-
)
117-
else:
118-
last_mesh.points = curr_points
119-
last_mesh.translate((0, -00, -100), inplace=True)
120-
121-
pl.render()
122-
123-
time.sleep(0.1)
124-
125-
return
126-
127-
128-
create_mesh(0)
129-
130-
max_time = len(all_points) - 1
131-
pl.add_slider_widget(create_mesh, rng=[0, max_time], value=max_time, title="Time point")
132-
pl.add_timer_event(max_steps=5, duration=2, callback=create_mesh)
133-
134-
135-
mesh = pv.read("bwm.obj")
136-
mesh.scale(20, inplace=True)
137-
mesh.translate((-40, 0, 0), inplace=True)
138-
139-
pl.add_mesh(mesh, smooth_shading=True, color="green")
140-
141-
mesh2 = pv.read("neurons.obj")
142-
mesh2.scale(20, inplace=True)
143-
mesh2.translate((-80, 0, 0), inplace=True)
144-
145-
pl.add_mesh(mesh2, smooth_shading=True, color="orange")
146-
"""
147-
conn = mesh2.connectivity('all')
148-
print(conn)
149-
# Format scalar bar text for integer values.
150-
scalar_bar_args = dict(
151-
fmt='%.f',
152-
)
153-
154-
cpos = [(10.5, 12.2, 18.3), (0.0, 0.0, 0.0), (0.0, 1.0, 0.0)]
155-
156-
conn.plot(
157-
categories=True,
158-
cmap='jet',
159-
scalar_bar_args=scalar_bar_args,
160-
cpos=cpos,
161-
)"""
162-
163-
'''
164-
4+
from virtualworm import add_virtualworm_muscles
5+
from virtualworm import add_virtualworm_neurons
6+
from neuromlmodel import add_neuroml_model
7+
from siberneticmodel import add_sibernetic_model
1658

1669
if __name__ == "__main__":
167-
pl = pv.Plotter()
10+
plotter = pv.Plotter()
16811

169-
from virtualworm import add_virtualworm_muscles
170-
from neuromlmodel import add_neuroml_model
171-
from siberneticmodel import add_sibernetic_model
12+
add_virtualworm_muscles(plotter)
13+
add_virtualworm_neurons(plotter)
14+
add_neuroml_model(plotter, "NeuroML2/c302_D_Full.net.nml", somas_only=False)
15+
add_sibernetic_model(plotter)
17216

173-
add_virtualworm_muscles(pl)
174-
add_neuroml_model(pl, somas_only=True)
175-
add_sibernetic_model(pl)
17+
plotter.set_background("white")
18+
plotter.set_viewup([0, 10, 0])
17619

177-
pl.set_background("white")
178-
pl.add_axes()
20+
plotter.add_axes()
21+
plotter.remove_scalar_bar("RegionId")
22+
plotter.remove_scalar_bar("types")
17923

18024
if "-nogui" not in sys.argv:
181-
pl.show()
25+
plotter.show()

0 commit comments

Comments
 (0)