# Markups Plane rotation

**URL:** <https://discourse.slicer.org/t/markups-plane-rotation/34564>\
**Category:** Support\
**Created:** [February 27, 2024, 9:46am UTC](https://discourse.slicer.org/t/markups-plane-rotation/34564 "2024-02-27T09:46:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![soukup.la](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/soukup.la/32/17954_2.png) [@soukup.la](https://discourse.slicer.org/u/soukup.la)\
**Post date:** [February 27, 2024, 9:46am UTC](https://discourse.slicer.org/t/markups-plane-rotation/34564/1 "2024-02-27T09:46:50Z")

</div>

Hello,  
is it possible to rotate a markups plane around its axes?

best regards  
Ladislav

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [February 27, 2024, 11:28am UTC](https://discourse.slicer.org/t/markups-plane-rotation/34564/2 "2024-02-27T11:28:14Z")

</div>

Hello @soukup.la. Yes, it is possible. If you right-click in one of the plane points you can enable the rotations in the `Interaction options --> Rotate` option.

---

<div class="post-metadata">

**Author:** ![soukup.la](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/soukup.la/32/17954_2.png) [@soukup.la](https://discourse.slicer.org/u/soukup.la)\
**Post date:** [February 27, 2024, 11:33am UTC](https://discourse.slicer.org/t/markups-plane-rotation/34564/3 "2024-02-27T11:33:18Z")

</div>

Great! Is it possible to make it somehow using Python code?

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [February 27, 2024, 12:39pm UTC](https://discourse.slicer.org/t/markups-plane-rotation/34564/4 "2024-02-27T12:39:18Z")

</div>

I guess you can always retrieve the points of the plane, do the transforms you need to them and set the new coordinates to the plane markup in Python. I’m not sure on whether the functionality of the rotation widget is exposed in Python for an easier solutio. Perhaps @Sunderlandkyl knows about this?

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [February 27, 2024, 2:40pm UTC](https://discourse.slicer.org/t/markups-plane-rotation/34564/5 "2024-02-27T14:40:30Z")

</div>

Yeah, you can enable the rotation handles with SetRotationHandleVisibility:

```auto
planeNode.GetDisplayNode().SetRotationHandleVisibility(True)

```

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [February 27, 2024, 2:57pm UTC](https://discourse.slicer.org/t/markups-plane-rotation/34564/6 "2024-02-27T14:57:28Z")

</div>

I think @soukup.la probably meant to do the rotation directly in python without the markups widgets? Are there any functions in the logic driving these rotations? Thanks for the quick reaction @Sunderlandkyl

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [February 27, 2024, 3:11pm UTC](https://discourse.slicer.org/t/markups-plane-rotation/34564/7 "2024-02-27T15:11:40Z")

</div>

No, there isn’t a logic function for calculating those rotations.

The easiest might be to get the axes with vtkMRMLMarkupsPlaneNode::GetAxes/GetAxesWorld and then use vtkTransform::RotateWXYZ to calculate the rotation around a specific axis.

After that you can just apply the transform with planeNode.ApplyTransform().

---

<div class="post-metadata">

**Author:** ![soukup.la](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/soukup.la/32/17954_2.png) [@soukup.la](https://discourse.slicer.org/u/soukup.la)\
**Post date:** [February 28, 2024, 8:43am UTC](https://discourse.slicer.org/t/markups-plane-rotation/34564/8 "2024-02-28T08:43:42Z")

</div>

Thank you very much!
