# Convert CSV files to be loadable as Fiducials or as Sequence of Fiducials (JSON)

**URL:** <https://discourse.slicer.org/t/convert-csv-files-to-be-loadable-as-fiducials-or-as-sequence-of-fiducials-json/18320>\
**Category:** Support\
**Created:** [June 24, 2021, 11:21am UTC](https://discourse.slicer.org/t/convert-csv-files-to-be-loadable-as-fiducials-or-as-sequence-of-fiducials-json/18320 "2021-06-24T11:21:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hmaguilera](https://avatars.discourse-cdn.com/v4/letter/h/bc8723/32.png) [@hmaguilera](https://discourse.slicer.org/u/hmaguilera)\
**Post date:** [June 24, 2021, 11:21am UTC](https://discourse.slicer.org/t/convert-csv-files-to-be-loadable-as-fiducials-or-as-sequence-of-fiducials-json/18320/1 "2021-06-24T11:21:38Z")

</div>

Hi,  
I have several CSV files which contain nodal coordinates of a finite element mesh at different time-points after finite element analysis.

I want to validate the FE-model with echocardiography, and therefore want to import the CSV’s into Slicer and plot it together with the echocardiographic volume. Preferably as fiducial markers, and if possible in a Sequence which is loadable. However, JSON files that could be imported as fiducials would do just fine.

The CSV format currently looks like this, but if another format is better this can change.

0.020008288323879242,0.020008288323879242,0.020008288323879242  
-5.5104074478149405,21.592485427856445,11.360527992248535  
-3.809137344360352,20.855607986450195,11.380624771118164  
-2.173929452896118,20.26450729370117,11.737421989440916  
-0.4237257242202759,19.472154617309567,12.046059608459473  
1.1728017330169676,18.723459243774414,12.897193908691408  
3.3027710914611816,19.262800216674805,13.48173522949219  
5.7919020652771,22.181146621704098,11.295902252197264  
7.3409905433654785,19.74334526062012,6.751131057739258  
5.514996528625488,17.492221832275387,5.892641067504882

Here the first row contains the time during FEA, at the X,Y,Z coordinate. Meaning that each column describes the X,Y,Z coordinate respectively.

If someone has any tips on how this could be done, it would be very appreciated.

Best  
Hans Martin

---

<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:** [June 24, 2021, 1:13pm UTC](https://discourse.slicer.org/t/convert-csv-files-to-be-loadable-as-fiducials-or-as-sequence-of-fiducials-json/18320/2 "2021-06-24T13:13:09Z")

</div>

In recent Slicer Preview Releases, you can use the table import feature in Markups module.

All you need to do is to create a valid csv file from this, by adding a header. If the coordinates are in LPS coordinate system then add `l,p,s` as column names, if the coordinates are in `RAS` then use `r,a,s`. For example:

```plaintext
r, a, s
0.020008288323879242,0.020008288323879242,0.020008288323879242
-5.5104074478149405,21.592485427856445,11.360527992248535
-3.809137344360352,20.855607986450195,11.380624771118164
-2.173929452896118,20.26450729370117,11.737421989440916
-0.4237257242202759,19.472154617309567,12.046059608459473
1.1728017330169676,18.723459243774414,12.897193908691408
3.3027710914611816,19.262800216674805,13.48173522949219
5.7919020652771,22.181146621704098,11.295902252197264
7.3409905433654785,19.74334526062012,6.751131057739258
5.514996528625488,17.492221832275387,5.892641067504882

```

You can then save this file as .csv and use it as control point coordinates in Slicer:

- drag-and-drop the .csv file on the Slicer application window and click “Apply” to load it as a table
- go to Markups module
- create a markup node (fiducial list, curve, …)
- in “Export/import table” section choose “Import” and select the input table
- click “Import”

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

There are a couple of more columns that you can add, such as point labels or selected state. See a complete list [here](https://slicer.readthedocs.io/en/latest/developer_guide/modules/markups.html#markups-control-points-table-file-format-csv-tsv).

If you want to import a markup directly from a file and/or specify markup display properties (colors, opacities, glyph size, …) then you can create a .mrk.json file. See more information [here](https://slicer.readthedocs.io/en/latest/developer_guide/modules/markups.html#markups-json-file-format-mrk-json).

---

<div class="post-metadata">

**Author:** ![hmaguilera](https://avatars.discourse-cdn.com/v4/letter/h/bc8723/32.png) [@hmaguilera](https://discourse.slicer.org/u/hmaguilera)\
**Post date:** [June 24, 2021, 1:21pm UTC](https://discourse.slicer.org/t/convert-csv-files-to-be-loadable-as-fiducials-or-as-sequence-of-fiducials-json/18320/3 "2021-06-24T13:21:32Z")

</div>

Thank you! That worked perfectly.  
HM

---

<div class="post-metadata">

**Author:** ![Lin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lin/32/15559_2.png) [@Lin](https://discourse.slicer.org/u/Lin)\
**Post date:** [May 20, 2022, 11:23pm UTC](https://discourse.slicer.org/t/convert-csv-files-to-be-loadable-as-fiducials-or-as-sequence-of-fiducials-json/18320/4 "2022-05-20T23:23:35Z")

</div>

Hi Lassoan, did you mean to use l,p,s as a header if the coords system is LPS in the .csv file? Is it a typo that you wrote " If the coordinates are in LPS coordinate system then add `r,a,s` as column names, if the coordinates are in `RAS` then use `r,a,s` ." ?  
Thank you, this is important to me.

---

<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:** [May 20, 2022, 11:42pm UTC](https://discourse.slicer.org/t/convert-csv-files-to-be-loadable-as-fiducials-or-as-sequence-of-fiducials-json/18320/5 "2022-05-20T23:42:15Z")

</div>

Sorry, the that was just a typo (I’ve fixed it now).

Use column names that match the coordinate system axis names.
