[Neuroimaging] Niftiimage Affine Rotation
Amit Akula
amitvakula at gmail.com
Sun Jul 14 17:05:11 EDT 2019
Hello,
Just to get some background information, how are you applying the affine
transformation to your image?
Are you using the following function?
from nibabel.affines import apply_affine
You can see the source code of this function here
<https://github.com/nipy/nibabel/blob/master/nibabel/affines.py>.
Sincerely,
Amit
On Fri, Jul 12, 2019 at 5:29 AM Kai Canoll <kaicanoll at gmail.com> wrote:
>
> I would like to apply an affine transform to my image, then open the
> transformed image in python to do additional processing. In most other
> toolboxes, the affine transformation and the resampling are separate steps,
> i.e. you can rotate an image without changing the resolution or you can
> change the resolution without rotating.
> Is there any way to just apply an affine transform to an image in nibabel?
>
> Hi,
>
> On Wed, Jul 10, 2019 at 2:30 PM Kai Canoll <kaicanoll at gmail.com <https://mail.python.org/mailman/listinfo/neuroimaging>> 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.
>
> Cheers,
>
> Matthew
>
>
> _______________________________________________
> Neuroimaging mailing list
> Neuroimaging at python.org
> https://mail.python.org/mailman/listinfo/neuroimaging
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20190714/a11a0771/attachment.html>
More information about the Neuroimaging
mailing list