# Access 3d renderer for multiple view

**URL:** <https://discourse.slicer.org/t/access-3d-renderer-for-multiple-view/17265>\
**Category:** Support\
**Tags:** python\
**Created:** [April 23, 2021, 3:01am UTC](https://discourse.slicer.org/t/access-3d-renderer-for-multiple-view/17265 "2021-04-23T03:01:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pj-rit](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pj-rit/32/10760_2.png) [@pj-rit](https://discourse.slicer.org/u/pj-rit)\
**Post date:** [April 23, 2021, 3:01am UTC](https://discourse.slicer.org/t/access-3d-renderer-for-multiple-view/17265/1 "2021-04-23T03:01:51Z")

</div>

Hi, I am wondering if it is possible to access the renderer that is associated with a view node. I am currently grabbing the view node using

`slicer.util.getFirstNodeByName('View1')`, but I don’t know know how to grab the renderer that is associated with that view or rather what threeDwidget the view belongs to.

I am creating a script where more than one 3d views can be created, but I need to keep track of the first one and it seems that I can’t just assume that idx = 0 in

> slicer.app.layoutmanager().threeDWidget(idx).threeDView().renderWindow().GetRenderers().GetFirstRenderer()

I am using the imagedata from one of the 3d views to capture the image and create an AR overlay in the slice view.  
Thank you for any help.  
Peter

---

<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 23, 2021, 9:26pm UTC](https://discourse.slicer.org/t/access-3d-renderer-for-multiple-view/17265/2 "2021-04-23T21:26:54Z")

</div>

You should be able to iterate over the threeDWidgets and find the one that matches your view node with this call:

```auto
slicer.app.layoutManager().threeDWidget(0).threeDView().mrmlViewNode()

```

---

<div class="post-metadata">

**Author:** ![pj-rit](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pj-rit/32/10760_2.png) [@pj-rit](https://discourse.slicer.org/u/pj-rit)\
**Post date:** [April 26, 2021, 3:26pm UTC](https://discourse.slicer.org/t/access-3d-renderer-for-multiple-view/17265/3 "2021-04-26T15:26:33Z")

</div>

Thanks, I think that makes sense. I hadn’t thought of doing it that way, because I was thinking there was a direct reference between the two

---

<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 26, 2021, 8:00pm UTC](https://discourse.slicer.org/t/access-3d-renderer-for-multiple-view/17265/4 "2021-04-26T20:00:38Z")

</div>

> [@pj-rit](#):
>
> I was thinking there was a direct reference between the two

You’re right, this is cleaner:

```auto
>>> v = getNode('*View*')
>>> v
(MRMLCore.vtkMRMLViewNode)0x253dc1648
>>> slicer.app.layoutManager().viewWidget(v)
qMRMLThreeDWidget(0x7fce8970bfd0, name="ThreeDWidget1") 

```

---

<div class="post-metadata">

**Author:** ![pj-rit](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pj-rit/32/10760_2.png) [@pj-rit](https://discourse.slicer.org/u/pj-rit)\
**Post date:** [May 10, 2021, 2:18pm UTC](https://discourse.slicer.org/t/access-3d-renderer-for-multiple-view/17265/5 "2021-05-10T14:18:47Z")

</div>

Thanks,  
That’s so much easier to use.
