Tracktography error using surface files

Dear dHCP team,

I’m facing problems running FSL probtrackx2 using surface files. We want to track the white matter connectivity between some ROIs that we selected based on the HCP MMP atlas. Namely, we chose some functional areas from it.

With this scope in mind, we processed the dwi data following your suggestion for bedpostx here.

And, we successfully upscaled and aligned HCP MMP ROIs to the native space of the neonates thanks to the help of one of your team members here.

However, when running probtrackx2 only some of those ROIs works. The procedure is the following:

First, we applied FSL surf2surf function:
surf2surf -i $WM_L -o $TRACK_DIR/asc_roi/L_${ROI}.asc --outputtype=ASCII --values=$NAT_ROI_DIR/surf_L_${ROI}_ROI.func.gii

where:
-i $WM_L is the subject white matter surface sub-${subjid}_ses-${session}_hemi-R_space-T2w_wm.surf.gii
-o $TRACK_DIR/asc_roi/L_${ROI}.asc the output name
--outputtype=ASCII output type
--values=$NAT_ROI_DIR/surf_L_${ROI}_ROI.func.gii the functional ROI in native space with the same amount of vertices as the downloaded surfaces. Those ROIs work if opened using connectome workbench software: if I open the white matter surface and the ROIs I can visualize them and they are in the correct position.

Then, probtrackx2:
probtrackx2 -x $TRACK_DIR/asc_roi/${hemi}_${ROI_A}.asc -l -c 0.2 -S 2000 --meshspace=caret --steplength=0.5 -P 5000 --fibthresh=0.01 --distthresh=0.0 --sampvox=0.0 --forcedir --opd -s $Bedpostx_DIR/merged -m $Bedpostx_DIR/nodif_brain_mask.nii.gz --dir=$TRACK_DIR -o ${hemi}_${subjid}_${ROI_A}2${ROI_B} --seedref=$FA_DIR/data.nii.gz --stop=$TRACK_DIR/txt_roi/${hemi}_STOPmask_pial.txt --waypoints=$TRACK_DIR/asc_roi/${hemi}_${ROI_A}.asc

Where:
-x $TRACK_DIR/asc_roi/${hemi}_${ROI_A}.asc ascii file created by surf2surf
-l -c 0.2 -S 2000 --meshspace=caret --steplength=0.5 -P 5000 --fibthresh=0.01 --distthresh=0.0 --sampvox=0.0 --forcedir --opd basic settings
-s $Bedpostx_DIR/merged bedpostx directory & basename
-m $Bedpostx_DIR/nodif_brain_mask.nii.gz same no_diff_brain_mask used in bedpostx
--dir=$TRACK_DIR outout directory
-o ${hemi}_${subjid}_${ROI_A}2${ROI_B} output name
--seedref=$FA_DIR/B0_data.nii.gz B0 as seed reference
--stop=$TRACK_DIR/txt_roi/${hemi}_STOPmask_pial.txt stop masks: pial surface
--waypoints=$TRACK_DIR/asc_roi/${hemi}_${ROI_A}.asc waypoint is another mask output of surf2surf.

However, when ran, probtrackx2 returns NEWMAT::IndexException error ONLY for some ROIs.
Of course, I’ve tried several configurations of probtrackx2, passing additional flags such as:

--xfm=dhcp_HPC_data/sub-CC00747XX22/ses-238600/xfm/sub-CC00747XX22_ses-238600_from-T2w_to-dwi_mode-image.mat T2w to dwi affine trasform, provided by you
--seedref=dhcp_HPC_data/sub-CC00747XX22/ses-238600/dwi/sub-CC00747XX22_ses-238600_desc-preproc_dwi.nii.gz setting the seed reference as the T2w image.
As providing the --xfm to the surf2surf function, changing setting during the upsampling of the ROIs from the 32k HCP MMP to the native 84K vertices, removing stop masks/waypoints. All of which returns the same error for the same subset of ROIs.

What I suspect is that there is an error or a missing step I was not able to spot before, after or the sur2surf function itself, since the only thing that increases the number of ROIs returning the NEWMAT error is changing the surface type within the surf2surf function. Using PIAL returns more NEWMAT error than WM and MIDTHICKNESS.

Additionally, I’ve run -metric-to-volume-mapping in order to check wheter the ROIs are good or not and they are fine.
wb_command -metric-to-volume-mapping $NAT_ROI_DIR/surf_L_${ROI}_ROI.func.gii $STRUCT_DIR/sub-${subjid}_ses-${session}_hemi-L_space-T2w_wm.surf.gii $STRUCT_DIR/sub-${subjid}_ses-${session}_desc-restore_T2w.nii.gz $STRUCT_DIR/surface2volume_map/sub-${subjid}_ses-${ses}_L_${ROI}_wm-mapped.nii.gz -nearest-vertex 1

This is an already long post so I will not include additional information or pictures but I’m willing to provide any additional information you need.

Thank you for your help.

Tommaso

Hi Tommaso,

As far as I understand, you have warped a set or ROIs to each subject’s native T2-weighted space.

If that is the case, you will need to provide PBX2 with both:

–xfm=sub-_ses-_from-T2w_to-dwi_mode-image.mat
–seedref=<subject_session_T2w_volume>

In the last section of your email you say that you tried that, but are passing the diffusion data as seedref? That should be the T2w volume.

