Skip to content

Minimal fix: set camera position#431

Merged
rugeli merged 2 commits intomainfrom
feature/simularium-camera-refactor
Nov 21, 2025
Merged

Minimal fix: set camera position#431
rugeli merged 2 commits intomainfrom
feature/simularium-camera-refactor

Conversation

@rugeli
Copy link
Copy Markdown
Collaborator

@rugeli rugeli commented Nov 13, 2025

Problem

we need to adjust the camera position for simularium results

Solution

  • updated camera_z_position in simularium_helper.py per Saurabh's suggestion

  • found similar camera position calculation in cellpack/bin/simularium_converter.py, updated that as well for consistency. The code can be DRYer long term

  • reverted the bounding_box value in examples/recipes/v2/spheres_in_a_box.json so spheres are packed within the full box as expected

  • revised display names and descriptions for editable fields (in firebase)

  • result updated in cellPACK Studio, verify the production site or see screenshot (in firebase)

this is the initial view of multiple sphere result, still close to the camera but better than before, and the bounding box is correct

Screenshot 2025-11-13 at 4 06 59 PM

with @mogres

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 13, 2025

Packing analysis report

Analysis for packing results located at cellpack/tests/outputs/test_spheres/spheresSST

Ingredient name Encapsulating radius Average number packed
ext_A 25 236.0

Packing image

Packing image

Distance analysis

Expected minimum distance: 50.00
Actual minimum distance: 50.01

Ingredient key Pairwise distance distribution
ext_A Distance distribution ext_A

@rugeli rugeli requested review from ascibisz and meganrm November 13, 2025 23:14
Copy link
Copy Markdown
Collaborator

@ascibisz ascibisz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested by running this locally as the server with cellpack-client and it looks good!

One question I'll just want to verify before we deploy it to cellpack-server: should we upload new default result files for the recipes in cellpack studio with these camera positions too? Otherwise, you go from a much more zoomed out view to a more zoomed in view when your Re-run completes

@rugeli
Copy link
Copy Markdown
Collaborator Author

rugeli commented Nov 14, 2025

I tested by running this locally as the server with cellpack-client and it looks good!

One question I'll just want to verify before we deploy it to cellpack-server: should we upload new default result files for the recipes in cellpack studio with these camera positions too? Otherwise, you go from a much more zoomed out view to a more zoomed in view when your Re-run completes

Good call! I'll go ahead test the results with smaller windows one more time. If everything looks nice, I'll upload them to /client and make sure the precomputed results in UI updated

@rugeli rugeli marked this pull request as draft November 18, 2025 17:13
@rugeli rugeli requested a review from mogres November 20, 2025 22:16
@rugeli
Copy link
Copy Markdown
Collaborator Author

rugeli commented Nov 20, 2025

@mogres now z position now uses max_box_dimension so the camera is far enough back to capture the entire packing. Try running some example recipes with different window sizes and let me know if you noticed any issues!

pack -r examples/recipes/v2/spheres_on_a_plane.json -c examples/packing-configs/upload_and_open_result.json
pack -r examples/recipes/v2/endosome.json -c examples/packing-configs/upload_and_open_result.json
pack -r examples/recipes/v2/one_sphere.json -c examples/packing-configs/upload_and_open_result.json
pack -r examples/recipes/v2/spheres_in_a_box.json -c examples/packing-configs/upload_and_open_result.json

@rugeli rugeli marked this pull request as ready for review November 20, 2025 22:31
Copy link
Copy Markdown
Collaborator

@mogres mogres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the example packings and the visualizations look good!

Some of them are still maybe a bit too far, but we can adjust the camera position as needed later. For some of our example recipes, we could bump up the number of packed spheres to make it visually more appealing, but that's for another PR.

camera_z_position = box_size[2] if box_size[2] > 10 else 100.0
# use max dimension to make sure camera captures entire scene
max_box_dimension = max(box_size)
camera_z_position = max_box_dimension * 2.5
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good workaround! For the future maybe we can reduce this multiplier or have it as a parameter because some of the packings still look too far away. We also can set the camera x position to 0 instead to avoid hard coded numbers.

@rugeli rugeli merged commit 2bfc619 into main Nov 21, 2025
10 checks passed
@rugeli rugeli deleted the feature/simularium-camera-refactor branch November 21, 2025 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants