# Coregister lesion mask to T1

**URL:** https://community.mrtrix.org/t/coregister-lesion-mask-to-t1/4488
**Category:** Uncategorized
**Created:** [January 21, 2021, 1:59am UTC](https://community.mrtrix.org/t/coregister-lesion-mask-to-t1/4488 "2021-01-21T01:59:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Salah](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/s/977dab/32.png) [@Salah](https://community.mrtrix.org/u/Salah)
#### Post date: [January 21, 2021, 1:59am UTC](https://community.mrtrix.org/t/coregister-lesion-mask-to-t1/4488/1 "2021-01-21T01:59:45Z")

</div>

Hi experts,

I have a lesion mask that has been created from T1 with a lesion. They are exactly the same but they are in different spaces. I want to register the lesion mask to the T1 but it shows mismatching.

I tried using SPM, flirt and mrtransform  
mrtransform lesion.nii output.nii -template T1.nii

Non of them has done the job.!  
[Screen\_Shot|690x428](https://community.mrtrix.org/uploads/short-url/tfARJZArBLrwNc2dFhk07nH9i4u.jpeg)

- Despite all this, HOW can I register a lesion mask to T1, if they are exactly the same but in different spaces?

Regards,  
Salah

---

<div class="post-metadata">

### Author: ![tbilliet](https://community.mrtrix.org/user_avatar/community.mrtrix.org/tbilliet/32/3859_2.png) [@tbilliet](https://community.mrtrix.org/u/tbilliet)
#### Post date: [January 21, 2021, 5:47pm UTC](https://community.mrtrix.org/t/coregister-lesion-mask-to-t1/4488/2 "2021-01-21T17:47:49Z")

</div>

Hi Salah,

From which image was the lesion mask created? You would need to register that image to your T1 and apply the resulting transformation on your lesion mask. Directly registering the mask to your T1 will not work (as you noticed) as both images do not have sufficient similarities.

Kr  
Thibo

---

<div class="post-metadata">

### Author: ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)
#### Post date: [January 25, 2021, 12:19am UTC](https://community.mrtrix.org/t/coregister-lesion-mask-to-t1/4488/3 "2021-01-25T00:19:36Z")

</div>

Hi Salah,

There might be a terminology problem here; please see [this wiki page](https://community.mrtrix.org/t/registration-transformation-regridding-concepts/3684/2). In particular if you have generated the lesion mask _from_ the T1w image, there should be no reason to _register_ that image _to_ the T1w. What I’m hypothesizing might be going on is that you’ve generated the lesion mask from the T1w image _before_ a transformation was applied to the latter, and so now you have an issue where the content of the two images do not overlap. But what you want to do is take the _transformation_ that was applied to the T1w, and also apply it to the lesion mask. This does _not_ involve “image registration”.

I would also note that you `mrtransform` call is not actually applying any spatial transformation; it is only _resampling_ the data from `lesion.nii` onto the voxel grid as defined by template image `T1.nii`.

Rob

---

<div class="post-metadata">

### Author: ![FEHildesheim](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/f/82dd89/32.png) [@FEHildesheim](https://community.mrtrix.org/u/FEHildesheim)
#### Post date: [June 29, 2023, 6:19pm UTC](https://community.mrtrix.org/t/coregister-lesion-mask-to-t1/4488/4 "2023-06-29T18:19:42Z")

</div>

Hi.

I have a similar issue. I created a lesionmask on my T1 image, then my T1 image underwent freesurfer recon-all for brain extraction and the output file now has different image dimensions (256x256x256) than the lesionmask (192x240x256).

I used the brain-extracted T1 image with the new image dimensions to register it to my DWI image (switching the dimensions to 256x256x126). I now wanted to bring my lesionmask in DWI space as well, however when applying the same transformation matrix to the lesionmask that I previously used on the T1 image (flirt -v -applyxfm -init diff\_to\_structural\_inverse.mat -in lesionmask.nii -ref DWI\_b0.nii -out lesionmask\_to\_DWI.nii), the results seem not correct. Could this be because the image dimensions of the mask are different to the ones from my T1 image?

I tried adjusting the dimensions to the dimensions of the T1 image (mrtransform -template T1.nii lesionmask.nii lesionmask\_adjusted.nii), however, when applying the transformation onto that adjusted lesionmask file, the results still seem off.

How can I correctly apply the transformation matrix to my binary lesion mask file? Do you have any idea how to proceed in this case?

Thank you for your help,  
Franziska
