Viewing CIFTI data in SUMA

From the SUMA help file (-cdset CDSET: Load and display a CIFTI dataset), I thought maybe I could view a CIFTI dataset with something like this:

suma -cdset 100307.MyelinMap_BC.164k_fs_LR.dscalar.nii -sv T1w_restore.nii.gz

But I know there’s both surface and volume information in the file. Do I need to separate those first?

Phil

We can do some limited things with the CIFTI datasets but not enough so far. The shape and func .gii GIFTI datasets should be readable in SUMA by clicking “Load Dset” in the object controller and removing the .niml.dset part of the file filter or converting with ConvertDset to a niml.dset file. 3dinfo and nifti_tool show some information about the CIFTI datasets, encapsulated in the NIFTI format, and 3dcalc can operate on these, but that’s it so far.

Mostly, I would recommend using either HCP toolbox workbench or nibabel.

cifti_tool -disp_cext -input Q1-Q6_RelatedParcellation210.L.CorticalAreas_dil_Black.32k_fs_LR.dlabel.nii | & grep VertexIndices > nodes.txt

          For a CIFTI file, which encodes the CIFTI extension
          in the NIFTI header.   Commands to ponder:
          set dset = Q1-Q6_RelatedParcellation210.thickness_MSMAll_2_d41_WRN_DeDrift.32k_fs_LR.dscalar.nii
          3dinfo $dset
          nifti_tool -disp_hdr -infiles $dset
          cifti_tool -disp_cext -input $dset | less

Method for extracting cifti using workbench tools into AFNI
#!/bin/tcsh
set wb_path = /Users/glend/Desktop/workbench/bin_macosx64
set anat_vol = …/Q1-Q6_RelatedParcellation210_AverageT1w_restore.nii.gz

first extract left cortex

set surf1 = Q1-Q6_RelatedParcellation210.L.pial_MSMAll_2_d41_WRN_DeDrift.32k_fs_LR.surf.gii
set surf2 = Q1-Q6_RelatedParcellation210.L.white_MSMAll_2_d41_WRN_DeDrift.32k_fs_LR.surf.gii
set cifti_set = Q1-Q6_RelatedParcellation210.L.CorticalAreas_dil_Colors.32k_fs_LR.dlabel.nii
set labels = left_labels.gii
set atlas_vols = ( left_hcp_atlas.nii right_hcp_atlas.nii )

Q1-Q6_RelatedParcellation210.L.CorticalAreas_dil_Final_Final_Areas_Group.32k_fs_LR.dlabel.nii

get labels as coloring gifti (index,rgb,structure name)

$wb_path/wb_command -cifti-separate $cifti_set COLUMN -label CORTEX_LEFT $labels

put labels into volume

$wb_path/wb_command -label-to-volume-mapping $labels $surf1 $anat_vol $atlas_vols[1]
-ribbon-constrained $surf1 $surf2

extract names of structures

grep “Key=” $labels
| tr -d ‘<’ | tr -d ‘>’ | sed ‘s/[/ /g’ | sed ‘s/]/ /g’ |
awk ‘{printf(“%s %s\n”, $2,$8)}’ | sed ‘s/"/ /g’ | sed ‘s/ L_/ /g’> left_labels.txt

repeat for right cortex

set surf1 = Q1-Q6_RelatedParcellation210.R.pial_MSMAll_2_d41_WRN_DeDrift.32k_fs_LR.surf.gii
set surf2 = Q1-Q6_RelatedParcellation210.R.white_MSMAll_2_d41_WRN_DeDrift.32k_fs_LR.surf.gii
set cifti_set = Q1-Q6_RelatedParcellation210.R.CorticalAreas_dil_Colors.32k_fs_LR.dlabel.nii
set anat_vol = …/Q1-Q6_RelatedParcellation210_AverageT1w_restore.nii.gz
set labels = right_labels.gii

get labels as coloring gifti (index,rgb,structure name)

$wb_path/wb_command -cifti-separate $cifti_set COLUMN -label CORTEX_RIGHT $labels

put labels into volume

$wb_path/wb_command -label-to-volume-mapping $labels $surf1 $anat_vol $atlas_vols[2]
-ribbon-constrained $surf1 $surf2

extract names of structures

grep “Key=” $labels
| tr -d ‘<’ | tr -d ‘>’ | sed ‘s/[/ /g’ | sed ‘s/]/ /g’ |
awk -p ‘{printf(“%s %s\n”, $2,$8)}’ | sed ‘s/"/ /g’ > right_labels.txt

combine left and right label volumes

3dcalc -a $atlas_vols[1] -b $atlas_vols[2] -expr ‘astep(a) + bstep(b)*not(a)’ -prefix hcp_atlas.nii.gz

make AFNI compatible volume

Thanks! Can set cifti_set be any of the cifti .nii files (i.e., not just labels)? The lab I’m working with wants to be able to analyze HCP preprocessed data with tools we already know how to use.

I haven’t tried it, but the wb_command help shows
wb_command -cifti-separate -volume-all myoutput.nii
might be what you want. The workbench forum should be able to provide better information, but I think that should work. You can also take the output surface gifti datasets and map into volumes with 3dSurf2Vol or @surf_to_vol_spackle.