I have a question about coordinates that I am having trouble figuring out the answer to. The coordinate systems page makes it look like the origin of an image in world space is the center of the first voxel (so that the IJK’s [0,0,0] is also the image world location [0,0,0] in mm. In that case, when converting the world coordinates between RAS and LPS, it seems like the world origin will shift by the RL size of the image minus the RL size of one voxel, and the same for the AP axis, while the SI coordinate of the origin will not change. Is this correct? Another alternative convention I think I have seen elsewhere is that the origin is located at the outsize corner of the image volume, in which case an RAS to LPS origin shift would be the full image dimension, with no voxel offset. I am trying to understand how Slicer handles these things because I am working with images in multiple programs and the coordinate systems and how they are handled do not seem to be the same between them, so I need to understand the details to make sure I handle passing data and transforms between them correctly. Thanks for any help you can provide.
For Slicer (and DICOM and ITK) the origin is the center of the voxel yes, and it doesn’t move when you choose to describe it in either LPS or RAS coordinates. In this way, the origin is just a point in space independent of anything to do with the voxels.
https://www.slicer.org/wiki/Coordinate_systems
Unfortunately yes, when you work with transforms generated by different systems you need to pay careful attention to how they define these conventions. If it’s not clearly documented then a good thing is often to work through simple examples to empirically how the coordinates are defined.
You can verify coordinates in Slicer by disabling image interpolation, zooming in, enabling slice intersections, and observe reported coordinate values. You can move slice intersections by holding down Shift key while moving the mouse.
Thanks Steve. How does Slicer handle assigning the origin to an imported image, though? When I load an Analyze file (.hdr, .img) and Slicer reports that the volume has it’s origin at 0,0,0 mm, it is zero mm from where? That’s where I thought the LPS vs RAS coordinate system would make a difference in the origin, where the origin would be a the most right, most anterior, most inferior voxel center for an LPS image and at the most left, most posterior, most inferior voxel center for an RAS image. I realize that DICOM images probably have the origin set independently of the voxels, but I didn’t know if the same were true of Analyze files.
Thanks Andras, that will be very helpful!
It is defined in physical coordinate system. Depending on on the file format, it may be LPS (this is the most common) or some coordinate system as specified in the file header.
It is usually unspecified (up to the operator of the imaging equipment) where exactly the origin is. Axes directions are also usually just approximately aligned to patient anatomical axes.
In DICOM, the frame of reference is tagged by a unique identifier, so you know which images share the same coordinate system and you can define transforms between them.