# Why per-frame transforms stored in .seq.mhd files are not converted from LPS to RAS?

**URL:** <https://discourse.slicer.org/t/why-per-frame-transforms-stored-in-seq-mhd-files-are-not-converted-from-lps-to-ras/16045>\
**Category:** Support\
**Tags:** surgical-navigation\
**Created:** [February 17, 2021, 11:32pm UTC](https://discourse.slicer.org/t/why-per-frame-transforms-stored-in-seq-mhd-files-are-not-converted-from-lps-to-ras/16045 "2021-02-17T23:32:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathanbmnt](https://avatars.discourse-cdn.com/v4/letter/n/a9adbd/32.png) [@nathanbmnt](https://discourse.slicer.org/u/nathanbmnt)\
**Post date:** [February 17, 2021, 11:32pm UTC](https://discourse.slicer.org/t/why-per-frame-transforms-stored-in-seq-mhd-files-are-not-converted-from-lps-to-ras/16045/1 "2021-02-17T23:32:18Z")

</div>

When I load a .seq.mhd file, the IJKtoRAS matrix is unity:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/c/6ca50cf5fb9236bbadccb9a5d5cc46b316ae51e6.png)

I would expect the IJKtoRAS matrix to have -1 and -1 as the first two diagonal values from the top, because .mhd volumes are always in LPS coordinates. This is how non-sequence .mha’s load:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/c/fccaa8c80a570782f55341df9eb4b77fcbc92325.png)

`ElementSpacing` is positive on both of these files.

---

<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:** [February 17, 2021, 11:41pm UTC](https://discourse.slicer.org/t/why-per-frame-transforms-stored-in-seq-mhd-files-are-not-converted-from-lps-to-ras/16045/2 "2021-02-17T23:41:39Z")

</div>

Seq.mhd file stores per-frame transforms to specify image geometry (origin, spacing, axis directions) for each frame.

If you want to have store a 3D image sequence where all 3D images have the same geometry, which is specified in standard fields then you need to use nrrd file format. We switched to nrrd from mha format because does not have clear definition of image dimensions (which axis means what).

---

<div class="post-metadata">

**Author:** ![nathanbmnt](https://avatars.discourse-cdn.com/v4/letter/n/a9adbd/32.png) [@nathanbmnt](https://discourse.slicer.org/u/nathanbmnt)\
**Post date:** [February 18, 2021, 5:21am UTC](https://discourse.slicer.org/t/why-per-frame-transforms-stored-in-seq-mhd-files-are-not-converted-from-lps-to-ras/16045/3 "2021-02-18T05:21:26Z")

</div>

Each frame transform is unity in my .seq.mhd though, so shouldn’t the image data still be treated as LPS?

---

<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:** [February 18, 2021, 1:12pm UTC](https://discourse.slicer.org/t/why-per-frame-transforms-stored-in-seq-mhd-files-are-not-converted-from-lps-to-ras/16045/4 "2021-02-18T13:12:43Z")

</div>

seq.mhd can store many transforms for each frame, each has a name, so you know exactly what coordinate systems it transforms between. There is no such assumptions like “world coordinate is LPS”, so there is nothing that the reader would need to modify when loading. It is up to you to name and interpret the transforms correctly.

The best the SlicerIGT importer could do is to detect …ToLPS and LPSTo… transforms and convert them to …ToRAS and RASTo… transforms but this would cause more problems than it would solve. If you want to have transforms to/from RAS coordinate system then you can either add them to the file when you create it; or you can add a diag([-1,-1,1,1]) transform in the transform hierarchy in Slicer to convert between LPS and RAS.

Since the patient-attached Reference marker typically does not move relative to the patient, we usually store all transforms relative to the Reference and compute and store ReferenceToRAS in Slicer.
