Slice intersection source code

Hi all,
i would like to know if there is some possibility to control slice intersections manually ,i.e, without mouse control. I intend to set a 3D position (x,y,z) and then the slice intersection cursor automatically goes to the correspondent XY position in the axial, sagital and coronal planes.
Moreover, is there any source code regarding the slice intersection functionality?
Thanks for your attention!

Not sure what you mean, but does this help? You can turn on the intersection visibility and move the slice views around programatically (turn on slices is in the wiki):

def turn_on_slice_intersections():
    viewNodes = slicer.mrmlScene.GetNodesByClass('vtkMRMLSliceCompositeNode')
    viewNode = viewNodes.GetNextItemAsObject()
    while viewNode:
        viewNode = viewNodes.GetNextItemAsObject()

view_to_color = {'axial':'Red','coronal':'Green','sagittal':'Yellow'}

def get_current_slice(view):
    lm =
    color = lm.sliceWidget(view_to_color[view])
    colorLogic = color.sliceLogic()
    return colorLogic.GetSliceOffset() 
def set_current_slice(view, new_level):
    lm =
    color = lm.sliceWidget(view_to_color[view])
    colorLogic = color.sliceLogic()
    return True

I used to make the slice node go through a point. Hope it will help

def updateSliceViewBasedOnPoints(self, pos):
redSliceNode = slicer.mrmlScene.GetNodeByID(“vtkMRMLSliceNodeRed”)
matrixRedOri = redSliceNode.GetSliceToRAS()
matrixRedOri.SetElement(0, 3, pos[0])
matrixRedOri.SetElement(1, 3, pos[1])
matrixRedOri.SetElement(2, 3, pos[2])

Once you have the slice node you can call:

redSliceNode.JumpSliceByOffsetting(pos[0], pos[1], pos[2])

or you can use JumpSliceByCentering.

If you’re already using fiducials, you can use the Markups module logic to do this for all slices by calling JumpSlicesToLocation,