# Why sitk.GetDirection() is not the same with '0020|0037' ?

**URL:** <https://discourse.itk.org/t/why-sitk-getdirection-is-not-the-same-with-0020-0037/2755>\
**Category:** Uncategorized\
**Created:** [February 22, 2020, 8:26am UTC](https://discourse.itk.org/t/why-sitk-getdirection-is-not-the-same-with-0020-0037/2755 "2020-02-22T08:26:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhang-qiang-github](https://discourse.itk.org/user_avatar/discourse.itk.org/zhang-qiang-github/32/1183_2.png) [@zhang-qiang-github](https://discourse.itk.org/u/zhang-qiang-github)\
**Post date:** [February 22, 2020, 8:26am UTC](https://discourse.itk.org/t/why-sitk-getdirection-is-not-the-same-with-0020-0037/2755/1 "2020-02-22T08:26:06Z")

</div>

In my thought, I think both sitk.GetDirection() and ‘0020|0037’ indicate the patient orientation. However, I find they are different.

Firstly, I get the direction:

```auto
>>> sitkImage = sitk.ReadImage('IM_0177')
>>> sitkImage.GetDirection()

```

and the result is:

```auto
(0.9992892857549484, -0.01732918031560729, -0.03347570589180272, 0.017049019173889606, 0.9998173542043812, -0.008636502588384802, 0.03361925520551655, 0.008059636551358978, 0.9994022152957668)

```

Then, I obtain the ‘0020|0037’ tag:

```auto
>>> reader = sitk.ImageFileReader()
>>> reader.SetFileName('IM_0177')
>>> reader.LoadPrivateTagsOn()
>>> reader.ReadImageInformation()
>>> reader.GetMetaData('0020|0037')

```

and the result is:

```auto
'0.99928927421569\\0.01704902015626\\0.03361925482749\\-0.0173291806131\\0.9998173713684\\0.00805963668972'

```

Why they are different?  
for x[0]: 0.9992892857549484 vs 0.99928927421569??

---

<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:** [February 22, 2020, 9:18pm UTC](https://discourse.itk.org/t/why-sitk-getdirection-is-not-the-same-with-0020-0037/2755/2 "2020-02-22T21:18:44Z")

</div>

Image importers can choose direction of voxel coordinate system axes arbitrarily (for example, directions can be chosen si that voxels do not have to be reordered in memory after reading from files). Since all image processing operations happen in physical space, it typically does not matter what the voxel coordinate system is.

---

<div class="post-metadata">

**Author:** ![zhang-qiang-github](https://discourse.itk.org/user_avatar/discourse.itk.org/zhang-qiang-github/32/1183_2.png) [@zhang-qiang-github](https://discourse.itk.org/u/zhang-qiang-github)\
**Post date:** [February 23, 2020, 1:46am UTC](https://discourse.itk.org/t/why-sitk-getdirection-is-not-the-same-with-0020-0037/2755/3 "2020-02-23T01:46:19Z")

</div>

But, what if I want the voxel coordiante system? How can I get the direction which is the same from the ‘0020|0037’? Do I must use reader.GetMetaData?

---

<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:** [February 23, 2020, 2:04am UTC](https://discourse.itk.org/t/why-sitk-getdirection-is-not-the-same-with-0020-0037/2755/4 "2020-02-23T02:04:28Z")

</div>

> [@zhang-qiang-github](#):
>
> But, what if I want the voxel coordiante system?

Why would you like to know value of image position/orientation patient tags? Would you like to handle missing slices, varying slice spacing, or non-Cartesian (e.g., tilted-gantry) images?

> [@zhang-qiang-github](#):
>
> Do I must use reader.GetMetaData?

Yes, if the field is available as metadata then you can use that. If the reader does not provide you this field (e.g., because the series is stored in enhanced multi-frame format, which contains image position/orientation patient in a sequence field) then you may need to go back to the original DICOM files and read the tags using pydicom.
