# How read the .tag file for landmarks visualization

**URL:** <https://discourse.slicer.org/t/how-read-the-tag-file-for-landmarks-visualization/7487>\
**Category:** Support\
**Tags:** dicom, markups-fiducials, file-import\
**Created:** [July 9, 2019, 9:59pm UTC](https://discourse.slicer.org/t/how-read-the-tag-file-for-landmarks-visualization/7487 "2019-07-09T21:59:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ljc19800331](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ljc19800331/32/2392_2.png) [@ljc19800331](https://discourse.slicer.org/u/ljc19800331)\
**Post date:** [July 9, 2019, 9:59pm UTC](https://discourse.slicer.org/t/how-read-the-tag-file-for-landmarks-visualization/7487/1 "2019-07-09T21:59:52Z")

</div>

Operating system: Windows 10  
Slicer version: 4.10.2  
Expected behavior:

Hello, I want to check the fiducial on the ultrasound and MRI data and all the fiducials are saved in a .tag file. Since it is not a common .fcsv file and I could not load the .tag file directly in 3D slicer. Any methods to solve this problem? Thanks.

An example of the file looks like:

```auto
MNI Tag Point File
Volumes = 2;
% Case 1: XXX landmarks

Points =
 10 20 30 40 -30 30 ""
......

```

---

<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, 2019, 3:25am UTC](https://discourse.slicer.org/t/how-read-the-tag-file-for-landmarks-visualization/7487/2 "2019-07-10T03:25:21Z")

</div>

The easiest would be to write a short python script that parses the file line by line by a few regular expressions and adds landmark point positions to a markups fiducial node.

If you want to be able to load a tag file by “Add data” window (or drag-and-dropping to the application window) then you need to add a file reader plug-in. Let us know if you are interested in this and we can help with more specific instructions.

---

<div class="post-metadata">

**Author:** ![ljc19800331](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ljc19800331/32/2392_2.png) [@ljc19800331](https://discourse.slicer.org/u/ljc19800331)\
**Post date:** [July 10, 2019, 9:51pm UTC](https://discourse.slicer.org/t/how-read-the-tag-file-for-landmarks-visualization/7487/3 "2019-07-10T21:51:38Z")

</div>

Thanks for your guidance @lassoan . I have wrote the python script to convert the .tag file to .fcsv file and it can be loaded in 3D slicer.

I have two fiducial dataset (one is preoperative MRI and one is 3D ultrasound) and I want to calculate the displacement vector for each fiducial pair. I am wondering if there is a method to calculate the displacement vector for each fiducial point and show all the vectors in the slice and 3D scene. My final goal is to manually check the outlier for each fiducial pairs in both image slice. Thanks.

For example in the two fcsv files, we have:  
.fcsv\_1 file:  
vtkMRMLMarkupsFiducialNode\_0,50.164402 -31.719656 34.845306,-5.771,-11.195,9.070,1.000,1,1,0,F1-1,F1-3, …

.fcsv\_2 file:  
vtkMRMLMarkupsFiducialNode\_0,48.972829 -32.396878 34.952277,0.000,0.000,0.000,1.000,1,1,0,M1-2,

The displacement vector = (x1 - x2, y1 - y2, z1 - z2) for each pair. I could calculate all the displacement vectors from two fiducial sets and I would like to load the result to 3D slicer, and able to visualize all the vectors automatically. The result is similar to the following figure (refer from another question “calculating-the-displacement-between-two-models”). And I am not sure if this can be finished all in python.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/0/40580beb33b2184a94762266822cca123af621ba.png)

Thanks again for your help.

---

<div class="post-metadata">

**Author:** ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)\
**Post date:** [October 19, 2021, 2:11pm UTC](https://discourse.slicer.org/t/how-read-the-tag-file-for-landmarks-visualization/7487/4 "2021-10-19T14:11:05Z")

</div>

Hi, would you mind sharing the script that you wrote? Thanks!
