# How to get mouse IJK coordinates?

**URL:** <https://discourse.slicer.org/t/how-to-get-mouse-ijk-coordinates/24968>\
**Category:** Support\
**Tags:** python, coordinates, module\
**Created:** [August 29, 2022, 3:27am UTC](https://discourse.slicer.org/t/how-to-get-mouse-ijk-coordinates/24968 "2022-08-29T03:27:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunshine](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@sunshine](https://discourse.slicer.org/u/sunshine)\
**Post date:** [August 29, 2022, 3:27am UTC](https://discourse.slicer.org/t/how-to-get-mouse-ijk-coordinates/24968/1 "2022-08-29T03:27:52Z")

</div>

Hi everyone,

I am trying to write my first module using MarkUp PointList. And I would like to use a label in UI to show the real-time mouse position, both RAS and IJK, just like the screenshot below.

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

I found the RAS coordinates using

```auto
crosshairNode.GetCursorPositionRAS(ras)

```

What are the functions I should use to retrieve the mouse IJK coordinates?

Thank you very much in advance!

---

<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:** [August 29, 2022, 3:44am UTC](https://discourse.slicer.org/t/how-to-get-mouse-ijk-coordinates/24968/2 "2022-08-29T03:44:46Z")

</div>

The DataProbe is implemented in Python, so you can copy-paste the code snippet that computes voxel coordinates from slice XYZ - see [here](https://github.com/Slicer/Slicer/blob/8fb7ade53e7e4bbb68aea6cb28ef62920d1edcdc/Modules/Scripted/DataProbe/DataProbe.py#L191-L255).
