AFNI might have a way to convert a 1D file to GIFTI label file. Then you can use wb_command -cifti-create-label.
On May 18, 2016, at 6:59 AM, Matthew George Liptrot <[email protected]> wrote: > Thanks Matt! > But now how do I create a dscalar file from a text file of labels (one label > ID per line, line number = vertex ID)? > Looking at the help for "wb_command -cifti-create-dense-scalar” it seems I > need a "metric” file for each surface – but what is the format of a metric > file? > > Cheers, > > M@ > > On 18/5/16 13:10 , "Glasser, Matthew" <[email protected]> wrote: > > You should be running the import command on a dscalar file that has your > parcellation in it with values that match the keys in your text file. > > Peace, > > Matt. > > From: <[email protected]> on behalf of Matthew George > Liptrot <[email protected]> > Date: Wednesday, May 18, 2016 at 4:39 AM > To: HCP Listserv <[email protected]> > Subject: [HCP-Users] Generating a dlabel.nii file from a new parcellation > > Hi, > > I'm trying to create a CIFTI dlabel.nii file from a novel parcellation we > have generated from a structural connectivity matrix. However, I seem to hit > a problem when the number of new clusters is less than those present in the > template CIFTI file I am using for its header-info. In this example below, I > want to generate a dlabel file with 68 clusters using the Desikan-Killiany > dlabel file as a skeleton. > > Here are the commands I am using: > > wb_command -cifti-label-import 100307.aparc.32k_fs_LR.dlabel.nii > CIFTI_LUT_ModelA_Clusters68.txt > 100307.aparc.32k_fs_LR_ButWithClusterLUT.dlabel.nii -drop-unused-labels > > wb_command -cifti-convert -from-text ClusterIDs_ModelA_Clusters68.txt > 100307.aparc.32k_fs_LR_ButWithClusterLUT.dlabel.nii > ModelA_Clusters68.32k_fs_LR.dlabel.nii > > wb_command -set-map-names ModelA_Clusters68.32k_fs_LR.dlabel.nii -map 1 > ModelA_Clusters68 > > Where the two textfiles used are defined thus: > > # CIFTI_LUT_ModelA_Clusters68.txt > A plain text file with lines: > Cluster_0001 > 1 85 85 0 255 > Cluster_0002 > 2 85 170 0 255 > Cluster_0003 > 3 85 255 0 255 > etc > > # ClusterIDs_ModelA_Clusters68.txt > A plain text file with lines: > 48 > 23 > 34 > 19 > etc > > However, running the command: > > wb_command -file-information <CIFTI_ModelClusters_dlabel> > > generates the following output: > > > Name: ModelA_Clusters68.32k_fs_LR.dlabel.nii > Type: Connectivity - Dense Label > Structure: CortexLeft CortexRight > Data Size: 237.65 Kilobytes > Maps to Surface: true > Maps to Volume: false > Maps with LabelTable: true > Maps with Palette: false > Number of Maps: 1 > Number of Rows: 59412 > Number of Columns: 1 > Volume Dim[0]: 0 > Volume Dim[1]: 0 > Volume Dim[2]: 0 > Palette Type: None > CIFTI Dim[0]: 1 > CIFTI Dim[1]: 59412 > ALONG_ROW map type: LABELS > ALONG_COLUMN map type: BRAIN_MODELS > Has Volume Data: false > CortexLeft: 29696 out of 32492 vertices > CortexRight: 29716 out of 32492 vertices > > Map Map Name > 1 ModelA_Clusters68 > > Label table for ALL maps > KEY NAME RED GREEN BLUE ALPHA > 0 ??? 1.000 1.000 1.000 0.000 > 1 Cluster_0001 0.333 0.333 0.000 1.000 > 2 Cluster_0002 0.333 0.667 0.000 1.000 > ... > 68 Cluster_0068 1.000 1.000 1.000 1.000 > 69 LABEL_69 0.776 0.055 0.686 1.000 > 70 LABEL_70 0.196 0.569 0.169 1.000 > > As you can see, the original number of labels is somehow retained. And even > though label values 69 and 70 are not present in the vertex:label mapping. > (If I use the 100307.aparc.a2009s.32k_fs_LR.dlabel.nii file as a template, > then I get a label table with 150 entries, again with the first 68 being the > new ones). > > This is despite passing the '-drop-unused-labels' option to "wb_command > -cifti-label-import”. (Not using ‘-drop-unused-labels’ gives the same result). > > So somehow I need to fully purge the CIFTI template file of its original LUT > when the number of clusters that I want to insert is less than was originally > present in the file. > Any ideas? Is there a better way to do this? > > Cheers, > > M@ > -- > -- > Matthew George Liptrot > > Assistant Professor > Image Group > Department of Computer Science > University of Copenhagen > & > Section for Cognitive Systems > Department of Applied Mathematics and Computer Science > Technical University of Denmark > > http://about.me/matthewliptrot > > > _______________________________________________ > HCP-Users mailing list > [email protected] > http://lists.humanconnectome.org/mailman/listinfo/hcp-users > _______________________________________________ HCP-Users mailing list [email protected] http://lists.humanconnectome.org/mailman/listinfo/hcp-users
