Skip to content

Commit

Permalink
Changed the way the midpoint is calculated from center of mass to cen…
Browse files Browse the repository at this point in the history
…ter of bounding box
  • Loading branch information
IgorTatarnikov committed Aug 14, 2024
1 parent 9cd07c8 commit 1537b8e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions brainrender/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,11 @@ def add_brain_region(

# slice to keep only one hemisphere
if hemisphere == "right":
plane = self.atlas.get_plane(
pos=self.root._mesh.center_of_mass(), norm=(0, 0, 1)
)
mesh_center = self.root._mesh.bounds().reshape((3, 2)).mean(axis=1)
plane = self.atlas.get_plane(pos=mesh_center, norm=(0, 0, 1))
elif hemisphere == "left":
plane = self.atlas.get_plane(
pos=self.root._mesh.center_of_mass(), norm=(0, 0, -1)
)
mesh_center = self.root._mesh.bounds().reshape((3, 2)).mean(axis=1)
plane = self.atlas.get_plane(pos=mesh_center, norm=(0, 0, -1))

if hemisphere in ("left", "right"):
if not isinstance(actors, list):
Expand Down

0 comments on commit 1537b8e

Please sign in to comment.