# Converting fiducial coordinates from RAS to LPS

**URL:** <https://discourse.slicer.org/t/converting-fiducial-coordinates-from-ras-to-lps/9707>\
**Category:** Support\
**Tags:** transforms, coordinates, markups-fiducials\
**Created:** [January 3, 2020, 9:06pm UTC](https://discourse.slicer.org/t/converting-fiducial-coordinates-from-ras-to-lps/9707 "2020-01-03T21:06:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt-warkentin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/matt-warkentin/32/4962_2.png) [@matt-warkentin](https://discourse.slicer.org/u/matt-warkentin)\
**Post date:** [January 3, 2020, 9:06pm UTC](https://discourse.slicer.org/t/converting-fiducial-coordinates-from-ras-to-lps/9707/1 "2020-01-03T21:06:31Z")

</div>

Hi,

I am working with some chest CT scans and I have some `fiducials` which denote the 3D centre of a tumour mass. I have saved/exported the `fiducials` from Slicer as `.fcsv` files.

I have done some searching online but I am not entirely sure how to convert the `fiducial` coordinates (in mm) from `RAS` to `LPS` using `Slicer` (assuming its possibile). Hoping someone can point me in the right direction.

Also, if anyone here has any general resources they could point me towards to better understand RAS to LPS (and vice versa) geometric transformations, that would be greatly appreciated. Always looking to better understand these concepts.

Thanks,  
Matt

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [January 3, 2020, 9:20pm UTC](https://discourse.slicer.org/t/converting-fiducial-coordinates-from-ras-to-lps/9707/2 "2020-01-03T21:20:38Z")

</div>

This documentation should help get you started: [https://www.slicer.org/wiki/Coordinate\_systems](https://www.slicer.org/wiki/Coordinate_systems)

How do you plan to use the fcsv files?

---

<div class="post-metadata">

**Author:** ![matt-warkentin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/matt-warkentin/32/4962_2.png) [@matt-warkentin](https://discourse.slicer.org/u/matt-warkentin)\
**Post date:** [January 3, 2020, 9:24pm UTC](https://discourse.slicer.org/t/converting-fiducial-coordinates-from-ras-to-lps/9707/3 "2020-01-03T21:24:44Z")

</div>

Thanks for sharing @pieper. The motivating example is that I have been given fiducials (as `.fcsv` files) from a radiological colleague where they have denoted the centre of the tumour masses across many CT scans. I was then trying to use `plastimatch crop` to extract an image subregion surrounding the tumour centroid. It is my understanding that `plastimatch` uses `ITK` which is LPS orientation, meanwhile my fiducials are RAS.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [January 3, 2020, 10:07pm UTC](https://discourse.slicer.org/t/converting-fiducial-coordinates-from-ras-to-lps/9707/4 "2020-01-03T22:07:49Z")

</div>

Okay, good, makes sense. Then probably the documentation I referenced should be what you need.

---

<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:** [January 3, 2020, 10:17pm UTC](https://discourse.slicer.org/t/converting-fiducial-coordinates-from-ras-to-lps/9707/5 "2020-01-03T22:17:29Z")

</div>

LPS\<-\>RAS conversion is just inverting the sign of the first two coordinates. You can use either LPS or RAS when you store the coordinate values in csv (fcsv) file.

---

<div class="post-metadata">

**Author:** ![matt-warkentin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/matt-warkentin/32/4962_2.png) [@matt-warkentin](https://discourse.slicer.org/u/matt-warkentin)\
**Post date:** [January 3, 2020, 10:22pm UTC](https://discourse.slicer.org/t/converting-fiducial-coordinates-from-ras-to-lps/9707/6 "2020-01-03T22:22:03Z")

</div>

Thanks to both of you. I thought this to be true, but I am glad you confirmed this.

If I already have a long list of RAS fiducials in `.fcsv`, it is probably just easiest to do the conversion “by-hand” with `R` or `Python`, for example? Just flip the signs of the `x` and `y` value in the fidicuals file.

---

<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:** [January 4, 2020, 12:37am UTC](https://discourse.slicer.org/t/converting-fiducial-coordinates-from-ras-to-lps/9707/7 "2020-01-04T00:37:38Z")

</div>

If you specify LPS coordinate system in the fcsv file header then the LPS-\>RAS conversion is done automatically when you load the file (but of course it is very simple to do the conversion in any software).

By default, fcsv header uses `# CoordinateSystem = 0`, which means RAS. If you change this to `# CoordinateSystem = 1` then coordinate values are interpreted as LPS.

This header indicates that coordinates are defined in LPS:

```auto
# Markups fiducial file version = 4.11
# CoordinateSystem = 1
# columns = id,x,y,z,ow,ox,oy,oz,vis,sel,lock,label,desc,associatedNodeID
1,22.30452734727109,31.445727079759223,0,0,0,0,1,1,1,0,F-1,,
...

```

Probably we’ll replace magic numbers (0 and 1) by coordinate system names (RAS and LPS) in future versions of these csv files.
