Using for .grid output

I’m glad I stumbled upon, which should make things easier. I’m trying to extract the FA and MD only, from the .grid output of 3dTrackID PROB.

Here is the command I am using:
-in_csv tableize_CSV.csv
-in_listfile tableize_LIST.csv
-prefix tableizeoutput
-pars FA MD


  1. What does this error suggest that I received? NameError: global name ‘file_inp’ is not defined.

  2. Is there a way to extract specific rows/cols from the FA and MD matrices rather than the entire 318x318 matrices (we have 318 rois)? I am only interested in OR-logic. Thus, row 1 / col 1, row 2 / col 2… row 318 / col 318… and NOT row 1 / col 40, for example.

I thought attaching the csvs and .grids here would be helpful for you to see to answer my questions but those aren’t valid attachments in this forum. Let me know if I could upload/email them to you.

Thank you very much

Hi, Ellen-

That program was started during the summer to be the replacement of generalization of, but I have not had a chance to complete it yet. It is likely not very ready for prime time yet, unfortunately.

If you want, you can email me the text files you have, and I can take a look. But it is likely that the FAT_MVM_DEMO (@Install_FAT_MVM_DEMO, if you don’t have it on your computer already), would be a better way to go at present.

There are not tools for extracting the OR-logic diagonal.


Hi pt,
ah, I didn’t know about FAT_MVM_DEMO but yes that is also suitable.

Oddly, while completed for me, not all the roi connections were extracted into _MVMtbl.txt. As I have 318 rois, there should be 318x318 connections including AND and OR-logic. However, only 34 [seemingly random] roi connections were extracted:

Any idea why? (I just emailed you the text data so you can see what I’m working with!)

I’m also trying to make sure I understand whether to use -u / – unionize option. My understanding is that any ‘0’ values in the FA matrix means that there were no tracts found, thus ‘0’ is actually equivalent to ‘NA’, correct? In that case, I believe I should not use -u because I do not want to place a value of ‘0’ for nonexistent tracts.

PS: If you end up believing that should be usable with my data let me know, because it does seem more streamlined. I do not plan to use 3dMVM as I’ll be exporting everything to R.

Hi, Ellen-

Thanks, I’ll look at your data, but I note that the selected ROIs are not chosen randomly. This program was built to prepare taking 3dNetCorr and 3dTrackID outputs and build 3dMVM tables+commands. 3dMVM does not handles missing data across subjects (in most cases). So, the ROIs here are those ROIs where tracts were found across all subjects.

The above is the “intersection” of nonzero regions; the “-unionize” option puts all ROIs into the table, whether they have zero values or not.


ok, so it seems like a solution could be to use the “-unionize” option in order to have a table including ALL available data from the 318x318 rois, and then replace zero values by “NA” ?

(just wanting to confirm that you are using “zero values” and “missing data” synonymously in your message above)

Hi, Ellen-

For diffusion-based matrices (*.grid files, from 3dTrackID), each matrix element should be >0 if a tract was found, and only 0 if a tract was not found. It would make sense that those could then be treated as NA in R.

For FMRI-based matrices (*.netcc files, from 3dNetCorr), it is possible that a matrix element could be exactly zero from correlation (though, veeery small but nonzero is more likely for cases of being highly uncorrelated). So I think you would basically always want all FMRI elements, even the zeros.


Ok great, understood.

btw, yesterday I ended up creating a python script that extracts the OR-logic values of FA from MD for each subject into a concatenated csv. Made more sense to just do that. So, no need for you to look at the data I emailed you yesterday for FAT_MVM or tableize.

Looks like I finally made it to the end of my AFNI journey, at least for this project - with a lot of assistance. Thanks for your help along the way pt! :smiley:

Hi, Ellen-

That is great.

But I don’t know if I would classify this as the end of the AFNI journey. Often, brain imaging resembles the Waste Land:
“We shall not cease from exploration
And the end of all our exploring
Will be to arrive where we started
And know the place for the first time.”