You need to apply the transform to the direction, see this.
You are doing resampling twice, first to apply the transform, then to make the image isotropic. This leads to loss of quality. It is better to compound the transform, and do the resampling once. It will have higher quality and it is computationally faster too.
Lastly, you don’t need to write the code to apply the transform to the image yourself. ResampleInPlaceImageFilter
is already available in master
, an example to invoke it from Python is here. It should replace all of your custom processing code in updated version of rotation3d
.