Labletable in an ROI file

Hello,

I want to insert a label table in the final connectivity matrix.
I generated the connectivity matrices and I am using the DKT parcellation files generated from freesurfer for the in_rois in 3dNetCorr script using the following command:

3dNetCorr -prefix netcorr -mask mask_GM_resam+orig.BRIK -ts_out -fish_z -inset errts_DKT_fs+orig -in_rois DKT_resample+orig -output_mask_nonnull -push_thru_many_zeros -ts_wb_corr -prefix netcor_output/

fat_mat_sel.py --matr_in _000.netcc --Pars=“CC” --A_plotmin=0.27 --B_plotmax=1 --Tight_layout_on --dpi_file=75 -L 2 -d 300 -S 2

What is the proper way to do it?

Hi, Naveed-

There is a tutorial for working with ROIs here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/rois_corr_vis/cat_netcorr.html
which includes attaching a labeltable. You will be happiest if you attach a labeltable to your map of ROIs/targets before running 3dNetCorr.

There are more pieces there than just what you need, but some of the other parts might be helpful, as well.

–pt

Thank you Paul.

Hi Paul,
I made the label table with ROIs and the 3dNetCorr. Can you please let me know why the arrangement of labels in the output file is not correct. it should look like this for correct plotting with fat_mat_sel.py

75 # Number of network ROIs

2 # Number of netcc matrices

WITH_ROI_LABELS

  l_HC l_ENTH l_AG l_THAL	l_CAUD l_PUTA l_PALL l_ACUM l_cACC l_cMFC l_CUN	l_FG l_IP l_infTC l_isthCC l_OC l_latOFC l_LING l_medOFC l_midTC l_paraHC l_paraCent l_parsOPC l_parsORB l_parsTRI l_periCalc l_postCent l_PCC l_preCent l_PCUN l_rACC l_rmidFC l_SF l_SP l_supTC l_supraMG l_transTC l_insula r_HC r_ENTH r_AG r_THAL r_CAUD r_PUTA r_ACUM r_cACC r_cMFC r_CUN r_FG r_IP r_infTC r_isthCC r_OC r_latOFC r_LING r_medOFC r_midTC r_paraHC r_paraCent r_parsOPC r_parsORB r_parsTRI r_periCalc r_postCent r_PCC r_preCent r_PCUN r_rACC r_rmidFC r_SF r_SP r_supTC r_supraMG r_transTC r_insula
      1 	          2 	          3 	          4 	          5 	          6 	          7 	          8 	          9 	         10 	         11 	         12 	         13 	         14 	         15 	         16 	         17 	         18 	         19 	         20 	         21 	         22 	         23 	         24 	         25 	         26 	         27 	         28 	         29 	         30 	         31 	         32 	         33 	         34 	         35 	         36 	         37 	         38 	         39 	         40 	         41 	         42 	         43 	         44 	         46 	         47 	         48 	         49 	         50 	         51 	         52 	         53 	         54 	         55 	         56 	         57 	         58 	         59 	         60 	         61 	         62 	         63 	         64 	         65 	         66 	         67 	         68 	         69 	         70 	         71 	         72 	         73 	         74 	         75 	          76

CC

  1.0000	      0.2930	      0.2618	      0.1602	      0.2252	      0.2329	      0.0053	     -0.0236	      0.2610	      0.3930	      0.3828	      0.5971	      0.6453	      0.5672	      0.5194	      0.4463	      0.2827	      0.4747	      0.3154	      0.5589	      0.3885	      0.4375	      0.2431	      0.4167	      0.3031	      0.4576	      0.5394	      0.3068	      0.5241	      0.5965	      0.1410	      0.3969	      0.5253	      0.5576	      0.4806	      0.4609	      0.3417	      0.4302	      0.5698	      0.2076	      0.2415	      0.1757	      0.2298	      0.2368	      0.0475	      0.1693	      0.4412	      0.4170	      0.5389	      0.5736	      0.5673	      0.4129	      0.4158	      0.4562	      0.4585	      0.3164	      0.5369	      0.3122	      0.4774	      0.3446	      0.4415	      0.3253	      0.4657	      0.4514	      0.2422	      0.5478

