# How can I make all 6 views Link together

**URL:** <https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874>\
**Category:** Development\
**Created:** [December 4, 2020, 5:13am UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874 "2020-12-04T05:13:14Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tesla2678](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tesla2678/32/9062_2.png) [@Tesla2678](https://discourse.slicer.org/u/Tesla2678)\
**Post date:** [December 4, 2020, 5:13am UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/1 "2020-12-04T05:13:14Z")

</div>

Hello there,

I have 2 files in layout. I want to make all 6 views link together, So when I move the mouse while the Shift key is pressed, all the other 5 views will move at the same time.

Thanks for your help

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 4, 2020, 5:18am UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/2 "2020-12-04T05:18:09Z")

</div>

Views that have the same [View group](http://apidocs.slicer.org/master/classvtkMRMLAbstractViewNode.html#a896bad470fb25f642165eb6305eee4fc) are linked. You can set it from Python or using View Controllers module’s Advanced section.

---

<div class="post-metadata">

**Author:** ![Tesla2678](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tesla2678/32/9062_2.png) [@Tesla2678](https://discourse.slicer.org/u/Tesla2678)\
**Post date:** [December 8, 2020, 1:48am UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/3 "2020-12-08T01:48:40Z")

</div>

Thank you very much~

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [May 18, 2021, 7:03pm UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/5 "2021-05-18T19:03:10Z")

</div>

> Is there a way to link the views in Python? We need to be able to zoom all 3 views at the same time. I \> imagine it would be like pushing the “Link button” in the view tool bar.

See entry [Set all slice views linked by default](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#set-all-slice-views-linked-by-default) from the script repository

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [May 19, 2021, 5:54pm UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/6 "2021-05-19T17:54:43Z")

</div>

@jamesobutler @pieper @lassoan  
Is there a way to reset, reinitialize or recreate a 3D view after it contains a rendering. In other words, dispose or delete the rendering or view and create a new one in the same view window?

Thanks

---

<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:** [May 19, 2021, 6:01pm UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/7 "2021-05-19T18:01:18Z")

</div>

@spycolyf - the way it works in Slicer is that the views observe the scene and display whatever meets their display criteria (i.e. if matches their view ID or doesn’t specify a view ID). So for example if a model node has multiple model display nodes, each one of which will have a list of zero or more view IDs. The view will then display the model using the display properties for the matching display node or nodes. Clearing the view would mean making sure none of the display nodes match what the view ID.

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [May 19, 2021, 8:03pm UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/8 "2021-05-19T20:03:32Z")

</div>

OK, my apologies. I should show you what I’m trying to do.

I currently have a MIP displayed. How do I replace it with a transparent rendering?

Here’s the MIP…  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/9/d9c59f2a7b428438409d2c9df02b5919ffa83803.png)

And when I try to replace it with a render, here’s what I get. The MIP wont go away…

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/6/c6df010330de73ca12097b654da2296968be498c.png)

I’m trying to switch from the MIP to this…

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/7/37b01042db2f3d3da6cba2ee23d7d3c7b60ebd19.png)

---

<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:** [May 19, 2021, 8:57pm UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/9 "2021-05-19T20:57:01Z")

</div>

> [@spycolyf](#):
>
> And when I try to replace it with a render, here’s what I get. The MIP wont go away…

What step do you do when you try to replace the MIP?

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [May 20, 2021, 2:43pm UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/11 "2021-05-20T14:43:11Z")

</div>

@pieper

Sorry about all of that code 😑

Here’s what get executed after to replace the MIP with the rendered…

```
def showVolumeRendering self, volumeNode):
    volRenLogic = slicer.modules.volumerendering.logic()
    displayNode = volRenLogic.CreateDefaultVolumeRenderingNodes(volumeNode)
    displayNode.SetVisibility(True)
    scalarRange = volumeNode.GetImageData().GetScalarRange()
    if scalarRange[1]-scalarRange[0] < 1500:
      # Small dynamic range, probably MRI
      displayNode.GetVolumePropertyNode().Copy(volRenLogic.GetPresetByName("MR-Default"))
    else:
      # Larger dynamic range, probably CT
      displayNode.GetVolumePropertyNode().Copy(volRenLogic.GetPresetByName("CT-Chest-Contrast-Enhanced"))
```

---

<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:** [May 20, 2021, 6:22pm UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/13 "2021-05-20T18:22:42Z")

</div>

Probably you are ending up with multiple display nodes so changing one leaves the other in place. You should be able to replace all the display nodes with a new version with the settings you want (or change the settings of the existing ones)

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [May 21, 2021, 2:42pm UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/14 "2021-05-21T14:42:01Z")

</div>

Thanks @pieper. But, how? What code am I missing?

---

<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:** [May 21, 2021, 3:00pm UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/15 "2021-05-21T15:00:47Z")

</div>

I couldn’t say for sure - debugging is half the fun, so you’ll need to do some digging.

A good way to better understand what’s going on is to use the Data module’s `All nodes` tab, and open the `Node information` box and enable showing of hidden nodes and MRML ids. Then as you interact with the scene you can see all the details of node values and what nodes reference each other by ID. All this node information is what gets saved and restored in the scene, and also what controls communication across the app. Once you get a good handle on what happens there you will have a much better understanding of how to write and debug Slicer code.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 21, 2021, 5:11pm UTC](https://discourse.slicer.org/t/how-can-i-make-all-6-views-link-together/14874/16 "2021-05-21T17:11:43Z")

</div>

It seems that you haven’t switched back the rendering technique in the view from MIP to composite rendering. See my answer to this question [here](https://discourse.slicer.org/t/slicerqr-development/15954/161). It would be easier to keep track of discussions if we kept the topics short and focused on one question.
