# Link dual views with relative camera position

**URL:** <https://discourse.slicer.org/t/link-dual-views-with-relative-camera-position/29181>\
**Category:** Support\
**Created:** [April 28, 2023, 12:35am UTC](https://discourse.slicer.org/t/link-dual-views-with-relative-camera-position/29181 "2023-04-28T00:35:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [April 28, 2023, 12:35am UTC](https://discourse.slicer.org/t/link-dual-views-with-relative-camera-position/29181/1 "2023-04-28T00:35:41Z")

</div>

I am not sure if title explains it what I want correctly. But here is the use case:

I have two models with different orientations, loaded into two 3D viewers. I would like to link the views such that when I rotate right skull, I would like the other rotate in the same way. This is current not possible, and I am not sure whether it is possible to do without having to register them.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/e/eeb43190b5ce21bc52bbb412e13803cc7d75947e.jpeg)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [April 28, 2023, 1:41pm UTC](https://discourse.slicer.org/t/link-dual-views-with-relative-camera-position/29181/2 "2023-04-28T13:41:21Z")

</div>

It might be possible to implement a relative mode in camera linkage where the delta between the two cameras is recorded at the start and then always applied to each update. I’m not sure how much work that would take.

I actually think just registering the two models to be basically in the same space would be the most straightforward. I know that is hard to do with the rotate and translate sliders or direct manipulation, but since you have landmarks on these already it should be easy to do with a landmark transform.

This made me think of another mode that could be helpful: we could use the camera controls to align the two models in the views and then use the difference in camera parameters to calculate a transform to apply to one of the models for registration. That might be more intuitive than the sliders or manipulators and would work when you didn’t have landmarks.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [April 28, 2023, 2:34pm UTC](https://discourse.slicer.org/t/link-dual-views-with-relative-camera-position/29181/3 "2023-04-28T14:34:53Z")

</div>

> [@pieper](#):
>
> I actually think just registering the two models to be basically in the same space would be the most straightforward.

This example just happened to have landmarks. Most often I do not have any.

> [@pieper](#):
>
> This made me think of another mode that could be helpful: we could use the camera controls to align the two models in the views and then use the difference in camera parameters to calculate a transform to apply to one of the models for registration. That might be more intuitive than the sliders or manipulators and would work when you didn’t have landmarks.

Yes, something like this what I had in mind. Once I bring objects the positions I would like to keep, there would a button or a something that will lock the relative position.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [April 28, 2023, 2:51pm UTC](https://discourse.slicer.org/t/link-dual-views-with-relative-camera-position/29181/4 "2023-04-28T14:51:18Z")

</div>

This should be pretty straightforward. Get the translations from the centers of rotation of the two camera views, and then the rotation from the vectors from these centers of rotation back to the camera and the up vectors. I could imagine a little module for that would be quite doable.

---

<div class="post-metadata">

**Author:** ![tsehrhardt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tsehrhardt/32/18470_2.png) [@tsehrhardt](https://discourse.slicer.org/u/tsehrhardt)\
**Post date:** [April 29, 2023, 1:03am UTC](https://discourse.slicer.org/t/link-dual-views-with-relative-camera-position/29181/5 "2023-04-29T01:03:25Z")

</div>

If it’s helpful until this gets implemented in Slicer, you can link the viewers in Meshlab.

 ![2023-04-28_21-02-19](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/0/e096d0e90803d42d874fba2e64532cd6f96ee407.jpeg)

 ![2023-04-28_21-01-26](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/d/8d804c80d994ab24d97dbaf79b40747790dd3e84.jpeg)

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [June 22, 2024, 1:42pm UTC](https://discourse.slicer.org/t/link-dual-views-with-relative-camera-position/29181/7 "2024-06-22T13:42:37Z")

</div>

> [@tsehrhardt](#):
>
> until this gets implemented in Slicer,

For posterity this functionality is now available in the QuickAlign module of SlicerMorph. [New module to manually align 3D views](https://discourse.slicer.org/t/new-module-to-manually-align-3d-views/35634)

You can align and link the view for volumes, models, and pointLists.
