The output volume is determined by the original volume, the affine matrix, and the new voxel_size that you choose. If any of the above inputs change, the output will also change. Otherwise, the output should be consistent.
The difference in dimension between output volume and original one is obvious. Just think about a unit square in 2D plane with dimension of [1 1]. If you rotate it 45 degree, you have to use a dimension of [1.414 1.414] to hold the same square. However, the distance from origin to edges are still 1.
In order to properly crop the transformed volume, you need to keep in mind that we are focusing on the unit of distance from the originator based on the affine matrix (e.g. millimeter), and don't worry about voxel size or its dimension. Since I have not used it for registration, I don't have detail procedure for you.
thanks for your submission, quite helpful. However, I need to perform a crop on the new volume in order to compare it with the old one (I'm using this to register volumes, actually).
Trying to perform some series of tests translating the new volume in the z direction with [0:0.1:1] steps, I get an output volume sometimes with a bigger size than the original, and sometimes not, and I have troubles understanding what is happening/what to do to properly crop the transformed volume.
Can you help me out on this please?
Thanks a lot!