Python code controls the display of a certain layer of slices in the view

In the development of the 3D Slicer plug-in, I want to automatically display the corresponding slice on the Green view based on the serial number of the magnetic resonance image entered by the user (I don’t care about the images on the Red and Yellow views)
For example, I want to use python code to display the 0th magnetic resonance image in the view (I don’t know if this is the right description: coordinates_ijk[2]=0),

I already know

i2rasMatrix = vtk.vtkMatrix4x4()
origin = volumeNode.GetOrigin()
spacing = volumeNode.GetSpacing()

and I can use

greenSliceNode = slicer.mrmlScene.GetNodeByID("vtkMRMLSliceNodeGreen")

to control the position under Green view
However, executing the SetSliceOffset function requires knowing the value of AR (AR: 38.1683mm in the picture) (Is this reasoning correct?)
The obstacle I encountered was that I could not convert the number of magnetic resonance images and the value of AR.
Just knowing the value of AR for image 0 is completely enough for me