Creating Cifti Thickness File from FreeSurfer Output

Hi all!

I would like to create a cortical-thickness-file in the Cifti-file-format using the FreeSufer output. More specifically, I would like to use the fs_subjects/$subject/surf/lh.thickness and fs_subjects/$subject/surf/rh.thickness files, merge them and project them onto the fsaverage_LR32k Cifti-surface, i.e. create one single $subject.thickness.32k_fs_LR.dscalar.nii file. Does anybody know a way to achieve this?

Thanks in advance,

Hi @mtahedl, and welcome to neurostars!

I know that fMRIPrep will do this as part of its anatomical workflow as of the recently released 23.0.0, as long as you specify —cifti-outputs 91k in your command. You can try that (if you don’t have BOLD images you can try using the —anat-only flag too).


Hi Steven,

thanks for getting back :slight_smile: However, I’m particularly interested in doing that conversion independent of the (entire) fMRIPrep pipeline. Are you aware of a simple and quick line of commands to achieve that?


Not off the top of my head, but perhaps looking through the code that was added to enable this workflow could provide some clues ENH: Enable resampling morphometrics to fsLR CIFTI-2 files by effigies · Pull Request #325 · nipreps/smriprep · GitHub.


Hi @mtahedl, one option to try is the ciftify_recon_all command from ciftify. This is meant to convert a freesurfer output directory to CIFTI space and should be able to run outside of the full ciftify workflow - independent from the fMRIPrep-based processing.

Hi @pcamach2 , thank you! Yes, I’m aware of the Ciftify toolbox including the ciftify_recon_all command. You’re right, it does the conversion I’m looking for. However, one pre-requisite of using cifitfy_recon_all is to have the full FreeSurfer output at hand. I’m trying to find out whether there is a solution if you only have the lh.thickness file (and not the rest of the FreeSurfer output). Any input would be appreciated :slight_smile:

@mtahedl, I doubt this is possible with only the morphometric file. Those files are basically just data vectors, and do not contain geometric/anatomical information, which would be in the surface meshes (such as those output by recon-all). At some point you will need to register between native and fs_LR space, which is probably informed by outputs from recon-all.

1 Like

Hm, I see. Then let’s re-formulate my problem: I’m looking for the minimum number of files from the FreeSurfer output to create a cortical thickness file in the cifti-file format.

The following strategy came close to my solution: I’ve first created a metric file off the lh.thickness using anatomical information as follows:

mris_convert -c lh.thickness lh.white lh.thickness.gii

I repeated that for the right hemisphere. Then, I used a tool from workbench to do the gitft-to-cifti conversion:

wb_command -cifti-create-dense-scalar thickness.dscalar.nii -left-metric lh.thickness.gii -right-metric rh.thickness.gii

The result is indeed a cortical thikness file in the cifti-file format (“thickness.dscalar.nii”). However, it does not have the dimensions of the fs_LR_32k space (neither of the fs_LR_164k space, but it has 272439 vertices…). I’m now wondering how to register my result to the fs_LR_32k space.

I’m not sure what the minimum would be, but also do not think it matters, as it is likely the easiest one-line command to get them would be to run recon-all. What are your concerns about running recon-all?

If you really know what you’re doing, ?h.sphere.reg might be enough, in addition to the ?h.thickness files. I don’t personally know what I’m doing enough to make a suggestion beyond that.