# DICOM and VTK file orientation Issue

**URL:** <https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717>\
**Category:** Development\
**Created:** [July 19, 2017, 12:23pm UTC](https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717 "2017-07-19T12:23:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kanampalli\_himaja](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kanampalli_himaja/32/13842_2.png) [@kanampalli\_himaja](https://discourse.slicer.org/u/kanampalli_himaja)\
**Post date:** [July 19, 2017, 12:23pm UTC](https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717/1 "2017-07-19T12:23:42Z")

</div>

I am trying to load nrrd as AXIAL, CORONAL, SAGITAL view and VTK file outside of the Slicer but the orientation is not matching as in slicer 3d Conventional view if we enable all three AXIAL, Sagital, and CORONAL views. There is some mismatch is there. Let me know how to solve this.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 19, 2017, 12:37pm UTC](https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717/2 "2017-07-19T12:37:11Z")

</div>

Probably the external code needs to take into account the coordinate systems:

[https://www.slicer.org/wiki/Coordinate\_systems](https://www.slicer.org/wiki/Coordinate_systems)

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [July 19, 2017, 3:36pm UTC](https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717/3 "2017-07-19T15:36:46Z")

</div>

A similar question came up in another context - does anyone know if there is a surface mesh format (other than DICOM!) that can specify the coordinate system?

---

<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:** [July 20, 2017, 1:24am UTC](https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717/4 "2017-07-20T01:24:24Z")

</div>

STL, PLY, VTK, VTP could all store the coordinate system (anatomical orientation), but there is no standard or commonly followed practice.  
[MetaIO](https://itk.org/Wiki/MetaIO/Documentation) (supported by ITK, VTK, etc.) can store surface mesh (MetaSurface object) and anatomical orientation in a standard way, but this file format is rarely used for mesh storage.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [July 20, 2017, 2:24am UTC](https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717/5 "2017-07-20T02:24:31Z")

</div>

Thanks, I will forward this info to Christian Bauer who asked this question to me.

---

<div class="post-metadata">

**Author:** ![kanampalli\_himaja](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kanampalli_himaja/32/13842_2.png) [@kanampalli\_himaja](https://discourse.slicer.org/u/kanampalli_himaja)\
**Post date:** [July 20, 2017, 6:19am UTC](https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717/6 "2017-07-20T06:19:42Z")

</div>

Hi Pieper, Andrey Fedorov, Andras Lasso,

I have gone through this link : [https://www.slicer.org/wiki/](https://www.slicer.org/wiki/)  
Coordinate\_systems but I am unable to find out how to make vtk model to  
load exactly on the bone structure on Slices(Axial,Sagital,Coronal) from  
backend without any adjustments from UI. Only in some cases it is matching  
because the bone structure is exactly at origin of the slice . If the bone  
structure is some where else like shifted to left or right or top/bottom,  
in these cases mismatch is there.

Able to read nrrd and get these details: (Letme know if we can use these  
details to load vtk model)  
type: int  
dimension: 3  
space: left-posterior-superior  
sizes: 512 512 182  
space directions: (0.41406199999999999,0,0) (0,0.41406199999999999,0)  
(0,0,0.625)  
kinds: domain domain domain  
endian: little  
encoding: gzip  
space origin: (-105.99999999999999,-127.30000305175778,-53.499999999999986)

It looks totally new for me , that’s why I am unable to findout. Can you  
please help me to sort out this?

---

<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:** [July 20, 2017, 1:04pm UTC](https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717/7 "2017-07-20T13:04:17Z")

</div>

Most common issue is LPS/RAS coordinate system mismatch. So, may try to convert your data from LPS to RAS coordinate system by transforming it using Transforms module by a matrix that has [-1,-1,1,1] in the diagonal:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/9/b9faa9c7ce7284e3e97ef74d293d629977ec889f.png)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 20, 2017, 1:04pm UTC](https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717/8 "2017-07-20T13:04:23Z")

</div>

Hi -

The patient coordinate system (RAS in Slicer’s case) provides a frame of reference for the data. When you have the data in Slicer you can explore this with the Data Probe. Exported VTK models will be in this space with the vertices expressed in mm. The nrrd header also tells how the volume data is positioned, scaled, and oriented in this space.

If the external code is using something like the pixel space of the image as the reference coordinate system, then you would need to apply the inverse of the volume’s transform to the vertices of the model.

HTH,  
Steve

---

<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:** [July 20, 2017, 2:27pm UTC](https://discourse.slicer.org/t/dicom-and-vtk-file-orientation-issue/717/9 "2017-07-20T14:27:33Z")

</div>

A post was split to a new topic: [Specifying coordinate system in surface mesh file](https://discourse.slicer.org/t/specifying-coordinate-system-in-surface-mesh-file/724)
