# A problem about camera position setting

**URL:** <https://discourse.slicer.org/t/a-problem-about-camera-position-setting/26575>\
**Category:** Support\
**Created:** [December 5, 2022, 9:12am UTC](https://discourse.slicer.org/t/a-problem-about-camera-position-setting/26575 "2022-12-05T09:12:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![f1oNae](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/f1onae/32/17418_2.png) [@f1oNae](https://discourse.slicer.org/u/f1oNae)\
**Post date:** [December 5, 2022, 9:12am UTC](https://discourse.slicer.org/t/a-problem-about-camera-position-setting/26575/1 "2022-12-05T09:12:29Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/a/5aab83e2e04fc4dc1fbd3ee2a19bffc44337592c.jpeg)  
When I set the position of cameras,I found that the 3dview disappeared if the position of camera was a little far from the origin.I must interact with the 3dview so that I can get the image,but it will change the picture.

```auto
cam1 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode1")
cam1.SetPosition(0,800,0)
cam2 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode2")
cam2.SetPosition(0,1200,0)
cam3 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode3")
cam3.SetPosition(0,1700,0)

```

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

It’s strange.Can you do me a favour?What’s wrong with this?  
How can i solve it?

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [December 5, 2022, 11:37am UTC](https://discourse.slicer.org/t/a-problem-about-camera-position-setting/26575/2 "2022-12-05T11:37:02Z")

</div>

@f1oNae, after setting the position of the camera, you need to re-compute the clipping range (for reference [https://github.com/Slicer/Slicer/blob/a5f75351073ef62fd6198d9480d86c0009d70f9b/Libs/MRML/Core/vtkMRMLCameraNode.h#L114-L119](https://github.com/Slicer/Slicer/blob/a5f75351073ef62fd6198d9480d86c0009d70f9b/Libs/MRML/Core/vtkMRMLCameraNode.h#L114-L119))

In python, you could simply do something like this:

```python
cam1 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode1")
cam1.SetPosition(0,800,0)
cam1.ResetClippingRange()
cam2 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode2")
cam2.SetPosition(0,1200,0)
cam2.ResetClippingRange()
cam3 = slicer.mrmlScene.GetNodeByID("vtkMRMLCameraNode3")
cam3.SetPosition(0,1700,0)
cam3.ResetClippingRange()

```

---

<div class="post-metadata">

**Author:** ![f1oNae](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/f1onae/32/17418_2.png) [@f1oNae](https://discourse.slicer.org/u/f1oNae)\
**Post date:** [December 5, 2022, 12:04pm UTC](https://discourse.slicer.org/t/a-problem-about-camera-position-setting/26575/3 "2022-12-05T12:04:06Z")

</div>

Thanks a lot.it works!
