Print

Print


Hi,

I'm glad that my solution worked.
I cannot really tell anything much from the image that you sent.  When evaluating registrations you really need to see both images - the reference and the transformed input (so in this case, bold_data_mcf2standard and then also the standard image, either with edges superimposed like in the FEAT report, or as a separate image but with the same FOV and method of creating the illustrative image, so that we can compare relative positions).  Just seeing one image makes it very difficult to know if it is aligned well or not.

The fuzziness near the edge is due to the non-linear registration having limited constraints outside of the brain. Typically it is just a stretching of the outermost voxels and does not mean that the registration inside the brain is poor.  So as long as the general alignment to the standard looks good then this is nothing to worry about (best way to compare is to load both the transformed image and the standard brain into FSLView and flick back and forwards, by turning the top image on an off; or alternatively you can have side-by-side orthogonal views with a linked cursor).  It is generally just a cosmetic issue, but you should check in FSLView.

All the best,
Mark


From: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>> on behalf of Joelle Zimmermann <[log in to unmask]<mailto:[log in to unmask]>>
Reply-To: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>>
Date: Monday, 10 August 2015 15:23
To: "[log in to unmask]<mailto:[log in to unmask]>" <[log in to unmask]<mailto:[log in to unmask]>>
Subject: Re: [FSL] Strange registration result

Hi Mark,

Wow right on! Thank you so much!!! I've been struggling with this for days, so grateful you could help. :-)

So basically when I use fslreorient2std on all input images (ie. T1, example_func, and the 4D functional filtered_func_data), then I get a good-looking output. (previously I hadn't reoriented the 4D image, and you're right, that's what was causing the problem.

Just for verification, I'm attaching here a screenshot of the output image (of the registered 4D data bold_data_mcf2standard).

I'd like to follow up here on a discussion I've also been having with Niels, and also previously on this mailing list, about the fuzziness around the edges of the final output registered 4D image. If you see the screenshot attached for example, which in general looks good, but has a fuzziness around the edges. This is the case for all of my subjects. Do you have an idea of what this is?, if it is indeed an actual problem, and how it could be fixed? I've been told that it's not entirely unusual, but it does look odd to me.

Thanks a lot,
Joelle

On Sat, Aug 8, 2015 at 2:56 AM, Mark Jenkinson <[log in to unmask]<mailto:[log in to unmask]>> wrote:
Hi,

I've done some investigation here and I think I have figured out the problem.

The images that you sent me do not make sense with the transforms directly.  However, if I use fslreorient2std on the T1 and on the example_func then the reoriented images work perfectly with the transformations (example_func2highres.mat and highres2standard_warp) to give me replications of your transformed images (example_func2highres.nii.gz and highres2standard.nii.gz) and these are good registrations between the reoriented versions of your images.  I note that fslreorient2std is not in your script, so I assume it was run beforehand.

When I then run your convertwarp and applywarp command using the reoriented example_func as input then I get a good registration.  However, when I run the applywarp step with the input as the functional *before* reorientation, then I get the same result that you get - which is completely wrong.

So I think you must have used fslreorient2std on your images (which we recommend) but not done this to your original 4D bold data, and then when you apply the final transformation it fails.   If you apply fslreorient2std to the 4D bold data (or use a version where you've already done this) then it should all work fine.

All the best,
Mark


From: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>> on behalf of Joelle Zimmermann <[log in to unmask]<mailto:[log in to unmask]>>
Reply-To: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>>
Date: Friday, 7 August 2015 23:00

To: "[log in to unmask]<mailto:[log in to unmask]>" <[log in to unmask]<mailto:[log in to unmask]>>
Subject: Re: [FSL] Strange registration result

Hi Mark,

Thanks for taking a look, that's really nice of you! I've uploaded those files. Note that the T1.nii.gz uploaded is what you call the highres.nii (in my script its T1.nii). And also that bold_data_mcf2standard.nii.gz I accidently uploaded twice and cant seem to delete (but its just the same file twice).

The link is: https://oxfile.ox.ac.uk/oxfile/work/extBox;jsessionid=AAA9E9BA05109C59F73880D124375752?execution=e1s1

Thanks for taking the time.
Joelle

On Fri, Aug 7, 2015 at 4:37 PM, Mark Jenkinson <[log in to unmask]<mailto:[log in to unmask]>> wrote:
Hi,

I can't see anything obviously wrong in the script.
So I think I need you to upload the following files using the link below:
example_func.nii.gz
example_func2highres.nii.gz
example_func2highres.mat
highres.nii.gz
highres2standard.nii.gz
highres2standard_warp.nii.gz
highres2standard.mat
filtered_func_data.nii.gz
bold_data_mcf2standard.nii.gz

(or equivalent .nii files in case they are not .nii.gz)

The link is:
https://oxfile.ox.ac.uk/oxfile/work/extBox?id=68312615463381F4C

Hopefully having the data will let me figure out what is going wrong.

All the best,
Mark


From: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>> on behalf of Joelle Zimmermann <[log in to unmask]<mailto:[log in to unmask]>>
Reply-To: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>>
Date: Friday, 7 August 2015 21:13

To: "[log in to unmask]<mailto:[log in to unmask]>" <[log in to unmask]<mailto:[log in to unmask]>>
Subject: Re: [FSL] Strange registration result

Hi Mark,

This is all great info for me to know. I am attaching a screenshot of bold_data_mcf2standard here. So this is the 4D functional output of all those steps in the script.

So it seems that if the example_func2highres and highres2standard are fine, then the problem comes somewhere towards the end of the script, during the  convert_xfm, convertwarp or applywarp commands..

Thanks! :)
Joelle

On Fri, Aug 7, 2015 at 3:27 PM, Mark Jenkinson <[log in to unmask]<mailto:[log in to unmask]>> wrote:
Hi,

Ah, it is useful to know that you are using a custom script and not the standard FSL pipelines.

In this case you need to show me one picture from the bold_data_mcf2standard image.  This, in your script, is the equivalent of example_func2standard in the normal FEAT pipeline.

The pictures you sent of example_func2highres and highres2standard both look fine (with some assumptions on my part as to what highres on its own looks like).

The *_warp image is actually how the transformation between the spaces are stored, with vectors indicating voxel shifts, and so is not useful to look at.

All the best,
MArk


From: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>> on behalf of Joelle Zimmermann <[log in to unmask]<mailto:[log in to unmask]>>
Reply-To: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>>
Date: Friday, 7 August 2015 18:13
To: "[log in to unmask]<mailto:[log in to unmask]>" <[log in to unmask]<mailto:[log in to unmask]>>

Subject: Re: [FSL] Strange registration result

Hi Mark,

Thank you for helping. :)

