# How to get the center value of a GLWindow interactor position in ResliceCursorWidget

**URL:** https://discourse.vtk.org/t/how-to-get-the-center-value-of-a-glwindow-interactor-position-in-reslicecursorwidget/10383
**Category:** Web
**Created:** [January 4, 2023, 4:12pm UTC](https://discourse.vtk.org/t/how-to-get-the-center-value-of-a-glwindow-interactor-position-in-reslicecursorwidget/10383 "2023-01-04T16:12:40Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dexter](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/dc4da7/32.png) [@dexter](https://discourse.vtk.org/u/dexter)
#### Post date: [January 4, 2023, 4:12pm UTC](https://discourse.vtk.org/t/how-to-get-the-center-value-of-a-glwindow-interactor-position-in-reslicecursorwidget/10383/1 "2023-01-04T16:12:40Z")

</div>

Hey,  
I want to set the center of my reslice widget cursor, using the position where we clicked with the mouse in a reslice actor (one of the three views in the ResliceCursorWidget ),  
I did this

```auto
obj.interactor.onLeftButtonPress(async (callData) => {
const pos = callData.position;
const arr = [pos[0], pos[1], pos[2]];
widget.setCenter(arr);
})

```

I figured out that we can’t do a `setCenter` using the position value, because the widget center value is different from the click position at certain location.  
I don’t know how to setCenter the widget correctly thank you for your help

---

<div class="post-metadata">

### Author: ![finetjul](https://discourse.vtk.org/user_avatar/discourse.vtk.org/finetjul/32/154_2.png) [@finetjul](https://discourse.vtk.org/u/finetjul)
#### Post date: [January 4, 2023, 4:55pm UTC](https://discourse.vtk.org/t/how-to-get-the-center-value-of-a-glwindow-interactor-position-in-reslicecursorwidget/10383/2 "2023-01-04T16:55:43Z")

</div>

callData.position is in pixel coordinate system. `setCenter()` expects world coordinate. You need to map from display coordinate to world coordinate. I believe there are convenient functions in the render window , render window interactor or renderer classes.

---

<div class="post-metadata">

### Author: ![dexter](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/dc4da7/32.png) [@dexter](https://discourse.vtk.org/u/dexter)
#### Post date: [January 6, 2023, 10:52am UTC](https://discourse.vtk.org/t/how-to-get-the-center-value-of-a-glwindow-interactor-position-in-reslicecursorwidget/10383/3 "2023-01-06T10:52:26Z")

</div>

Yes thank you so much, I did it using:

```auto
const pos = callData.position;
    const arr = obj.interactor
      .getView()
      .displayToWorld(pos.x, pos.y, pos.z, obj.renderer);

```
