# Set Image Direction from numpy array

**URL:** <https://discourse.itk.org/t/set-image-direction-from-numpy-array/844>\
**Category:** Beginner Questions\
**Tags:** python\
**Created:** [April 18, 2018, 9:47am UTC](https://discourse.itk.org/t/set-image-direction-from-numpy-array/844 "2018-04-18T09:47:06Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)\
**Post date:** [June 22, 2018, 3:50pm UTC](https://discourse.itk.org/t/set-image-direction-from-numpy-array/844/11 "2018-06-22T15:50:10Z")

</div>

Thanks. Actually, I had wrapped new itk::Matrix templates but I had not wrapped the corresponding vnl\_matrix\_fixed. Now that this is fixed, I can easily change the values using (here with a matrix wrapped by default),

> \>\>\> import itk  
> \>\>\> m = itk.Matrix[itk.D,3,3]()  
> \>\>\> print(m(2,1))  
> 0.0  
> \>\>\> m.GetVnlMatrix().put(2,1,3.14)  
> \>\>\> print(m(2,1))  
> 3.14

---

_[View the full topic](https://discourse.itk.org/t/set-image-direction-from-numpy-array/844)._
