# Transformation

**URL:** <https://community.mrtrix.org/t/transformation/4966>\
**Category:** Uncategorized\
**Created:** [June 8, 2021, 3:34pm UTC](https://community.mrtrix.org/t/transformation/4966 "2021-06-08T15:34:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pabbasian](https://community.mrtrix.org/user_avatar/community.mrtrix.org/pabbasian/32/3675_2.png) [@pabbasian](https://community.mrtrix.org/u/pabbasian)\
**Post date:** [June 8, 2021, 3:34pm UTC](https://community.mrtrix.org/t/transformation/4966/1 "2021-06-08T15:34:05Z")

</div>

Hi MRtrix community,

I am new in the image registration. I need to use the same transformation that is applied in MRtrix between my imported ROI and 5tt\_coreg in another programming environment such as Matlab.

Based on MRinfo, the transformation matrix is as follows:  
[0.9999, 0.01036, -0.0008068, -74.4; -0.01037, 0.9999,-0.01142,-97.33; 0.0006884, 0.01143, 0.9999,-53.99; 0, 0, 0, 1]  
This is not following the format of affine3d due to the following error I receive in Matlab: The final column of an affine transformation matrix must consist of zeroes, except for a one in the last row.  
Also I tried rigid3d and is not working.

Could you please let me know how can I find more information about which type of registration is being used as I can’t find this information in the header.

Thank you.

 ![Screenshot from 2021-06-08 10-30-58](https://community.mrtrix.org/uploads/default/original/2X/7/7e3bfd0f89df6b64f3d607f374b10d3049a8ec1d.png)

---

<div class="post-metadata">

**Author:** ![maxpietsch](https://community.mrtrix.org/user_avatar/community.mrtrix.org/maxpietsch/32/25_2.png) [@maxpietsch](https://community.mrtrix.org/u/maxpietsch)\
**Post date:** [June 9, 2021, 7:53am UTC](https://community.mrtrix.org/t/transformation/4966/2 "2021-06-09T07:53:10Z")

</div>

Could you please clarify what you are trying to achieve? Your error message indicates that the transformation is transposed but that might not be the only source of incompatibility wich affine3d. In general, transformations are typically specific to the software package.

You might find the following links helpful to get you started:  
[https://mrtrix.readthedocs.io/en/latest/getting\_started/image\_data.html](https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html)

> [@Registration, transformation, regridding: concepts](https://community.mrtrix.org/t/registration-transformation-regridding-concepts/3684):
>
> This wiki post aims to introduce the concepts and terminology associated with modifications of the voxel grid of an image and with changing the real-world location of its content and to highlight related tools within MRtrix3. TL/DR In image regridding, the grid of the image data is modified but the relation between the content of the image and the real-world location is preserved. Regridding entails interpolation which can cause a loss of information and introduce bias between images if perform…

> [@Registration: using transformations generated from other packages](https://community.mrtrix.org/t/registration-using-transformations-generated-from-other-packages/2259):
>
> The [mrtransform](https://mrtrix.readthedocs.io/en/latest/reference/commands/mrtransform.html) allows the spatial transformation of images when provided with a suitable linear or nonlinear transformation (“warp”). For linear transformations, MRtrix3 uses homogeneous transformation matrices stored as plain text. These can be converted from FSL and ITK-based (plain text) convention with the command [transformconvert](https://mrtrix.readthedocs.io/en/latest/reference/commands/transformconvert.html). The MRtrix3 tools expect nonlinear transformations in an image format where each voxel defines the scanner space location in the other image. This transformatio…

---

<div class="post-metadata">

**Author:** ![pabbasian](https://community.mrtrix.org/user_avatar/community.mrtrix.org/pabbasian/32/3675_2.png) [@pabbasian](https://community.mrtrix.org/u/pabbasian)\
**Post date:** [January 6, 2022, 6:31pm UTC](https://community.mrtrix.org/t/transformation/4966/3 "2022-01-06T18:31:49Z")

</div>

Hi Max,

Thank you for your response. I could resolve the issue by using mrgrid command in MRtrix to resample my image. I didn’t have to apply affine transformation separately anymore.

Thanks,  
Parand
