# In Slicer 5.4, where to check the reformatLogic's new method RotateSlice()'s parameters?

**URL:** <https://discourse.slicer.org/t/in-slicer-5-4-where-to-check-the-reformatlogics-new-method-rotateslice-s-parameters/33278>\
**Category:** Support\
**Tags:** python\
**Created:** [December 7, 2023, 5:50am UTC](https://discourse.slicer.org/t/in-slicer-5-4-where-to-check-the-reformatlogics-new-method-rotateslice-s-parameters/33278 "2023-12-07T05:50:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![derekcbr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/derekcbr/32/18793_2.png) [@derekcbr](https://discourse.slicer.org/u/derekcbr)\
**Post date:** [December 7, 2023, 5:50am UTC](https://discourse.slicer.org/t/in-slicer-5-4-where-to-check-the-reformatlogics-new-method-rotateslice-s-parameters/33278/1 "2023-12-07T05:50:17Z")

</div>

reformatLogic = slicer.modules.reformat.logic()  
Is there a way to find out the function parameters of RotateSlice()?

---

<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:** [December 7, 2023, 12:33pm UTC](https://discourse.slicer.org/t/in-slicer-5-4-where-to-check-the-reformatlogics-new-method-rotateslice-s-parameters/33278/2 "2023-12-07T12:33:18Z")

</div>

```auto

>>> help(reformatLogic.RotateSlice)
Help on built-in function RotateSlice:

RotateSlice(...) method of vtkSlicerReformatModuleLogicPython.vtkSlicerReformatLogic instance
    RotateSlice(node:vtkMRMLSliceNode, axisIndex:int,
        rotationAngleDeg:float) -> None
    C++: static void RotateSlice(vtkMRMLSliceNode *node,
        int axisIndex, double rotationAngleDeg)
    
    Rotate slice along an axis (0 = horizontal, 1 = vertical, 2 =
    slice normal) Flip: axisIndex = 0 (vertical) or 1 (horizontal),
    rotationAngleDeg = 180. In-plane rotation: axisIndex = 2,
    rotationAngleDeg > 0 for clockwise.

```

---

<div class="post-metadata">

**Author:** ![derekcbr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/derekcbr/32/18793_2.png) [@derekcbr](https://discourse.slicer.org/u/derekcbr)\
**Post date:** [December 8, 2023, 10:57am UTC](https://discourse.slicer.org/t/in-slicer-5-4-where-to-check-the-reformatlogics-new-method-rotateslice-s-parameters/33278/3 "2023-12-08T10:57:41Z")

</div>

Thanks for the help. If I have calcualte the rotation from a matrix, how to calcualte the rotation?  
matrix\_4x4 = np.array([  
[0.707, 0.0, 0.707, 0.2],  
[0.707, 0,-0.707, 0.3],  
[0, 1, 0.0, 0.4],  
[0, 0, 0, 1]  
])  
sy = math.sqrt(R[0,0] \* R[0,0] + R[1,0] \* R[1,0])  
singular = sy \< 1e-6  
if not singular :  
x = math.atan2(R[2,1] , R[2,2])  
y = math.atan2(-R[2,0], sy)  
z = math.atan2(R[1,0], R[0,0])  
else :  
x = math.atan2(-R[1,2], R[1,1])  
y = math.atan2(-R[2,0], sy)  
z = 0  
But it seems that it is not working. Does Slicer have a quaternion method to calcuatle the rotation? Thanks!
