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
External Email - Use Caution
Hello,
Reaching out here again. Anybody able to respond to this?
The freesurfer wiki is empty for 50% of the functions.
Thanks, Best, -Loïc
On Mon, Aug 25, 2025 at 18:25 Loïc Daumail loic.daumail@gmail.com wrote:
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
I'm not sure what you are trying to do. If you have some diffusion data that you want to map to the anatomical, you can use one of the b=0 scans to register using bbregister, eg, bbregister --mov b=0template.nii.gz --s subject --t2 --reg register.lta You can then run mri_vol2vol --mov your-diffusion-measure.nii.gz --reg register.lta --fstarg --o your-diff-in-anat.nii.gz This will use linear interp by default. This will also map it to the "conformed" anatomical space (256^3); it is possible to map it to the native anatomical space.
On 8/30/2025 7:03 PM, Loïc Daumail wrote:
External Email - Use Caution
Hello,
Reaching out here again. Anybody able to respond to this?
The freesurfer wiki is empty for 50% of the functions.
Thanks, Best, -Loïc
On Mon, Aug 25, 2025 at 18:25 Loïc Daumail loic.daumail@gmail.com wrote:
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
Freesurfer mailing list --freesurfer@nmr.mgh.harvard.edu To unsubscribe send an email tofreesurfer-leave@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman3/lists/freesurfer@nmr.mgh.harvard.e...
freesurfer@nmr.mgh.harvard.edu