Skip to content

Commit

Permalink
Merge pull request #365 from brainglobe/camera-dict
Browse files Browse the repository at this point in the history
Remove unused camera printing code and make camera parameters consistent
  • Loading branch information
alessandrofelder authored Jun 6, 2024
2 parents f7271bf + f91ba65 commit cfebff2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
3 changes: 1 addition & 2 deletions brainrender/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def check_camera_param(camera):
"""
Check that a dictionary of camera parameters
is complete. Must have entries:
["position", "focal", "viewup", "distance", "clipping"]
["pos", "viewup", "clipping_range"]
:param camera: str, dict
"""
Expand Down Expand Up @@ -106,6 +106,5 @@ def clean(val):
viewup=clean(cam.GetViewUp()),
distance=clean(cam.GetDistance()),
clipping_range=clean(cam.GetClippingRange()),
# orientation=clean(cam.GetOrientation()),
)
return params
27 changes: 1 addition & 26 deletions brainrender/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy as np
from loguru import logger
from myterial import amber, deep_purple_light, orange, teal
from myterial import teal
from rich import print
from rich.syntax import Syntax
from vedo import Plotter
Expand All @@ -15,7 +15,6 @@
from brainrender.camera import (
check_camera_param,
get_camera,
get_camera_params,
set_camera,
)

Expand Down Expand Up @@ -360,27 +359,6 @@ def screenshot(self, name=None, scale=None):
self.plotter.screenshot(filename=savepath, scale=scale)
return savepath

def _print_camera(self):
pms = get_camera_params(scene=self)

focal = pms.pop("focal_point", None)
dst = pms.pop("distance", None)

names = [
f"[green bold] '{k}'[/green bold]: [{amber}]{v},"
for k, v in pms.items()
]
print(
f"[{deep_purple_light}]Camera parameters:",
f"[{orange}] {{",
*names,
f"[{orange}] }}",
f"[{deep_purple_light}]Additional, (optional) parameters:",
f"[green bold] 'focal_point'[/green bold]: [{amber}]{focal},",
f"[green bold] 'distance'[/green bold]: [{amber}]{dst},",
sep="\n",
)

def keypress(self, key): # pragma: no cover
"""
Handles key presses for interactive view
Expand All @@ -393,6 +371,3 @@ def keypress(self, key): # pragma: no cover

elif key in ("q", "Esc"):
self.close()

elif key == "c":
self._print_camera()

0 comments on commit cfebff2

Please sign in to comment.