RAS Coordinate system != World Coordinate system?

Operating system: window 10
Slicer version: 5.2.1

Hi, I have a question about coordinate systems.

After some experimentation, I found out that the direction of the x,y axis in the WCS( world coordinate system) and the direction of the x,y axis of the 3D slicer are opposite. What is the reason for this?

( In right fig ) F-1 : [0,0,0] , F_1-1 : [100,0,0] , F_3-1 : [ 0, 100, 0] , F_4-1 : [0, 0, 100]

@lassoan

DICOM and most medical imaging software uses the LPS coordinate system for storing all data. Axis directions of this coordinate system are patient left, posterior, and superior. Unit is millimeters. There is no universal standard for choice of origin, but it is often some geometric center of the imaging system or chosen to be near the center of some object of interest.

RAS coordinate system is almost the same as the LPS coordinate system, except the axis directions are patient right, anterior, superior, i.e., the sign of the first two coordinates is inverted. This coordinate system was still popular in the early 2000s when development of Slicer was started, especially in neuroimaging software, therefore Slicer developers chose to use the RAS coordinate system.

Slicer still uses RAS coordinate system for storing coordinate values internally for all data types, but for compatibility with other software, it assumes that all data in files are stored in LPS coordinate system (unless the coordinate system in the file is explicitly stated to be RAS). To achieve this, whenever Slicer reads or writes a file, it may need to flip the sign of the first two coordinate axes to convert the data to RAS coordinate system.

You can either keep using RAS coordinate system in your files and specify that in the file header, or switch to use LPS coordinate system.

1 Like

When I opened a point ([x,y,z]) and mesh in 3d slicer, the point was close to the mesh in other tools, but there was a phenomenon that it was far away in 3d slicer.

I understand everything you said if you mean that all the metadata you worked on without using the slicer will be displayed in the LPS coordinate system in the 3d slicer. ( double check )

If you don’t specify coordinate system in a file (mesh, markup, image, …) then Slicer will assume it is in LPS and so the sign of the first two coordinates will be inverted during loading.

1 Like

What is the default option ?

if default option == RAS coordinate system ,

why did you add the RAS option in drop box ?

Slicer versions until a few years ago still used RAS coordinate system in mesh files. The RAS option allows loading them correctly in the current Slicer version.

@lassoan

What exactly does it mean that the slicer uses the RAS coordinate system?

Let’s assume that we are working on setting a focal point for a certain mesh target.

a) web_tool ( not a slicer ) : fp = [ -28, 4, 26]

b) slicer : fp = [ 28, -4 , 26]

According to you, the slicer follows the RAS coordinate system and the other external tools follow the LPS coordinate system (if no coordinates are specified).

However, I’m not sure why these a) and b) match exactly when rendering in vtk.
Also, if you want to map the coordinates of the focal point created by operation a) in the slicer to the mesh, you must select the RAS coordinate system when loading the mesh into the slicer so that it maps correctly to the mesh, and if you set default (LPS), they will not match.

Does the view of the slicer follow the RAS coordinate system, and is it saved as LPS when saving after work?

Exactly. The coordinate system is converted when reading/writing files.

Images and transforms are always saved in LPS coordinate system (this became de facto standard 10-20 years ago).

Models and markups are saved in LPS by default, too. You can force RAS in the saving options, but I would not recommend it, unless you need it for compatibility with some legacy software. (The option is there because Slicer started to transition to LPS coordinate system in these files relatively more recently, maybe about 5-10 years ago.)

@lassoan

I’m still curious about one thing.

You said that the slicer assumes that the work done by all ‘tools’ except the slicer is saved as an LPS coordinate system.

Load the following two files in the slicer. ( Mesh(MeshFromWeb), Markups(MarkupFromWeb) )

As both follow the LPS coordinate system, markups should exist on the mesh, but they do not.

To adjust the markup position, if the mesh is forcibly loaded into the RAS coordinate system, the markups will exist on the mesh.

If I didn’t force the RAS coordinate system when I saved ‘Mesh&Markups’ in Web, can you explain why this is happening?

The mesh data was loaded through the slicer and the coordinates of the markup node were written directly, so the x-axis and y-axis +,- sign conversion did not occur, so I’m sorry.