Operating system: Windows
Slicer version: 4.11.20210226
Expected behavior: A model should be loaded into a consistent coordinate system
Actual behavior: When I load some models, it appears to interpret the vertices as being in the RAS coordinate system. And for other models, it appears to use the world coordinates.
For example,
I have .vtu file. I load it up into 3d slicer. The x and y coordinates of all the vertices are flipped. I assume this is because the application is interpretting the vertex values to be in the RAS coordinates. No problem, I just apply a transformation [[-1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,0,0,1]] and all is fine!
However, i have a .ply model too. When I load this model the application uses the actual coordinates of the vertices and it does not appear to be loaded in the RAS coordinate system, so I dont have to apply the transformation above to this model.
Why is there an inconsistency here?
How can I control which coordinate system a model’s vertices are interpreted to be in?
If you know the model’s coordinate system, when loading expand the dialog box and specify whether it is LPS or RAS and your model should be imported correctly.
Thank you for the reply. I noticed this dialogue box, and I tested it by importing the same model twice but with the different options (LPS and RAS) chosen. There was no difference (and my model is definitely not symmetric about the x and y axes!)
Confirmed. The file must have been corrupted somehow. I loaded it up in paraview, and exported it to a new .ply file, and then tried it in slicer, and it works!
My last question on this topic, is how do I do this programtically in python when i load a model?
I cannot seem to locate it by following the python code.
I’m wondering if it is even possible.
I noticed this noted in one of the files:
/// Coordinate system options
/// LPS coordinate system is used the most commonly in medical image computing.
/// Slicer is moving towards using this coordinate system in all files by default
/// (while keep using RAS coordinate system internally).
/// RAS coordinate system is used in Slicer internally. For many years, Slicer used
/// this coordinate system in files that it created, too.
enum
{
CoordinateSystemRAS = 0,
RAS = 0, ///< for backward compatibility
CoordinateSystemLPS = 1,
LPS = 1, ///< for backward compatibility
CoordinateSystemType_Last
};
The property is called “coordinateSystem” and the correct value is the integer 0 (for RAS) or 1 (for LPS). For these you could also use a more descriptively named enum.