However, my output files are generated in this form and I have to rearrange the labels manually for each file. Can you please let me know where I am making a mistake?

74 # Number of network ROIs

2 # Number of netcc matrices

WITH_ROI_LABELS

  l_HC
    l_ENTH
      l_AG
    l_THAL
    l_CAUD
    l_PUTA
    l_ACUM
    l_cACC
    l_cMFC
     l_CUN
      l_FG
      l_IP
   l_infTC
  l_isthCC
      l_OC
  l_latOFC
    l_LING
  l_medOFC
   l_midTC
  l_paraHC
 l_paraCent
 l_parsOPC
 l_parsORB
 l_parsTRI
 l_periCalc
 l_postCent
     l_PCC
 l_preCent
    l_PCUN
    l_rACC
  l_rmidFC
      l_SF
      l_SP
   l_supTC
 l_supraMG
 l_transTC
  l_insula
      r_HC
    r_ENTH
      r_AG
    r_THAL
    r_CAUD
    r_PUTA
    r_ACUM
    r_cACC
    r_cMFC
     r_CUN
      r_FG
      r_IP
   r_infTC
  r_isthCC
      r_OC
  r_latOFC
    r_LING
  r_medOFC
   r_midTC
  r_paraHC
 r_paraCent
 r_parsOPC
 r_parsORB
 r_parsTRI
 r_periCalc
 r_postCent
     r_PCC
 r_preCent
    r_PCUN
    r_rACC
  r_rmidFC
      r_SF
      r_SP
   r_supTC
 r_supraMG
 r_transTC
   r_insula

      1 	          2 	          3 	          4 	          5 	          6 	          8 	          9 	         10 	         11 	         12 	         13 	         14 	         15 	         16 	         17 	         18 	         19 	         20 	         21 	         22 	         23 	         24 	         25 	         26 	         27 	         28 	         29 	         30 	         31 	         32 	         33 	         34 	         35 	         36 	         37 	         38 	         39 	         40 	         41 	         42 	         43 	         44 	         46 	         47 	         48 	         49 	         50 	         51 	         52 	         53 	         54 	         55 	         56 	         57 	         58 	         59 	         60 	         61 	         62 	         63 	         64 	         65 	         66 	         67 	         68 	         69 	         70 	         71 	         72 	         73 	         74 	         75 	          76

CC

  1.0000	      0.5484	      0.6696	      0.3177	      0.1300	      0.2092	      0.0221	      0.1795	      0.3297	      0.4257	      0.4496	      0.3178	      0.0160	      0.4467	      0.0559	      0.1825	      0.6739	      0.4040	      0.1962	      0.2034	      0.1744	     -0.2144	     -0.2018	     -0.4397	      0.4416	      0.2290	      0.1993	      0.1571	      0.5279	     -0.1066	      0.0829	      0.2763	      0.2152	      0.6014	     -0.0272	      0.4296	      0.2116	      0.8999	      0.4668	      0.7927	      0.1417	     -0.0310	      0.2667	      0.3616	      0.1497	      0.2404	      0.2598	      0.4097	      0.2180	      0.1839	      0.3100	      0.0710	      0.4058	      0.4294	     -0.0207	      0.4097	      0.7305	      0.3040	     -0.2437	      0.1626	     -0.1619	      0.3771	      0.2375	      0.2715	      0.1674	      0.4316	     -0.0865	     -0.1020	      0.1848	      0.2654	      0.2551	     -0.0270	      0.3550	      0.1052
  0.5484	      1.0000

Hi, Naveed-

@MakeLabelTable should be run on teh ROI file, and then things just get passed along to 3dNetCorr.

What was your @MakeLabelTable command, and perhaps a couple lines of your list file of keys and values input into it?

