Thanks Mike very very much for this code!
I haven’t seen your method but otherwise found this:
I think this Get/Set method is what you mean?
So I have completed this code as follows:
suffix = 0
startingRoiCenter = np.array([0,0,-19.95])
for centerSuperiorOffset in np.arange(0,40,0.1):
newRoiCenter = startingRoiCenter + np.array([0, 0, centerSuperiorOffset])
roi.SetXYZ(newRoiCenter)
take_one_screen_shot(suffix)
suffix+=1
# Capture RGBA image
def take_one_screen_shot(suffix):
renderWindow = view.renderWindow()
renderWindow.SetAlphaBitPlanes(1)
wti = vtk.vtkWindowToImageFilter()
wti.SetInputBufferTypeToRGBA()
wti.SetInput(renderWindow)
writer = vtk.vtkPNGWriter()
writer.SetFileName("c:/tmp/screen_shot"+str(suffix)+".png")
writer.SetInputConnection(wti.GetOutputPort())
writer.Write()
yeah,thanks for you,I did this slice thing along I-S range from -20 to +20 with step 0.1.
However I still got a quesiton maybe you can help me again, I will be very grateful.
I set the startingRoiCenter as follows:
startingRoiCenter = np.array([0,0,-19.95])
-19.95 as a center and it gives both left range and right range 0.05,so the begining range is from -20 to -19.90.
run the code above and produced below:
I noticed the center is giving both sides 0.05mm,so it is 0.1mm between left and right.Is this number fixed?For example,say,I want to have a slice with
0.15mm not 0.1mm from -20 to +20 along I-S orientation,how to set up the iteration?
Thank you for your help again,it does help a lot!