# Adding fiducial marks and determining RAS coordinates

**URL:** <https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421>\
**Category:** Development\
**Created:** [September 10, 2020, 12:58pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421 "2020-09-10T12:58:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 10, 2020, 12:58pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/1 "2020-09-10T12:58:54Z")

</div>

Hello everyone,  
Is there anyway to add fiducial markers to a stl data without the markups module? I want to add fiducial markers manually to the module I am working on. I’d like to display the RAS coordinates to the module GUI.

---

<div class="post-metadata">

**Author:** ![ungi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ungi/32/78573_2.png) [@ungi](https://discourse.slicer.org/u/ungi)\
**Post date:** [September 11, 2020, 7:24pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/2 "2020-09-11T19:24:55Z")

</div>

Hi,  
You can take advantage of the markups module in your own module, without using the markups module in a visible way. There are examples in the script repository how to use module functions (including markups) from your module: [https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Switching\_to\_markup\_fiducial\_placement\_mode](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Switching_to_markup_fiducial_placement_mode)  
I hope this helps,  
Tamas

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 12, 2020, 10:47am UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/3 "2020-09-12T10:47:58Z")

</div>

Hello Tamas,  
Thank you for your reply! This is written in python but I am extending a cxx file. Can the same thing be done in C++ along with the QT framework? If it can be done, I am really counting on your suggestions.

Best regards,  
Anish

---

<div class="post-metadata">

**Author:** ![ungi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ungi/32/78573_2.png) [@ungi](https://discourse.slicer.org/u/ungi)\
**Post date:** [September 12, 2020, 3:17pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/4 "2020-09-12T15:17:24Z")

</div>

Yes, the Markups module is written in C++, so you should be able to use the same functions in a C++ loadable module too.  
I think it is very rare that people use C++ to write Slicer modules nowadays. If an application-specific workflow needs to be supported by a custom Slicer module, Python seems to be a more efficient choice.

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 14, 2020, 7:33am UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/5 "2020-09-14T07:33:43Z")

</div>

Thank you for your reply. Is there any example to do that? Cause I researched on the internet but I did not find a solution.

---

<div class="post-metadata">

**Author:** ![ungi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ungi/32/78573_2.png) [@ungi](https://discourse.slicer.org/u/ungi)\
**Post date:** [September 14, 2020, 1:29pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/6 "2020-09-14T13:29:46Z")

</div>

If you are looking for an example C++ module that uses fiducials for registration, this one comes to mind:

> **[SlicerIGT/SlicerIGT](https://github.com/SlicerIGT/SlicerIGT/tree/master/FiducialRegistrationWizard)**
>
> Modules supporting image-guided interventions in 3D Slicer. - SlicerIGT/SlicerIGT

  
This is a convenience module that keeps track of two fiducial lists and computes registration between them. The result is stored in a transform node that can be used by other modules.

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 14, 2020, 5:37pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/7 "2020-09-14T17:37:25Z")

</div>

Thank you very much for your reply! I really had a hard time understanding the module. As I said earlier, I’d only want to display the fiducial point with RAS coordinates. I am new to VTK and 3D slicer. Therefore, I’d really appreciate your help.

---

<div class="post-metadata">

**Author:** ![ungi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ungi/32/78573_2.png) [@ungi](https://discourse.slicer.org/u/ungi)\
**Post date:** [September 14, 2020, 5:42pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/8 "2020-09-14T17:42:34Z")

</div>

Why don’t you use the Markups module? If you expand the “Control Points” section of the Markups module widget, you can see the RAS coordinates there.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [September 14, 2020, 5:43pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/9 "2020-09-14T17:43:39Z")

</div>

I think what you are wanting is exactly what the qSlicerSimpleMarkupsWidget provides.

```python
simple_markups = slicer.qSlicerSimpleMarkupsWidget()
simple_markups.setMRMLScene(slicer.mrmlScene)

```

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

Or the Markups module

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/a/da1183e2cce09b778ed913538524d5afd2e47e6b.png)

---

<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:** [September 14, 2020, 5:51pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/10 "2020-09-14T17:51:24Z")

</div>

> [@Anish\_Basnet](#):
>
> I am new to VTK and 3D slicer.

In this case I would strongly recommend to use Python while you are getting to know the libraries (VTK, ITK, Qt, CTK, Slicer, etc.). Once you know how things work and what exactly you need, you can easily switch back to C++. We often use Python, even for prototyping new Slicer core features that are in the end ported to C++.

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 15, 2020, 7:01am UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/11 "2020-09-15T07:01:16Z")

</div>

Thank you very much for your reply! I wanted to deliver the same functionality as control points section of the markups module widget.

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 15, 2020, 7:02am UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/12 "2020-09-15T07:02:16Z")

</div>

Thank you very much for your reply! I will try it and let you know.

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 15, 2020, 7:04am UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/13 "2020-09-15T07:04:48Z")