–pt

Yes, I did they way to told me. I used the following command to make a table.
@MakeLabelTable -lab_file …/DKT.txt 1 0 -labeltable sub.niml.lt -dset DKT_resample+orig

then pass it to 3dNetCorr as
3dNetCorr -prefix netcorr -mask mask_GM_resam+orig.BRIK -ts_out -fish_z -inset errts_DKT_fs+orig -in_rois DKT_resample+orig -output_mask_nonnull -push_thru_many_zeros -ts_wb_corr -ts_wb_strlabel sub.niml.lt

a data input file for labels looks like this

1 l_HC
2 l_ENTH
3 l_AG
4 l_THAL
5 l_CAUD
6 l_PUTA
7 l_PALL
8 l_ACUM
9 l_cACC
10 l_cMFC
11 l_CUN
12 l_FG
13 l_IP
14 l_infTC
15 l_isthCC
16 l_OC
17 l_latOFC

I tried your commands on dsets here, and the output *netcc files looked fine.

I don’t you if perhaps there is a bad character in that D*txt file? You can check with:


file_tool -show_bad_all -infiles DKT.txt

Sidenote: this should not be included in the 3dNetCorr command:


sub.niml.lt

That option does not take an argument:


-ts_wb_strlabel  :by default, '-ts_wb_{corr,Z}' output files are named
                      using the int number of a given ROI, such as:
                        WB_Z_ROI_001+orig.
                      with this option, one can replace the int (such as
                      '001') with the string label (such as 'L-thalamus')
                      *if* one has a labeltable attached to the file.

I don’t see that affecting the 3dNetCorr stuff, though.

–pt

Hi Paul,
Thank you for your help. Can you please guide me about how can I insert the label table inside the ROI file?

What is the proper way to pass the label table argument in 3dNetCorr command?

Hi, Naveed-

You don’t pass the labeltable at all via the command line; 3dNetCorr reads it from the '-in_rois …" file directly.

–pt

… and if you type:


3dinfo -labeltable DKT_resample+orig 

what do you get? Just the first ~10 lines or so would be good enough to see what is happening-- mainly, does the label in the second column of output look reasonable, or does it have some kind of newline character or something in it?

In the test I did running similar commands to yours on my computer, the top of the output looked like:


<VALUE_LABEL_DTABLE
  ni_type="2*String"
  ni_dimen="17" >
 "4" "l_THAL"
 "13" "l_IP"
 "5" "l_CAUD"
 "14" "l_infTC"
 "6" "l_PUTA"
 "15" "l_isthCC"
 "7" "l_PALL"
 "16" "l_OC"
 "1" "l_HC"

etc.

–pt

Yes you are right here is the problem.

How can I fix it?

naveed@cmfisher:/data/data05/naveed/1.Projects/7.MCSA_rs-fMRI/BS0001MC_20180315.results$ 3dinfo -labeltable DKT_resample+orig
<VALUE_LABEL_DTABLE
ni_type=“2*String”
ni_dimen=“76” >
“6” "l_PUTA
"
“13” "l_IP
"
“36” "l_supraMG
"
“41” "r_AG
"
“59” "r_paraHC
"
“64” "r_periCalc
"
“7” "l_PALL
"
“14” "l_infTC
"

I think you ahve a bad character in the text file that you are using to make the labeltable with @MakeLabelTable.

Rick wrote a program that, among other things, can check for badness:


file_tool -show_bad_all -infiles ../DKT.txt

You can see if the program can fix the text file and output a new one:


file_tool -show_bad_all -infiles ../DKT.txt -prefix OUTPUT

… and use “OUTPUT” (or whatever better name you have for it) as the lab_file in @MakeLabelTable.

–pt

[a reply to this thread was forked to a separate thread here:
https://afni.nimh.nih.gov/afni/community/board/read.php?1,159986,159986#msg-159986
because it asked a new question.

… but the aforementioned “file_tool” usage seems to have solved the issue.

–pt