title: 3D Image Rotation Simple ITK Python
body: <p>I'm trying to rotate a 3D-Image with Simple ITK.
  Here is my Code:
  <em>imagetoresize</em> is the original image. The size of the image is (512,512,149)</p>
  
  <pre><code>targetimage = imagetoresize
  origin = imagetoresize.GetOrigin()
  targetimage = imagetoresize
  imagetoresize.SetOrigin((0,0,0))
  transform = sitk.VersorTransform((0,0,1), np.pi)
  transform.SetCenter((256,256,74))
  outimage=sitk.Resample(imagetoresize,targetimage.GetSize(),transform,sitk.sitkLinear,[0,0,0], imagetoresize.GetSpacing(), imagetoresize.GetDirection())
  outimage.SetOrigin(origin)
  </code></pre>
  
  <p>The code rotates the image but the center is shifted.<br/><a href="https://i.stack.imgur.com/75W7G.jpg" rel="nofollow noreferrer">Orginal Image</a>
  <a href="https://i.stack.imgur.com/akTUo.jpg" rel="nofollow noreferrer">Image after rotate</a></p>
  
  <p>Can someone explain to me why the center is shifted?</p>
  
  <p>Any help will be much appreciated.</p>