Errors converting sct-generated warps for use with fsl

Hello SCT forum -

We are aiming to register our epi data to the standard template using a combo of sct & fsl tools. We need to do this so that we can incorporate the sct outputs into a registration pipeline that can handle FMRI data (FSL).

We generated the template2structural warps using sct_warp_template:

sct_warp_template -d t2.nii.gz -w template2struc_warp.nii.gz -a 1 -s 1

If you try to use the template2struc_warp.nii.gz with the fsltool ~~ applwarp~~ it simply states that the file can’t be read.

Solution 1:

I tried to modify the warp using the following:

sct_image -i struc2template_warp.nii.gz -mcs

And then I used fsltools to remerge the warp files into a 3D file:

fslmerge -t struc2template_warp.nii.gz struc2template_warp_X.nii.gz struc2template_warp_Y.nii.gz struc2template_warp_Z.nii.gz 

If I re-run applywarp - I get the same error message.

Solution 2:

If I use the sct_image command to remerge the files (instead of fslmerge) - I get the same error if I use applywarp.

Many thanks in advance,


Hi @aseg,

I can reproduce your error. More specifically, this is my output error:

error: inv(): matrix appears to be singular

An error occured while reading file: warp_template2anat_fsl.nii.gz

A ticket has been opened here. Thank you very much for posting this issue.


This issue is trickier than I thought… @jonb or @Yazhuo_Kong have you found a way to use SCT’s output warping fields into FSL?