Skip to content

Commit 756680f

Browse files
author
Carlo Castoldi
committed
Fix slicer pre-transforming the planes' center
* this created problems when adding a plane mesh into a scene * additionally it adds the parameter 'both' to plan.show()
1 parent aa723a8 commit 756680f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

brainglobe_heatmap/planner.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __init__(
7575
print_plane("Plane 0", self.slicer.plane0, blue_dark)
7676
print_plane("Plane 1", self.slicer.plane1, pink_dark)
7777

78-
def show(self):
78+
def show(self, both=True):
7979
"""
8080
Renders the hetamap visualization as a 3D scene in brainrender.
8181
"""
@@ -88,15 +88,19 @@ def show(self):
8888

8989
# add slicing planes and their norms
9090
for plane, color, alpha in zip(
91-
(self.slicer.plane0, self.slicer.plane1),
91+
(
92+
(self.slicer.plane0, self.slicer.plane1)
93+
if both
94+
else (self.slicer.plane0,)
95+
),
9296
(blue_dark, pink_dark),
9397
(0.8, 0.3),
9498
strict=False,
9599
):
96100
plane_mesh = plane.to_mesh(self.scene.root)
97101
plane_mesh.alpha(alpha).color(color)
98102

99-
self.scene.add(plane_mesh, transform=False)
103+
self.scene.add(plane_mesh)
100104
for vector, v_color in zip(
101105
(plane.normal, plane.u, plane.v),
102106
(color, red_dark, green_dark),
@@ -109,12 +113,12 @@ def show(self):
109113
+ np.array(vector) * self.arrow_scale,
110114
c=v_color,
111115
),
112-
transform=False,
116+
classes=plane_mesh.br_class,
113117
)
114118

115119
self.scene.add(
116120
Sphere(plane_mesh.center, r=plane_mesh.width / 125, c="k"),
117-
transform=False,
121+
classes=plane_mesh.br_class,
118122
)
119123

120124
self.scene.render(interactive=self.interactive, zoom=self.zoom)

brainglobe_heatmap/slicer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def __init__(
5151
)
5252

5353
position = np.array(position)
54-
position[2] = -position[2]
5554

5655
if isinstance(orientation, str):
5756
axidx = get_ax_idx(orientation)

0 commit comments

Comments
 (0)