External Email - Use Caution
Hi Freesurfer community,
I am currently trying to project 3D density maps in individual diffusion
space onto the cortical surface (within individual space).
I'm not sure which registration function to use to obtain the register.dat
file required for mri_vol2surf .
Does bbregister work for this situation? If so, assuming I create a
registration from diffusion space (RASmm/ACPC) to fsnative, would the --mov
file as the T1w in diffusion space – same affine as that of the diffusion
data, and same resolution as diffusion data– (obtained from qsiprep) work
with the target being the T1 in fsnative space?
Or should I use another type of function such as tkregister2 or something
like this?
My current code is the following:
template_file = op.join(bids_path, 'derivatives', 'qsiprep', participant,
'anat',f"{participant}_space-ACPC_desc-preproc_T1w.nii.gz")
registration_file = op.join(out_dir, 'ACPC2fsnative_register.dat')
# 1) Generate registration file .dat
cmd = ["bbregister",
"--s", participant,
"--sd", fs_path,
"--mov", template_file,
"--reg", registration_file,
"--init-fsl",
"--t1"
]
print("Running:", " ".join(cmd))
subprocess.run(cmd, check=True, env={**os.environ, "SUBJECTS_DIR": fs_path})
#2) Apply ACPC2fsNative registration and project density map to surface
hemisphere = ['L', 'R']
roi = ['LeftMTxWMxLGN', 'RightMTxWMxLGN']
for h, hemi in enumerate(hemisphere):
mask = roi[h]
density_map = op.join(analysis_path, 'tdi_maps', 'dipy_tdi_maps',
participant, f"{participant}_ses-concat_desc-{mask}_tdi_map.nii.gz")
# density_img = nib.load(density_map)
# print(density_img.affine)
# Output file name
out_file = os.path.join(out_dir, f"{participant}_hemi-{hemi}
_space-fsnative_label-{mask}_tdi_on_surf.mgh")
if hemi == 'L':
hm = 'lh'
else:
hm = 'rh'
# Build mri_vol2surf command
cmd = [
"mri_vol2surf",
"--mov", density_map,
"--regheader", participant,
"--hemi", hm,
"--reg", registration_file,
"--surf", "white",
"--projfrac", "0",
"--sd", fs_path,
"--out", out_file
]
# Run the command
print("Running:", " ".join(cmd))
subprocess.run(cmd, check=True, env={**os.environ, "SUBJECTS_DIR": fs_path})
Thanks,
Best,
-Loïc