Same nodes are not aligned for MNI_Glasser_HCP_v1.0.nii file

I have to coregister my tractography with HCP-MMP atlas. I used the codeline which is at the end.

I got this error for 2 different datasets with approximately same nodes. My suspicion is there is a problem with the files I used for coregistration.

tck2connectome: [WARNING] The following nodes do not have any streamlines assigned:
tck2connectome: [WARNING] 21, 22, 42, 44, 46, 49, 51, 56, 70, 90, 143, 151, 152, 156, 158, 202, 206, 226, 250, 267, 270, 323, 332
tck2connectome: [WARNING] (This may indicate a poor registration)

#-----------------HCP atlas prep -----------
#Using files taken from this link: GitHub - mbedini/The-HCP-MMP1.0-atlas-in-FSL: A volumetric version of the HCP-MMP1 atlas conveniently imported in FSL. This repo was used in Bedini, M., Olivetti, E., Avesani, P., & Baldauf, D. (2023). Accurate localization and coactivation profiles of the frontal eye field and inferior frontal junction: an ALE and MACM fMRI meta-analysis. Brain Structure and Function, 1-21.

labelconvert MNI_Glasser_HCP_v1.0.nii HCP-Multi-Modal-Parcellation-1.0.txt ~/mrtrix3/share/mrtrix3/labelconvert/hcpmmp1_ordered.txt MNI_Glasser_HCP_nocoreg.mif

mrtransform MNI_Glasser_HCP_nocoreg.mif -linear diff2struct_mrtrix.txt -inverse -datatype uint32 MNI_Glasser_HCP_coreg.mif

Does someone have an idea? Should I change the files which I used for coregistration

Some additional files




5tt_coreg.mif, overlayed

5tt_nocoreg.mif, overlayed

gmwmSeed_coreg.mif, overlayed

MNI_Glasser_HCP_coreg.mif is not coregistered perfectly !

I think that is the main issue with my thread. Unaligned nodes correspond to areas where the MR image does not overlap with the coreg file (such as nodes 21 and 22)

FULL CODELINE I USED

PA_DWI=$1
PA_BVEC=$2
PA_BVAL=$3
ANAT=$4
SUBJ=$5

#---------------- preprocessing -----------------
mrconvert $PA_DWI raw_dwi.mif -fslgrad $PA_BVEC $PA_BVAL
dwidenoise raw_dwi.mif dwi_den.mif -noise noise_AP.mif
mrdegibbs dwi_den.mif dwi_den_unr.mif -axes 0,2
dwiextract dwi_den_unr.mif - -bzero | mrmath - mean mean_b0_PA.mif -axis 3
dwifslpreproc dwi_den_unr.mif dwi_preproc.mif -nocleanup -pe_dir PA -rpe_none -eddy_options " --slm=linear --data_is_shelled"
dwibiascorrect ants dwi_preproc.mif dwi_preproc_unbiased.mif -bias bias_PA.mif
dwi2mask dwi_preproc_unbiased.mif mask.mif

dwi2response tournier dwi_preproc_unbiased.mif response.txt
dwi2fod csd dwi_preproc_unbiased.mif response.txt fod.mif -mask mask.mif

mrgrid dwi_preproc_unbiased.mif regrid dwi_upsampled.mif -voxel 2
dwiextract dwi_upsampled.mif - -bzero | mrmath - mean mean_b0_processed.mif -axis 3
mrconvert mean_b0_processed.mif mean_b0_processed.nii.gz

recon-all -i $ANAT -s $SUBJ -all

5ttgen hsvs $SUBJ 5tt_nocoreg.mif ### (NITRC: Automatic Registration Toolbox: Tool/Resource Info)
mrconvert 5tt_nocoreg.mif 5tt_nocoreg.nii.gz

fslroi 5tt_nocoreg.nii.gz 5tt_vol0.nii.gz 0 1

flirt -in mean_b0_processed.nii.gz -ref 5tt_vol0.nii.gz -interp nearestneighbour -dof 6 -omat diff2struct_fsl.mat
transformconvert diff2struct_fsl.mat mean_b0_processed.nii.gz 5tt_nocoreg.nii.gz flirt_import diff2struct_mrtrix.txt
mrtransform 5tt_nocoreg.mif -linear diff2struct_mrtrix.txt -inverse 5tt_coreg.mif

5tt2gmwmi 5tt_coreg.mif gmwmSeed_coreg.mif

#----------------- Run the streamlines
tckgen -act 5tt_coreg.mif -backtrack -seed_gmwmi gmwmSeed_coreg.mif -nthreads 8 -maxlength 250 -cutoff 0.06 -select 10000000 fod.mif tracks_10M.tck

#-----------------HCP atlas prep -----------
#Using files taken from this link: GitHub - mbedini/The-HCP-MMP1.0-atlas-in-FSL: A volumetric version of the HCP-MMP1 atlas conveniently imported in FSL. This repo was used in Bedini, M., Olivetti, E., Avesani, P., & Baldauf, D. (2023). Accurate localization and coactivation profiles of the frontal eye field and inferior frontal junction: an ALE and MACM fMRI meta-analysis. Brain Structure and Function, 1-21.
labelconvert MNI_Glasser_HCP_v1.0.nii HCP-Multi-Modal-Parcellation-1.0.txt ~/mrtrix3/share/mrtrix3/labelconvert/hcpmmp1_ordered.txt MNI_Glasser_HCP_nocoreg.mif
mrtransform MNI_Glasser_HCP_nocoreg.mif -linear diff2struct_mrtrix.txt -inverse -datatype uint32 MNI_Glasser_HCP_coreg.mif

#----------------- Constructing the connectome
tck2connectome -assignment_end_voxels -symmetric -zero_diagonal tracks_10M.tck MNI_Glasser_HCP_coreg.mif MNI_Glasser_HCP_coreg.csv -out_assignment assignments_sub_hcpmmp.csv

I fixed the issue by creating nocoreg and coreg filex with following codeline

Supplementary files such as = hcpmmp1_original.txt and hcpmmp1_ordered.txt can be obtained from BATMAN tutorial

Codeline for creating coreg.mif file for constructing connectome

Patient_recon file is my recon-all output

mri_surf2surf --srcsubject fsaverage --trgsubject patient_recon --hemi lh --sval-annot $SUBJECTS_DIR/fsaverage/label/lh.HCP-MMP1.annot --tval $SUBJECTS_DIR/patient_recon/label/lh.HCP-MMP1.annot

mri_surf2surf --srcsubject fsaverage --trgsubject patient_recon --hemi rh --sval-annot $SUBJECTS_DIR/fsaverage/label/rh.HCP-MMP1.annot --tval $SUBJECTS_DIR/patient_recon/label/rh.HCP-MMP1.annot

mrconvert –datatype uint32 hcpmmp1.mgz hcpmmp1.mif

labelconvert hcpmmp1.mif hcpmmp1_original.txt hcpmmp1_ordered.txt hcpmmp1_parcels_nocoreg.mif

mrtransform hcpmmp1_parcels_nocoreg.mif –linear diff2struct_mrtrix.txt –inverse –datatype uint32 hcpmmp1_parcels_coreg.mif

tck2connectome -assignment_end_voxels -symmetric -zero_diagonal tracks_10M.tck hcpmmp1_parcels_coreg.mif connectome_of_patient.csv -out_assignment assignments_of_patient_sub_hcpmmp.csv

tck2connectome: [100%] Constructing connectome /// code ran without “following nodes are not aligned” warning :slight_smile:

++ Now you can see how well coreg file fits