Proper use of vtkImageReslice?

I have a vtkImageData called img that I want to use the vtkImageReslice algorithm on.

I want to reslice this image data to create a subimage that has its voxels aligned to a different coordinate system.

To do this i am using the following code:

reslice = vtk.vtkImageReslice()
dims = get_subimg_dimensions()
reslice.SetOutputExtent(0, dims[0]-1, 0, dims[1]-1, 0, dims[2]-1)
transform = vtk.vtkTransform()
transform .SetMatrix(get_subimg_rotation_matrix4x4())
subimg = reslice.GetOutput()

Here, get_subimg_rotation_matrix4x4() just returns a rotation + translation matrix that defines the reslice axes, like:

  [cos(theta), -sin(theta), 0.0, origin_x],
  [sin(theta), cos(theta), 0.0, origin_y],
  [0.0, 0.0, 1.0, origin_z],
  [0.0, 0.0, 0.0, 1.0]

I’m confused because the subimg output does not have a direction matrix aligned with the ResliceAxes. And so when I visualize these images, they look as if their axes are aligned, even though ResliceAxes have been set to be rotated.

Can anyone post a working example of what I’m trying to accomplish?