Skip to content

Commit

Permalink
fix some vedo function calls still using lowerCamelCase instead of sn…
Browse files Browse the repository at this point in the history
…ake_case
  • Loading branch information
carlocastoldi committed Dec 20, 2023
1 parent f7d8727 commit 378bb70
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions brainglobe_heatmap/heatmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

# Set settings for transparent background
# vedo for transparent bg
# settings.vsettings.screenshotTransparentBackground = True
# settings.vsettings.screenshot_transparent_background = True

# This needs to be false for transparent bg
# settings.vsettings.useFXAA = False
# settings.vsettings.use_fxaa = False


def check_values(values: dict, atlas: Atlas) -> Tuple[float, float]:
Expand Down Expand Up @@ -157,7 +157,7 @@ def render(self, **kwargs) -> Scene:
camera = self.orientation
else:
self.orientation = np.array(self.orientation)
com = self.slicer.plane0.centerOfMass()
com = self.slicer.plane0.center_of_mass()
camera = {
"pos": com - self.orientation * 2 * np.linalg.norm(com),
"viewup": (0, -1, 0),
Expand Down
10 changes: 5 additions & 5 deletions brainglobe_heatmap/plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ def to_mesh(self, actor: Actor):
plane_mesh.width = length
return plane_mesh

def centerOfMass(self):
def center_of_mass(self):
return self.center

def P3toP2(self, ps):
def p3_to_p2(self, ps):
# ps is a list of 3D points
# returns a list of 2D point mapped on
# the plane (u -> x axis, v -> y axis)
return (ps - self.center) @ self.M

def intersectWith(self, mesh: vd.Mesh):
def intersect_with(self, mesh: vd.Mesh):
return mesh.intersect_with_plane(
origin=self.center, normal=self.normal
)
Expand All @@ -69,14 +69,14 @@ def get_projections(self, actors: List[Actor]) -> Dict[str, np.ndarray]:
projected = {}
for actor in actors:
mesh: vd.Mesh = actor._mesh
intersection = self.intersectWith(mesh)
intersection = self.intersect_with(mesh)
if not intersection.vertices.shape[0]:
continue
pieces = intersection.split() # intersection.split() in newer vedo
for piece_n, piece in enumerate(pieces):
# sort coordinates
points = piece.join(reset=True).vertices
projected[actor.name + f"_segment_{piece_n}"] = self.P3toP2(
projected[actor.name + f"_segment_{piece_n}"] = self.p3_to_p2(
points
)
return projected
4 changes: 2 additions & 2 deletions brainglobe_heatmap/slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(
3D vector) + thickness (spacing between the two planes)
"""
if position is None:
position = root.centerOfMass()
position = root.center_of_mass()

if isinstance(position, (float, int)):
if isinstance(orientation, str):
Expand Down Expand Up @@ -122,7 +122,7 @@ def show_plane_intersection(
to the brainrender scene.
"""
for region in regions + [root]:
intersection = self.plane0.intersectWith(region._mesh)
intersection = self.plane0.intersect_with(region._mesh)

if len(intersection.vertices):
scene.add(intersection, transform=False)
Expand Down

0 comments on commit 378bb70

Please sign in to comment.