How to rotate OrthogonalSlicesDeg in slices?

在插件中,我用Ctrl + Alt + Left-click-and-drag在不同的Slice里找到了一个合适vector, 我想移动这个vector, 想了很多方法都不理想, 其中包括:rotateOrthogonalSlicesDeg, 可是这个方法,只能在一个Slice里面旋转,当我改变Slice后,原来那个slice的角度就归零了…谁有好的方法帮我?

In my plug-in, I used Ctrl + Alt + Left-click-and-drag to find a suitable vector(include position and angle) from different slices. I wanted to move this vector’s position and keep its angle, I had try to some methods, but not ideal, for example: rotateOrthogonalSlicesDeg, but this method can only be rotated in a slice, when I change the angle in another slice, the angle of the previous slice reset…Who has a good way to help me?

@lassoan@Juicy@jamesobutler @jcfr @pieper

我的具体思路是: 通过Ctrl + Alt + Left-click-and-drag的方法, 找到一个矢量, 返回并保存这个矢量的位置和在三个slice(RAS) 角度, 利用rotateOrthogonalSlicesDeg 找回这个视图,

My specific idea is: Find a vector by Ctrl + Alt + Left-click-and-drag from slices, return and save the position of this vector and the angle of the three slices (RAS), use the rotateOrthogonalSlicesDeg to retrieve this vector views (sense) or move this vector’s position and succeed its angle…


  def orthoReset(PIP,nor,ax):

    RNode = slicer.mrmlScene.GetNodeByID("vtkMRMLSliceNodeRed")
    YNode = slicer.mrmlScene.GetNodeByID("vtkMRMLSliceNodeYellow")
    GNode = slicer.mrmlScene.GetNodeByID("vtkMRMLSliceNodeGreen")
    # Rslice
                             PIP[0], PIP[1], PIP[2], 0)

                             PIP[0], PIP[1], PIP[2], 0)

                             PIP[0], PIP[1], PIP[2], 0)
    return True

其中, ax和nor通过GetSliceToRAS获取,其中ax为第一列, nor为第三列,比如:

    axialSliceToRas = axialNode.GetSliceToRAS()
    axR = [
        axialSliceToRas.GetElement(0, 0),
        axialSliceToRas.GetElement(1, 0),
        axialSliceToRas.GetElement(2, 0),
    norR = [
        axialSliceToRas.GetElement(0, 2),
        axialSliceToRas.GetElement(1, 2),
        axialSliceToRas.GetElement(2, 2),
    x1 = [
        axialSliceToRas.GetElement(0, 3),
        axialSliceToRas.GetElement(1, 3),
        axialSliceToRas.GetElement(2, 3),