Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused camera printing code and make camera parameters consistent #365

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Loading