I'm attaching screenshots of example_func2highres and highres2standard, however, I actually cannot find a example_func2standard in my output, I can only find example_func2standard_warp, which looks strange, also see attached. I think just as png's it'll work to send here. If you think that .nii's would be helpful too, please let me know :)

Regarding the settings, I am running in a script, which was successful for the remaining subjects, only this one looks off. See below the steps and options I used.

Thanks,
Joelle


bet ${path_to_anat_subj}/orig.nii ${path_to_anat_subj}/brain2.nii -R

######################## SINGLE IMAGE

##### Flirt: Register EPI to Subject's structural.

epi_reg --epi=${path_to_bold_subj}/featDir.feat/example_func.nii.gz --t1=${path_to_anat_subj}/orig.nii --t1brain=${path_to_anat_subj}/brain2.nii --out=${path_to_bold_subj}/featDir.feat/example_func2highres

##### Flirt/Fnirt combo:  Structural to MNI

flirt -in ${path_to_anat_subj}/brain2.nii -ref ${FSLDIR}/data/standard/MNI152_T1_2mm_brain.nii.gz -out ${path_to_anat_subj}/highres2standard -omat ${path_to_anat_subj}/highres2standard.mat -cost corratio -dof 12 -searchrx -180 180 -searchry -180 180 -searchrz-180 180 -interp trilinear

fnirt --iout=${path_to_anat_subj}/highres2standard_head --in=${path_to_anat_subj}/orig.nii --aff=${path_to_anat_subj}/highres2standard.mat --cout=${path_to_anat_subj}/highres2standard_warp --iout=${path_to_anat_subj}/highres2standard --jout=${path_to_anat_subj}/highres2highres_jac --config=${FSLDIR}/etc/flirtsch/T1_2_MNI152_2mm --ref=${FSLDIR}/data/standard/MNI152_T1_2mm.nii.gz --refmask=${FSLDIR}/data/standard/MNI152_T1_2mm_brain_mask_dil.nii.gz --warpres=10,10,10

