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

[BUG] Camera settings not applied when rendering scene #360

Closed
heike-s opened this issue May 29, 2024 · 1 comment · Fixed by #364
Closed

[BUG] Camera settings not applied when rendering scene #360

heike-s opened this issue May 29, 2024 · 1 comment · Fixed by #364
Assignees
Labels
bug Something isn't working

Comments

@heike-s
Copy link

heike-s commented May 29, 2024

Describe the bug
I want to create screenshots using consistent camera settings. I have a number of sets of points I would like to plot onto the mouse Nucleus Accumbens, and to make the images comparable would like to use the same camera settings to take a screenshot for each point set.

I use Shift-C to display the camera settings after adjusting to the angle that I would like to use. I then close the window, set the camera, and render the scene again. However, the brain is not displayed in the angle and orientation that I previously set up, and when checking the coordinates again using Shift-C, it returns coordinates that do not correspond to those that I set up, specifically pos, focal_point, viewup and clipping_range.

To Reproduce
`import brainrender as br
import vedo, os
vedo.settings.default_backend= 'vtk'

br.settings.SHOW_AXES = False
br.settings.ROOT_ALPHA = 0

popup_scene = br.Scene(atlas_name='allen_mouse_50um', title='Cluster 0')

front_camera = dict(
pos=(-25916.9, 6755.20, 8425.36),
focal_point=(6754.35, 5532.25, -5444.33),
viewup=(4.47401e-3, -0.995148, 0.0982831),
roll=174.709,
distance=35514.4,
clipping_range=(18770.4, 56677.3),
)

popup_scene.add_brain_region('ACB', alpha = 0.1, color = 'grey')
popup_scene.render(camera = front_camera, zoom = 5) `

Returned coordinates from Shift-C:
###################################################

Template python code to position this camera:

cam = dict(
position=(-26114.1, 5270.48, 8090.03),
focal_point=(6587.84, 3849.09, -5688.16),
viewup=(-8.83828e-4, -0.994932, 0.100542),
roll=174.703,
distance=35514.4,
clipping_range=(18744.5, 56710.0),
)
show(mymeshes, camera=cam)
###################################################

Expected behaviour
The camera settings in the camera dictionary should be applied when rendering the scene.

Screenshots
Expected plot:
Screenshot 2024-05-29 at 4 20 29 PM

Plot received:
Screenshot 2024-05-29 at 4 20 10 PM

Computer used:

  • OS: macOS, M3Pro
  • Version 14.2.1
  • Hardware specs 18GB RAM

Additional context
I have set the following settings at the beginning of my script:
br.settings.SHOW_AXES = False
br.settings.ROOT_ALPHA = 0
The behavior persists even when not setting these variables. I also tried plotting a single hemisphere, and the behavior persists. It also persists whether I add my points or not, so for simplicity I shared the code without adding the points / points density. It also happens whether or not I use a notebook.

@heike-s heike-s added the bug Something isn't working label May 29, 2024
IgorTatarnikov added a commit that referenced this issue Jun 5, 2024
adamltyson pushed a commit that referenced this issue Jun 6, 2024
* Fixed bug in #360

* Remove unused variable name
@adamltyson
Copy link
Member

Thanks for reporting this @heike-s. It should now be fixed. You can install from github with pip install git+https://github.com/brainglobe/brainrender, but a new version of brainrender should be released with this fix by the end of the week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants