Rotating and resampling volumes with Python

I’ve written a very simple python scrited module which sums a CT image’s along one of the 3 given axes to create a DRR-like image. However I want to extend this module to sum along an abitrary axis through the image instead of only the orthogonal directions.

I think the best way to approach this would be to use one of the resample image modules? Is there a better way of doing this - perhaps directly in numpy instead of borrowing another module’s logic? Thanks!

Probably the easiest is to apply a transform to the volume (rotation) and then resample using Resample Image (brains) as a CLI from python. Probably put it in a new volume so you can repeat with arbitrary directions.

I rotated the mr image using a rotation matrix.
How can the voxel resolution or size be recalculated in this process?
Thank you

This example script for extracting oriented boxes from a volume should help (maybe it does exactly what you want).