Hope this helps, cheers,

Matteo

Hi Matteo,
Thank you for your email.

I should have specified that with the -xfm flag I added also the T2w as seed reference. However, I tried it again this morning and the error is the same as before.

terminate called after throwing an instance of 'NEWMAT::IndexException'
Aborted (core dumped)

best,
Tommaso

Hi,

Have you checked whether all the volumes have the same dimensions?

Cheers,
Matteo

Hi,

No i didn’t but would that matter? only some ROIs works while other don’t and they are all made from the same file and in the same way.

However, I’m not sure how to check if the volumes have the same dimension. Workbench file information says:
dwi image: 128, 128, 64, 300
restore_T2w: 290, 290, 203
nodiff_brain_mask: 128, 128, 64

If I add --verbose the error is returned during the tracking while probtrackx is calculating the verticies.

Hi,

thanks for checking that. Indeed, those match and seem consistent.
If you check the qform matrix of the restore_T2w volume using fslhd, does that look reasonable?

Cheers,
Matteo

Hi,
I don’t know how to read this but they seems reasonable. Both of my test subjects return the same error despite with different rois. here the copy paste of two babies.

00747XX22:

qform_name Scanner Anat
qform_code 1
qto_xyz:1 -0.500000 0.000000 -0.000000 69.211487
qto_xyz:2 0.000000 0.500000 -0.000000 -74.920624
qto_xyz:3 0.000000 0.000000 0.500000 -42.808365
qto_xyz:4 0.000000 0.000000 0.000000 1.000000
qform_xorient Right-to-Left
qform_yorient Posterior-to-Anterior
qform_zorient Inferior-to-Superior

00073XX08:

qform_name Scanner Anat
qform_code 1
qto_xyz:1 -0.500000 0.000000 -0.000000 66.703125
qto_xyz:2 0.000000 0.500000 -0.000000 -56.107910
qto_xyz:3 0.000000 0.000000 0.500000 -36.119400
qto_xyz:4 0.000000 0.000000 0.000000 1.000000
qform_xorient Right-to-Left
qform_yorient Posterior-to-Anterior
qform_zorient Inferior-to-Superior

Ok, I’ve sent you an oxfile link to upload your data, so that I can have a look and try to replicate the error. Let me know if you get it.

Cheers,
Matteo

I’ve received the email and I uploaded the ROIs I made for both the babies I mentioned above.
Let me know if you also need the bedpostx folders, I did not include them since with my connection it will take days to upload them.

ROIs like surf_R_PreM_ROI.func.gii, L_PreM, L_AUD, R_AUD are returning the error above when used as seed. What I did is running probtrackx2 using each possible combination of rois in a hemisphere.

thank you for the help.

Tommaso

Hi,

Thanks.
It’s fine, I can re-create the bedpostx results myself.

However, I still need all the other files you use as input. I.e., surface files that you use as input to surf2surf, waypoint and stop masks/surfaces/files. Can you please upload those as well?

Cheers,
Matteo

Hi,

I uploaded evrything, also the bedpostX folders. I hope i did not forget anything! Let me know if something is missing or you need any infor about the script i runned.

Best,
Tommaso

Hi,

ok, great, thanks.
I ran an example for sub-CC00073XX08 between L_preM and L_ASS.
I have used both surf2surf and probtractkx2, but I was not able to reproduce the error, everything ran fine.

I am using FSL v6.0.2 and these are the commands I have used:

surf2surf -i sub-CC00073XX08_ses-27800_hemi-L_space-T2w_wm.surf.gii -o l_hemi_preM.asc --outputtype=ASCII --values=native_space_roi/surf_L_PreM_ROI.func.gii

surf2surf -i sub-CC00073XX08_ses-27800_hemi-L_space-T2w_wm.surf.gii -o l_hemi_ass.asc --outputtype=ASCII --values=native_space_roi/surf_L_ASS_ROI.func.gii

probtrackx2 -x l_hemi_preM.asc -l -c 0.2 -S 2000 --meshspace=caret --steplength=0.5 -P 100 --fibthresh=0.01 --distthresh=0.0 --sampvox=0.0 --forcedir --opd -s dwi.bedpostX/merged -m dwi.bedpostX/nodif_brain_mask.nii.gz --dir=outDir -o l_hemi_preM --seedref=sub-CC00073XX08_ses-27800_desc-restore_T2w.nii.gz --xfm=sub-CC00073XX08_ses-27800_from-T2w_to-dwi_mode-image.mat --waypoints=l_hemi_ass.asc

Note that you have not sent me the stop masks, so I could not use those.

Cheers,
Matteo

Hi,
Interesting… I just tried your code and it is returning the error. Do you think there is something wrong with my FSL installation?

Best,
Tommaso

Hi,

That might be. What version are you running?
Maybe try to install the latest release and re-run the code?

Cheers,
Matteo

The workstation I am working on has FSL 5.0. I’ve installed the 6 on my personal laptop and I will try to run the code once I will have download the data. I will write another message once I run the code.

Thank you for your help Matteo.

Best,
Tommaso

Happy sunday!

It seems that the workstation i was working on has the fsl installation broken. I runned the code on my PC and it work flawless.

Thank you for the help!

Great! Glad to hear that it works now!

Cheers,
Matteo