</div>

Thank you very much for your suggestions. I have basic knowledge of C++ programming and the project that I am working on right now demands the use of C++. Therefore, I’d like to have a good grasp of development of a module with c++. It’d be nice if you could recommend me some resources that I can rely on.

---

<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:** [September 15, 2020, 5:26pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/14 "2020-09-15T17:26:03Z")

</div>

Majority of Slicer core is implemented in C++ and there are a number of extensions that use C++ (SlicerRT, SlicerIGT, SlicerOpenIGTLink, SlicerIGSIO, SlicerDMRI, SlicerAstro, SlicerFreeSurfer, GelDosimetry, PerkTutor, etc.) that you can use as examples.

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 28, 2020, 11:24am UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/15 "2020-09-28T11:24:16Z")

</div>

Hello everyone,  
I am now able to put fiducial points with mouse click. I have used QTableWidget to write the fiducial points in the widget. But I’d like to display the points in real time in the widget. Whenever I place the fiducial point I need it to display in the widget. I went through the Markpus Module but did not understand how they achieved the functionality.

---

<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:** [September 28, 2020, 1:37pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/16 "2020-09-28T13:37:28Z")

</div>

Instead of redeveloping a table widget for displaying markups control points from scratch, I would recommend to use the widget as @jamesobutler suggested [above](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/9). It is quite configurable, so it should be able to do exactly what you need, but if you cannot figure out how to achieve something then let us know.

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [September 30, 2020, 9:13am UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/17 "2020-09-30T09:13:10Z")

</div>

Hi Andras,  
I am trying to access the class qslicerSimpleMarkupsWidget. As I am doing it with c++, I am now confused about accessing the widget. I suppose James called it using scripted module. Can I convert the scripted code to c++ code somehow?

Best regards,  
Anish

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [October 5, 2020, 3:00pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/18 "2020-10-05T15:00:47Z")

</div>

Hello,  
I have found that the fiducial points can be placed with the help of a button using scripted module. But how can I achieve the same functionality using the loadable module?

```python
w=slicer.qSlicerMarkupsPlaceWidget()
w.setMRMLScene(slicer.mrmlScene)
markupsNodeID = slicer.modules.markups.logic().AddNewFiducialNode()
w.setCurrentNode(slicer.mrmlScene.GetNodeByID(markupsNodeID))
# Hide all buttons and only show place button
w.buttonsVisible=False
w.placeButton().show()
w.show()

```

Best regards,  
Anish

---

<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:** [October 8, 2020, 9:17pm UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/19 "2020-10-08T21:17:38Z")

</div>

Do you mean that you would like to translate the Python code above to C++?

---

<div class="post-metadata">

**Author:** ![Anish\_Basnet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/anish_basnet/32/7988_2.png) [@Anish\_Basnet](https://discourse.slicer.org/u/Anish_Basnet)\
**Post date:** [October 9, 2020, 8:25am UTC](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421/20 "2020-10-09T08:25:22Z")

</div>

Hello Andras,  
Thank you for the reply. Yes exactly! I read somewhere in the forum that I can add an observer to the fiducial node to monitor the changes and display it in the table widget. But I do not know how to proceed it with c++ code. Therefore, it would be easy for me to display by accessing the qSlicerSimpleMarkupsModule with c++ from my module.

Best regards,  
Anish

[Next page](https://discourse.slicer.org/t/adding-fiducial-marks-and-determining-ras-coordinates/13421.md?page=2)
