MATLAB: How to rotate a 3d image without using imrotate

3d imagesdigital image processingimage processingrotate

I have a CT image which I want to rotate, how can I do this without using imrotate? After rotating, I want to use that image to perform a MIP. I also want to know how the matrix changes.

Best Answer

If you want to rotate it for display purposes, then parent the graphics object against a hgtransform group, and to do the rotation, change the rotation matrix associated with the hgtransform group.
If you want to rotate it computationally, then create a rotation matrix and multiply the rotation matrix by the coordinates of the image location in order to get the new coordinates.
But if you are creating a new array from that, then you need to be careful about whether you "push" values or "pull" values.
"Push" in this sense is to start with the original coordinates and apply the rotation matrix, and to assign the pixel values into the calculated locations. It is known that if you do that, then you can end up with gaps in the output image.
"Pull" on the other hand starts with output coordinates and from each and (effectively) the inverse of the rotation matrix, calculates the source coordinates and extracts values from there. If you do this, you will not end up with gaps in the output image.
Any given output location is likely to involve values from multiple input locations.
If you are working on the topic of Projection Pursuit, then you should consider using one of the established packages, probably written in another programming language. I used to use a nice package for multidimensional projection pursuit, but that was 20-ish years ago and I know longer recall the program name :( Ah, I see even some MATLAB code, https://github.com/erikapat/Projection-Pursuit