Any way to convert a metric gifti to a scalar cifti?


Is there a way to convert hemipsheric metric gifti files in fs_LR space (s01.L.sulc.32k.shape.gii and s01.R.sulc.32k.shape.gii) to a HCP-style scalar cifti file (s01.sulc.32k.dscalar.nii)?

On the off chance, I tried workbench’s cifti convert command:

wb_command -cifti-convert -from-gifti-ext s01.L.sulc.32k.shape.gii s01.L.sulc.32k.dscalar.nii

But as anticipated, that resulted in an error, as the original gifti file was created from freesurfer data and not from a previous cifti-to-gifti conversion in workbench.

Any suggestions would be appreciated, as I am not having much luck with my google deep dive.



Hi @switt4 !

You should be able to use wb_command -cifti-create-dense-scalar for this! If you really just have e.g., some metric files from FreeSurfer (e.g., sulcal depth, curvature, thickness) then the following should work:

wb_command -cifti-create-dense-scalar out.dscalar.nii -left-metric s01.L.sulc.32k.shape.gii -right-metric s01.R.sulc.32k.shape.gii

If you only have one hemisphere you can provide either left-metric or right-metric.

Hope that helps!


Thanks for the quick response. The -cifti-create-dense-scalar command appears to be just what I am looking for.

So many file types to keep straight…