# Adding Fiducial Markings

**URL:** https://discourse.slicer.org/t/adding-fiducial-markings/30467
**Category:** Support
**Created:** [July 9, 2023, 5:27am UTC](https://discourse.slicer.org/t/adding-fiducial-markings/30467 "2023-07-09T05:27:53Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sulaimanvesal](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sulaimanvesal/32/10463_2.png) [@sulaimanvesal](https://discourse.slicer.org/u/sulaimanvesal)
#### Post date: [July 9, 2023, 5:27am UTC](https://discourse.slicer.org/t/adding-fiducial-markings/30467/1 "2023-07-09T05:27:53Z")

</div>

Hi,

I am working on prostate biopsy and I do have the x,y,z information of 16 cores top and bottom for both MRI and Ultrasound. I want to use python to automatically create a fiducial markers for bottom and tip of each biopsy cores, connect them with a line and plot them on 3D slicer automatically for a cohort of 1000 cases.

I understood that we can use the following command to add a marker:

```auto
slicer.modules.markups.logic().AddFiducial(
df_row['coretipX'].values[0], df_row['coretipY'].values[0], df_row['coretipZ'].values[0]
)

```

However, this does not show anything on the 3D slicer scene. And I checked markup modules → control points, and it show empty values for RAS. Although, the marker is created.

Thanks for the help.

---

<div class="post-metadata">

### Author: ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)
#### Post date: [July 9, 2023, 5:43am UTC](https://discourse.slicer.org/t/adding-fiducial-markings/30467/2 "2023-07-09T05:43:37Z")

</div>

This should work:

```auto
# create new markups node
markupsNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsFiducialNode")
markupsNode.SetName("YourNodeName")

# add fiducial 
markupsNode.CreateDefaultDisplayNodes()
markupsNode.AddFiducial(50.,48.,-173.)

```

---

<div class="post-metadata">

### Author: ![sulaimanvesal](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sulaimanvesal/32/10463_2.png) [@sulaimanvesal](https://discourse.slicer.org/u/sulaimanvesal)
#### Post date: [July 9, 2023, 4:50pm UTC](https://discourse.slicer.org/t/adding-fiducial-markings/30467/3 "2023-07-09T16:50:17Z")

</div>

Thanks @rbumm

I tried your code, but still I don’t see any of markers on 3D view nor on the panels. Would it be an issue of volume orientations (.e.g. my MRI images are not in RAS orientation)?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/c/9c5d4fb3338821ee7cce392ed144f257b7c1db39.jpeg)

My points:

```auto
(x, y, z) Tip-> 13.622, -25.451, 54.307
(x, y, z) Bot-> 14.918, -13.143, 41.999

```

---

<div class="post-metadata">

### Author: ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)
#### Post date: [July 9, 2023, 6:59pm UTC](https://discourse.slicer.org/t/adding-fiducial-markings/30467/4 "2023-07-09T18:59:16Z")

</div>

Strange.  
Could you manually add the markups where you would expect them and compare them with the values you provided above?

---

<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: [July 10, 2023, 2:20pm UTC](https://discourse.slicer.org/t/adding-fiducial-markings/30467/5 "2023-07-10T14:20:11Z")

</div>

The screenshot shows that you are using a very old Slicer version. Please use the latest Slicer Stable Release (or the latest Slicer Preview Release, if there is any specific feature or fix that is not included in the stable version).

---

<div class="post-metadata">

### Author: ![sulaimanvesal](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sulaimanvesal/32/10463_2.png) [@sulaimanvesal](https://discourse.slicer.org/u/sulaimanvesal)
#### Post date: [July 13, 2023, 7:58pm UTC](https://discourse.slicer.org/t/adding-fiducial-markings/30467/6 "2023-07-13T19:58:24Z")

</div>

Hi @lassoan

I upgraded the 3D slicer to the latest version. I can see the fluidical markers on Jyupter notebook but when I save the 3D Slicer scene the markers don’t show up. Therefore I did another trick to save the markers as numpy array and export as fcsv files. This solved the issue to some extend.

I have another question, is there any 3D Slicer python function that allows to save fiducial markers into segmentation output or volume output?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/e/4ee27dbeb0fbeccde88b1b104f236c74982d9cf4.jpeg)

---

<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: [July 15, 2023, 3:35pm UTC](https://discourse.slicer.org/t/adding-fiducial-markings/30467/7 "2023-07-15T15:35:56Z")

</div>

If you save the markups and then load them then they show up. It works the same way when you use the desktop user interface or notebook. If you provide a code snippet that reproduces the unexpected behavior then we can have a look at it.
