# How can I get camera position information?

**URL:** <https://discourse.slicer.org/t/how-can-i-get-camera-position-information/27067>\
**Category:** Development\
**Tags:** python\
**Created:** [January 6, 2023, 12:32am UTC](https://discourse.slicer.org/t/how-can-i-get-camera-position-information/27067 "2023-01-06T00:32:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsa934](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dsa934/32/17907_2.png) [@dsa934](https://discourse.slicer.org/u/dsa934)\
**Post date:** [January 6, 2023, 12:32am UTC](https://discourse.slicer.org/t/how-can-i-get-camera-position-information/27067/1 "2023-01-06T00:32:06Z")

</div>

Operating system: window 11  
Slicer version: 4.13.0

Hi , everyone

I would like to know about camera coordinates, viewup vector, and focal point information based on the first time I ran 3d slicer.

so, I used follow code

viewNode = slicer.mrmlScene.GetSingletonNode(“1”, “vtkMRMLViewNode”)  
cameraNode = slicer.modules.cameras.logic().GetViewActiveCameraNode(viewNode)  
print(cameraNode.GetPosition())

but result : 000001dd…\_p\_void

How can I get camera coordinates like [x,y,z] based on ras coordinates or view coordinates?

---

<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:** [January 6, 2023, 4:19am UTC](https://discourse.slicer.org/t/how-can-i-get-camera-position-information/27067/2 "2023-01-06T04:19:07Z")

</div>

It seems that a vector length hint was missing in the `GetPosition` call, therefore a raw pointer is returned. We’ll fix this. Until then you can use this syntax:

```python
p=[0,0,0]
cameraNode.GetPosition(p)
print(p)

```

Please use the current version of Slicer, especially for development.

---

<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:** [January 6, 2023, 4:28pm UTC](https://discourse.slicer.org/t/how-can-i-get-camera-position-information/27067/3 "2023-01-06T16:28:14Z")

</div>

I’ve [submitted a pull request](https://github.com/Slicer/Slicer/pull/6765) to add the missing size hints, which will make `GetPosition()` syntax work as expected. The fix will be available in the Slicer Preview Release within a few days.
