[Neuroimaging] Niftiimage Affine Rotation

Matthew Brett matthew.brett at gmail.com
Wed Jul 10 17:34:31 EDT 2019


On Wed, Jul 10, 2019 at 2:30 PM Kai Canoll <kaicanoll at gmail.com> wrote:
> HI All,
> We are having some problems applying an affine transform to some nifti data.
> We are trying to apply a new transform using
> affine_transformed_image=nib.Nifti1Image(datamatrix,affinetransform)
> When we look at a slice of affine_transformed_image in Python, it doesn't seem to change in any way.  However, if we open it in FSLeyes, it appears to be rotated according to affinetransform.
> However, if we resample affine_transformed_image using
> resampled_image=nib.processing.resample_from_to(affine_transformed_image, vox_map)
> where vox_map contains an affine identity transform, then the slices in python are successfully rotated.
> In other words, our image does not appear to be affine transformed in the first step.  Can anyone suggest how to apply the affine transform such that the image actually rotates without having to do the resampling step?

Could you say more about what you mean?   If you want the slices to
change, in the array, I'm afraid there's no way round it, but do
resampling.   FSLeyes is just doing the resampling in the background
for you, in order to show you the slices.



More information about the Neuroimaging mailing list