# Rotation Around a Specified Axis

**URL:** <https://discourse.itk.org/t/rotation-around-a-specified-axis/1875>\
**Category:** Uncategorized\
**Created:** [May 13, 2019, 4:51pm UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875 "2019-05-13T16:51:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![DrJessop](https://discourse.itk.org/user_avatar/discourse.itk.org/drjessop/32/758_2.png) [@DrJessop](https://discourse.itk.org/u/DrJessop)\
**Post date:** [May 13, 2019, 4:51pm UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875/1 "2019-05-13T16:51:01Z")

</div>

I am trying to rotate an MRI image around the z-axis by 90 degrees. I can specify the center of rotation using an Euler3DTransform, however I cannot specify the direction of rotation (the image is diagonally rotated). How can I achieve this? Thank you.

---

<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 13, 2019, 5:02pm UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875/2 "2019-05-13T17:02:49Z")

</div>

Hello Dr. Jessop,

Welcome to the ITK community!

One option is to call [`SetRotation`](https://itk.org/Doxygen/html/classitk_1_1Euler3DTransform.html#a90ee97995f5b16c8967419042ad79132) on the transform.

If you do not wish to resample the image, call [`SetDirection`](https://itk.org/Doxygen/html/classitk_1_1ImageBase.html#a23ebc76de3b60bb1eeabf66cd4dabc48) on the `Image` or use the [`ChangeImageInformationImageFilter`](https://itk.org/Doxygen/html/classitk_1_1ChangeInformationImageFilter.html).

Matt

---

<div class="post-metadata">

**Author:** ![DrJessop](https://discourse.itk.org/user_avatar/discourse.itk.org/drjessop/32/758_2.png) [@DrJessop](https://discourse.itk.org/u/DrJessop)\
**Post date:** [May 13, 2019, 6:14pm UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875/3 "2019-05-13T18:14:55Z")

</div>

> [@matt.mccormick](#):
>
> Hello Dr. Jessop,

Hello, to be more specific, my image is rotated as so, and when I specify my SetRotation, I want the axes to be normal to all planes of the image. I believe the default behaviour of the axes to be like in the drawing I attached. Thank you.  
Andrew

 ![image](https://discourse.itk.org/uploads/default/original/1X/dce97c6de8992a59d7e7fc5049395bb609ea1dab.jpeg)

---

<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 13, 2019, 7:17pm UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875/4 "2019-05-13T19:17:05Z")

</div>

Thank you for the drawing. I am not sure, though, what other information is required.

---

<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 16, 2019, 3:23pm UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875/5 "2019-05-16T15:23:09Z")

</div>

This seems to be a better description of the problem:

> <https://stackoverflow.com/questions/56171643/simpleitk-rotation-of-mri-image>

---

<div class="post-metadata">

**Author:** ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)\
**Post date:** [May 16, 2019, 7:39pm UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875/6 "2019-05-16T19:39:54Z")

</div>

Indeed, problem description there was clearer. I posted an answer there with a pointer back to this discussion.

---

<div class="post-metadata">

**Author:** ![DrJessop](https://discourse.itk.org/user_avatar/discourse.itk.org/drjessop/32/758_2.png) [@DrJessop](https://discourse.itk.org/u/DrJessop)\
**Post date:** [May 16, 2019, 8:54pm UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875/7 "2019-05-16T20:54:10Z")

</div>

Thanks again for your help, I posted a full solution based off of your feedback there.

---

<div class="post-metadata">

**Author:** ![MMdeB](https://discourse.itk.org/user_avatar/discourse.itk.org/mmdeb/32/2238_2.png) [@MMdeB](https://discourse.itk.org/u/MMdeB)\
**Post date:** [August 30, 2021, 7:13am UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875/8 "2021-08-30T07:13:44Z")

</div>

The solution provided on stackoverflow seems to only rotate along the z-axis. If I would want to rotate along both the x, y and z (using euler angles, so the axes are shifting) how would I need to approach this problem?

---

<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:** [August 30, 2021, 12:52pm UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875/9 "2021-08-30T12:52:41Z")

</div>

If “use [Euler3DTransform](https://itk.org/Doxygen/html/classitk_1_1Euler3DTransform.html)” does not answer your question @MMdeB, please start a new thread and explain what you are trying to accomplish in more detail.

---

<div class="post-metadata">

**Author:** ![guo7212](https://discourse.itk.org/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@guo7212](https://discourse.itk.org/u/guo7212)\
**Post date:** [February 24, 2022, 1:43pm UTC](https://discourse.itk.org/t/rotation-around-a-specified-axis/1875/10 "2022-02-24T13:43:43Z")

</div>

I think it is itk::VersorTransform.
