help in applying rotation using Affinematrix

I am using this AffineMatrix to rotate the image by 90 degrees.
array([[ 1., 0., 0., 0.],
[ 0., 0., -1., 0.],
[ 0., 1., 0., 0.],
[ 0., 0., 0., 1.]])

When I apply this transformation to image(left is the original one and the right is the result of transformation), I am getting this output.

What I was expecting is this:

I have a rough idea this might be due to direction cosine. Since affine matrix is a combination of multiple transforms, I was trying to apply rotation using sitk’s AffineTransform. Can this be done? Am I missing something here?

Hello @prms,

Your understanding of the resampling operation in SimpleITK is incorrect. To understand the concept of images as a spatial object and how resampling is performed, please go over the fundamental concepts the Transforms and Resampling notebook and the Data Augmentation notebook.