######################## APPLY TO 4D

#### This combines the 2 affine transforms into a single affine transform (avoids interpolating data twice):

convert_xfm -omat ${path_to_bold_subj}/featDir.feat/example_func2standard.mat -concat ${path_to_anat_subj}/highres2standard.mat ${path_to_bold_subj}/featDir.feat/example_func2highres.mat

#### combines the affine registration info with the nonlinear registration to have a single registration step (again to avoid interpolating data multiple times):

convertwarp --ref=${FSLDIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --premat=${path_to_bold_subj}/featDir.feat/example_func2highres.mat --warp1=${path_to_anat_subj}/highres2standard_warp --out=${path_to_bold_subj}/featDir.feat/example_func2standard_warp

#### Finally, this should be used on your flirted data to put your data into MNI space

applywarp --ref=${FSLDIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --in=${path_to_bold_subj}/featDir.feat/filtered_func_data.nii --out=${path_to_bold_subj}/featDir.feat/bold_data_mcf2standard --warp=${path_to_bold_subj}/featDir.feat/example_func2standard_warp

On Fri, Aug 7, 2015 at 12:56 PM, Mark Jenkinson <[log in to unmask]<mailto:[log in to unmask]>> wrote:
Hi,

From the limited amount I can see that looks pretty promising.
Can you send pictures of what the example_func2highres, the highres2standard and the example_func2standard look like?
The latter is a combination of the other two, so at least one of these must be wrong if example_func2standard is wrong.

The attachment limit for this list is very small, so I suggest that you upload the pictures to a third-party photo website (or a University sharing site) and then include links to them in the email.

It would also be helpful to describe exactly what settings you are using for this registration.

All the best,
Mark


From: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>> on behalf of Joelle Zimmermann <[log in to unmask]<mailto:[log in to unmask]>>
Reply-To: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>>
Date: Friday, 7 August 2015 17:34

To: "[log in to unmask]<mailto:[log in to unmask]>" <[log in to unmask]<mailto:[log in to unmask]>>
Subject: Re: [FSL] Strange registration result

Hi Mark,

Following up on this, I tried reoriented the original images ( T1 and example_func ) using fslreorient2std, and reran. However, the final result (the 4D registered functional) still does not look good. It looks the same as before.

However, it seems that the examplefunc2highres (see new screenshot attachment) is now at least oriented correctly. But it did not seem to solve the problem.

Do you have any other ideas of what could have gone wrong?

Thanks,
Joelle

On Fri, Aug 7, 2015 at 9:18 AM, Joelle Zimmermann <[log in to unmask]<mailto:[log in to unmask]>> wrote:
Hi Mark,

Thanks for your advice. Right! It does look like the labels are flipped in the examplefunc2highres.

Just to make sure I understand, what do you mean by changing the search option on the registration tab to full search?

Thanks,
Joelle

On Thu, Aug 6, 2015 at 12:20 PM, Mark Jenkinson <[log in to unmask]<mailto:[log in to unmask]>> wrote:
Hi,

Unless I'm mistaken, the A and P labels are backwards, so your EPI is probably very badly misregistered.  It might help to apply fslreorient2std to the EPI before running the analysis, if it currently starts in a very different orientation to the structural and standard (you can also apply this to the structural if it is differently oriented to the standard).  This often helps a lot.  Alternatively, try changing the search option on the registration tab to "Full search".

Also, importantly, make sure that you check that all the original images (functional and structural) are labelled correctly (in FSLView, look at the L/R/A/P/S/I labels) with respect to the anatomy.  If any of these is wrong then you should stop everything and fix this before anything else (details on the FSLwiki for how to fix it if it is a problem).

All the best,
Mark

From: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>> on behalf of Joelle Zimmermann <[log in to unmask]<mailto:[log in to unmask]>>
Reply-To: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>>
Date: Thursday, 6 August 2015 14:44
To: "[log in to unmask]<mailto:[log in to unmask]>" <[log in to unmask]<mailto:[log in to unmask]>>
Subject: Re: [FSL] Strange registration result

Hi Mark,

Thanks for your help, much appreciated. I'm attaching a screenshot here of the epi (1 example volume) to T1 registration (examplefunc2highres). I don't have much experience, but it doesnt look too bad to me.

The problem isn't related to the BBR stuff, I don't get an error for this subject.

I'm also pasting below the script that I am using for the whole process: functional > T1 > standard.

Thanks,
Joelle



bet ${path_to_anat_subj}/orig.nii ${path_to_anat_subj}/brain2.nii -R

######################## SINGLE IMAGE

##### Flirt: Register EPI to Subject's structural.

epi_reg --epi=${path_to_bold_subj}/featDir.feat/example_func.nii.gz --t1=${path_to_anat_subj}/orig.nii --t1brain=${path_to_anat_subj}/brain2.nii --out=${path_to_bold_subj}/featDir.feat/example_func2highres

##### Flirt/Fnirt combo:  Structural to MNI

flirt -in ${path_to_anat_subj}/brain2.nii -ref ${FSLDIR}/data/standard/MNI152_T1_2mm_brain.nii.gz -out ${path_to_anat_subj}/highres2standard -omat ${path_to_anat_subj}/highres2standard.mat -cost corratio -dof 12 -searchrx -180 180 -searchry -180180 -searchrz -180 180 -interp trilinear

fnirt --iout=${path_to_anat_subj}/highres2standard_head --in=${path_to_anat_subj}/orig.nii --aff=${path_to_anat_subj}/highres2standard.mat --cout=${path_to_anat_subj}/highres2standard_warp --iout=${path_to_anat_subj}/highres2standard --jout=${path_to_anat_subj}/highres2highres_jac --config=${FSLDIR}/etc/flirtsch/T1_2_MNI152_2mm --ref=${FSLDIR}/data/standard/MNI152_T1_2mm.nii.gz --refmask=${FSLDIR}/data/standard/MNI152_T1_2mm_brain_mask_dil.nii.gz --warpres=10,10,10

######################## APPLY TO 4D

#### This combines the 2 affine transforms into a single affine transform (avoids interpolating data twice):

convert_xfm -omat ${path_to_bold_subj}/featDir.feat/example_func2standard.mat -concat ${path_to_anat_subj}/highres2standard.mat ${path_to_bold_subj}/featDir.feat/example_func2highres.mat

#### combines the affine registration info with the nonlinear registration to have a single registration step (again to avoid interpolating data multiple times):

convertwarp --ref=${FSLDIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --premat=${path_to_bold_subj}/featDir.feat/example_func2highres.mat --warp1=${path_to_anat_subj}/highres2standard_warp --out=${path_to_bold_subj}/featDir.feat/example_func2standard_warp

#### Finally, this should be used on your flirted data to put your data into MNI space

applywarp --ref=${FSLDIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --in=${path_to_bold_subj}/featDir.feat/filtered_func_data.nii --out=${path_to_bold_subj}/featDir.feat/bold_data_mcf2standard --warp=${path_to_bold_subj}/featDir.feat/example_func2standard_warp

On Wed, Aug 5, 2015 at 6:48 PM, Mark Jenkinson <[log in to unmask]<mailto:[log in to unmask]>> wrote:
Hi,

I doubt that the slight rotation in the T1 is a problem.
It looks like the epi to T1 registration is probably failing (although I can't be certain without seeing that output).
Is this related to your other problems with BBR (poor segmentation of the T1 due to the FreeSurfer preprocessing) or is this still an ongoing problem?

Let us know either way.

All the best,
Mark

From: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>> on behalf of Joelle Zimmermann <[log in to unmask]<mailto:[log in to unmask]>>
Reply-To: FSL - FMRIB's Software Library <[log in to unmask]<mailto:[log in to unmask]>>
Date: Saturday, 1 August 2015 13:13
To: "[log in to unmask]<mailto:[log in to unmask]>" <[log in to unmask]<mailto:[log in to unmask]>>
Subject: [FSL] Strange registration result

Hi Experts,

I'm registering a subject's epi functional > T1 > MNI standard. Most subjects look ok, but for one subject I am getting a strange output (see attached Output_SubML).

I am attaching the bet T1 image (T1Brain_SubML), which looks slightly rotated (I speculate this may be the problem?)

I am also attaching the result of epi_reg, examplefunc2standard_SubML, which has strange bits around the skull, which may also be causing the problem.

Any help would be much appreciated.

Thanks,
Joelle