# qSlicerMarkupsPlaceWidget - Get control point coordinates

**URL:** <https://discourse.slicer.org/t/qslicermarkupsplacewidget-get-control-point-coordinates/26506>\
**Category:** Support\
**Tags:** coordinates, qt, markups\
**Created:** [November 30, 2022, 10:51am UTC](https://discourse.slicer.org/t/qslicermarkupsplacewidget-get-control-point-coordinates/26506 "2022-11-30T10:51:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LuisaDantas](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@LuisaDantas](https://discourse.slicer.org/u/LuisaDantas)\
**Post date:** [November 30, 2022, 10:51am UTC](https://discourse.slicer.org/t/qslicermarkupsplacewidget-get-control-point-coordinates/26506/1 "2022-11-30T10:51:42Z")

</div>

Hey!

I’m building a module for Slicer and using qSlicerMarkupsPlaceWidget() to let the user place a control point on the image. The ideia is just to get the coordinates of this control point, but I’m not sure how to acces this information and store it. I would appreciate some help.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [November 30, 2022, 2:10pm UTC](https://discourse.slicer.org/t/qslicermarkupsplacewidget-get-control-point-coordinates/26506/2 "2022-11-30T14:10:43Z")

</div>

There is a Script repository that contains hundreds of little code examples, including this: [Script repository — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#access-to-markups-point-list-properties)

Btw I just posted a piece of code in another thread that among other things gets the position of a control point. You could use it as inspiration. Here it is: [Exporting a model to STL with markups - #2 by cpinter](https://discourse.slicer.org/t/importing-a-model-to-stl-with-markups/26502/2)

---

<div class="post-metadata">

**Author:** ![LuisaDantas](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@LuisaDantas](https://discourse.slicer.org/u/LuisaDantas)\
**Post date:** [November 30, 2022, 4:06pm UTC](https://discourse.slicer.org/t/qslicermarkupsplacewidget-get-control-point-coordinates/26506/3 "2022-11-30T16:06:20Z")

</div>

@cpinter Great it worked just fine, and the repository will help me a lot, huge thank you!

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [December 1, 2022, 11:55am UTC](https://discourse.slicer.org/t/qslicermarkupsplacewidget-get-control-point-coordinates/26506/4 "2022-12-01T11:55:15Z")

</div>

Sorry I put the wrong link in my comment. I fixed it in case someone needs it in the future.

---

<div class="post-metadata">

**Author:** ![LuisaDantas](https://avatars.discourse-cdn.com/v4/letter/l/b38774/32.png) [@LuisaDantas](https://discourse.slicer.org/u/LuisaDantas)\
**Post date:** [December 1, 2022, 4:24pm UTC](https://discourse.slicer.org/t/qslicermarkupsplacewidget-get-control-point-coordinates/26506/5 "2022-12-01T16:24:47Z")

</div>

@cpinter I having trouble to understand one thing. On the script you mentioned from the other thread, on this line `fiducialNode = getNode('F')` your node name is ‘F’, so if there’s n control points they all would be on node F?

On my case, I need to get the coordinates from a user inserted control point (they can only insert one, but I will deal with that later). Is there a way to get the coordinates without having to pass the name of the node? If we suppose that there’s only one.

Edit: I have one more question, how can I get the coordinates in pixels?

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [December 7, 2022, 10:20am UTC](https://discourse.slicer.org/t/qslicermarkupsplacewidget-get-control-point-coordinates/26506/6 "2022-12-07T10:20:15Z")

</div>

You need to get the node somehow so that you can do operations on it. If you are sure you only have one node, you can use this function [Slicer: vtkMRMLScene Class Reference](https://apidocs.slicer.org/master/classvtkMRMLScene.html#a21560f853d73548021e75d991d5aa34d)  
Feel free to look at other scripted modules for inspiration. They all use nodes.

> [@LuisaDantas](#):
>
> I have one more question, how can I get the coordinates in pixels?

See here: [Script repository — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#get-volume-voxel-coordinates-from-markup-control-point-ras-coordinates)  
The script repository is a very valuable resource, I recommend that too.
