Adding Fiducial Markings

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:

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.

This should work:

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

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

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)?

My points:

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

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

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).

1 Like

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?

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.