# Non axis aligned orientation in real world data?

**URL:** https://discourse.itk.org/t/non-axis-aligned-orientation-in-real-world-data/6639
**Category:** Algorithms
**Tags:** dicom, nifti
**Created:** [May 18, 2024, 6:59pm UTC](https://discourse.itk.org/t/non-axis-aligned-orientation-in-real-world-data/6639 "2024-05-18T18:59:09Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Jakub\_Mitura](https://discourse.itk.org/user_avatar/discourse.itk.org/jakub_mitura/32/2406_2.png) [@Jakub\_Mitura](https://discourse.itk.org/u/Jakub_Mitura)
#### Post date: [May 18, 2024, 6:59pm UTC](https://discourse.itk.org/t/non-axis-aligned-orientation-in-real-world-data/6639/1 "2024-05-18T18:59:10Z")

</div>

Hello from your experience is it happening that direction cosine matrix is not axis aligned for studies like CT PET MRI . I mean when orientation is not RAS or LPS … can not be summarized in 3 letter code because it is oblique .  
I had looked into ITK code for changing orientation [1] and it seems to if I am not mistaken that it is working generally on permutation of axes and reversing axes only, what would confirm my hypothesis, but I am not sure.

> <https://github.com/InsightSoftwareConsortium/ITK/blob/311b7060ef39e371f3cd209ec135284ff5fde735/Modules/Filtering/ImageGrid/include/itkOrientImageFilter.h#L142>

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [May 19, 2024, 9:24pm UTC](https://discourse.itk.org/t/non-axis-aligned-orientation-in-real-world-data/6639/2 "2024-05-19T21:24:37Z")

</div>

Hello,

OrientImageFilter is for changing anatomical orientations.

For non-orthogonal slices, management and resampling with the [SliceSeriesSpecialCoordinatesImage](https://github.com/KitwareMedical/ITKUltrasound/blob/master/include/itkSliceSeriesSpecialCoordinatesImage.h) may be helpful.

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [May 20, 2024, 3:02pm UTC](https://discourse.itk.org/t/non-axis-aligned-orientation-in-real-world-data/6639/3 "2024-05-20T15:02:36Z")

</div>

Have you tried setting [`SetForceOrthogonalDirection(false)`](https://itk.org/Doxygen/html/classitk_1_1ImageSeriesReader.html#a0010020aa79587ec8d92a9332d36832b)?

---

<div class="post-metadata">

### Author: ![Jakub\_Mitura](https://discourse.itk.org/user_avatar/discourse.itk.org/jakub_mitura/32/2406_2.png) [@Jakub\_Mitura](https://discourse.itk.org/u/Jakub_Mitura)
#### Post date: [May 20, 2024, 5:10pm UTC](https://discourse.itk.org/t/non-axis-aligned-orientation-in-real-world-data/6639/4 "2024-05-20T17:10:30Z")

</div>

Thanks, Hovewer I suppose I did not phrased m question clearly i mainly thnking should i check for the cases where i have non axis aligned image that gets from a scanner; did you had such issues in some of your datasets?

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [May 20, 2024, 5:13pm UTC](https://discourse.itk.org/t/non-axis-aligned-orientation-in-real-world-data/6639/5 "2024-05-20T17:13:51Z")

</div>

You always have the option to resample the image to orthogonal grid, and possibly isotropic spacing. If you don’t plan to do a lot of processing on them, maybe it is fine leaving them non-orthogonal? [Slicer](https://www.slicer.org/) can correctly display such images.

---

<div class="post-metadata">

### Author: ![Jakub\_Mitura](https://discourse.itk.org/user_avatar/discourse.itk.org/jakub_mitura/32/2406_2.png) [@Jakub\_Mitura](https://discourse.itk.org/u/Jakub_Mitura)
#### Post date: [May 20, 2024, 5:25pm UTC](https://discourse.itk.org/t/non-axis-aligned-orientation-in-real-world-data/6639/6 "2024-05-20T17:25:38Z")

</div>

ok thanks !

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)
#### Post date: [May 21, 2024, 7:26pm UTC](https://discourse.itk.org/t/non-axis-aligned-orientation-in-real-world-data/6639/7 "2024-05-21T19:26:01Z")

</div>

An image is in RAS coordinate system if the _index to physical transform_ transforms image IJK coordinates to the RAS coordinate system. It does not matter if the direction matrix is just a permutation matrix or some arbitrary rotation matrix.

What you are probably wondering about is that if you work with images that are usually rotated (such as prostate MRI images) and you want to train a deep learning model with them, if you need to resample the voxel array so that the image is perfectly oriented in physical space. Based on the somewhat limited experience that I have in this, I would say that it is important to have all your images to have consistent order and direction of axes and approximately the same image spacing, but it may be fine to ignore an image orientation error of up to a few ten degrees (as the patient positioning may have some variation in orientation and deep learning models can also develop a tolerance for this). However, if you resample for a consistent image spacing anyway then you might consider taking into account the exact image orientation, too.
