1dDW_Grad_o_Mat++ in fat_proc_filter_dwis

Dear Afni experts,

I am executing the command:
fat_proc_filter_dwis -in_dwi /home/ahoxha/Desktop/dti_fatproc/dwi_nii.nii.gz -in_col_matT /home/ahoxha/Desktop/dti_fatproc/dwi_nii_matT.dat -prefix /home/ahoxha/Desktop/dti_fatproc/filt

and the program gives me error:
++ Start script version: 3.1
++ 3dinfo: AFNI version=AFNI_17.3.06 (Dec 5 2017) [64-bit]
++ Found inset DWI file: /home/ahoxha/Desktop/dti_fatproc/dwi_nii.nii.gz
++ Based on prefix, the output directory will be:
/home/ahoxha/Desktop/dti_fatproc/filt
++ Based on prefix, the output prefix will be:
filt
+* Output directory didn’t exist. Trying to make ‘/home/ahoxha/Desktop/dti_fatproc/filt’ now.
-----> STARTING fat_proc_filter_dwis ---->
This command:
fat_proc_filter_dwis -in_dwi /home/ahoxha/Desktop/dti_fatproc/dwi_nii.nii.gz -in_col_matT /home/ahoxha/Desktop/dti_fatproc/dwi_nii_matT.dat -prefix /home/ahoxha/Desktop/dti_fatproc/filt/filt
++ Echoing the command to: /home/ahoxha/Desktop/dti_fatproc/filt/filt_cmd.txt
+++ Command Echo:
1dDW_Grad_o_Mat++ -overwrite -in_col_matT /home/ahoxha/Desktop/dti_fatproc/dwi_nii_matT.dat{} -out_col_matT /home/ahoxha/Desktop/dti_fatproc/filt/filt_matT.dat
** FATAL ERROR: Error reading gradient vector file

however if I run the command on its own:
1dDW_Grad_o_Mat++ -overwrite -in_col_matT /home/ahoxha/Desktop/dti_fatproc/dwi_nii_matT.dat{} -out_col_matT /home/ahoxha/Desktop/dti_fatproc/filt/filt_matT.dat
t
++ Have read in data.
++ Have organized the data internally.
++ Maximum bvalue appears to be: 1100.00061
++ My view of grads at the moment (postflip, if asked for):

 bval scale        bvecs: x               y               z
    0.00000         0.00000         0.00000         0.00000
 1099.99988        -0.99978        -0.02094         0.00182
 1099.99988        -0.02094         0.99978        -0.00182
 1099.99951        -0.03995         0.64796        -0.76063
 1099.99951         0.60706        -0.75410        -0.25061
 1100.00024         0.22512         0.52953         0.81787
 1099.99988         0.88795         0.27747         0.36681
 1100.00037        -0.79263        -0.14549         0.59209
 1099.99963        -0.21397        -0.93421         0.28541
 1099.99976        -0.93203        -0.15942         0.32544
 1100.00012        -0.52306         0.83385        -0.17633
 1100.00024        -0.36405         0.83957        -0.40323
 1100.00000        -0.46967         0.62047        -0.62804
 1099.99976         0.47928         0.39938         0.78153
 1100.00049        -0.63146         0.65911        -0.40844
 1099.99988        -0.57398        -0.11732         0.81042
 1100.00024         0.81597         0.53815         0.21115
 1099.99951        -0.89378         0.02110        -0.44801
 1099.99951        -0.30097         0.53443        -0.78981
 1100.00012        -0.13617         0.95955        -0.24643
 1099.99988         0.80894        -0.38662        -0.44288
 1099.99963        -0.49636        -0.85024         0.17524
 1100.00012         0.79240        -0.13687        -0.59444
 1099.99963         0.95424        -0.21305        -0.20983
 1100.00012        -0.21657        -0.78689         0.57784
 1099.99988        -0.01722        -0.18781         0.98206
 1100.00024         0.23686        -0.95119        -0.19780
 1099.99976         0.78687        -0.58774        -0.18815
 1099.99951        -0.16790         0.35198        -0.92083
 1100.00012         0.16200        -0.72868        -0.66542
 1099.99976        -0.87919        -0.43498         0.19444
 1099.99951         0.56722        -0.22004        -0.79363
 1099.99951        -0.38317         0.13485        -0.91378
 1100.00037        -0.30132        -0.20497         0.93123
 1099.99963         0.32993         0.13699         0.93401
 1099.99951         0.95755         0.28514         0.04237
 1100.00000        -0.96344         0.18447        -0.19429
 1100.00061         0.47173        -0.87923        -0.06644
 1100.00012        -0.78615         0.61152        -0.08950
 1100.00000        -0.69964        -0.42224         0.57639
 1099.99976        -0.69233         0.00927        -0.72153
 1099.99939         0.67084         0.54331         0.50476
 1100.00037         0.12678         0.72863         0.67307
 1099.99939        -0.74753         0.37225        -0.55012
 1099.99988        -0.12020         0.81883        -0.56131
 1100.00037         0.59691        -0.58429        -0.54982
 1099.99976         0.08129         0.33698         0.93800
 1100.00012         0.53522         0.80440         0.25784
 1100.00037        -0.84732         0.44016        -0.29715
 1100.00000         0.37501        -0.55402        -0.74325
 1100.00024         0.19214        -0.38848        -0.90120
 1100.00012         0.70641         0.70776         0.00771
 1099.99988         0.41894         0.69172         0.58822
 1100.00024        -0.48692        -0.69983         0.52263
 1099.99951        -0.16020        -0.51166         0.84412
 1100.00012        -0.45330        -0.43208         0.77963
 1100.00024         0.40219        -0.80146        -0.44260
 1100.00024         0.70842         0.26251         0.65515
 1100.00012         0.24141         0.89059         0.38544
 1100.00049         0.00070        -0.07688        -0.99704
 1100.00024         0.05601        -0.90171        -0.42870
 1100.00037        -0.57588         0.29056        -0.76416
 1100.00012         0.28577        -0.13922        -0.94813
 1099.99976        -0.70785        -0.62267         0.33351
 1100.00037         0.24678         0.96547         0.08348

++ Number of ref vec/mats (b<0.000001): 1
Number of diffusion weighted vec/mats: 64
++ Keeping all vec/mats.
++ Output dims to be: 65 x 6
++ DONE with grad/matr. Check output file ‘/home/ahoxha/Desktop/dti_fatproc/filt_matT.dat’

And I check the filt_matT.dat file, and it is properly done. However I would want to continue the execution of the fat_proc_filter_dwis. Is there a way to fix the script to execute properly?

Thanks

Hi, Bit-warrior-

OK, I see what is happening. So, this program is meant for taking a set of DWI volumes and corresponding gradient file(s) and outputting a new set of those where bad volumes (and corresponding bad gradients) have been removed from each of those types of files. One specifies which are the “good” volumes+grads to keep by using the “-select …” option, using the AFNI index selection notation to specify good indices. For example, from the help of the program:


fat_proc_filter_dwis  \
        -in_dwi       UNFILT_AP/AP.nii.gz       \
        -in_col_matT  UNFILT_AP/AP_bmatT.dat    \
        -select       '0..5,8,20..$'           \
        -prefix       FILT_AP/AP

… this example would produce a new set of filtered data, having removed volumes with index [6] and [9-19] from both the DWI nifti file and the bmatrix file.

In your first example, you are not including any indices to keep using “-select …”, and so the program is unhappy (in truth, this is probably a minor bug, that if the user doesn’t specify any volumes the program could keep all of them). If you really want to keep all volumes, you could specify this in the following edited version of your command above:


fat_proc_filter_dwis -in_dwi /home/ahoxha/Desktop/dti_fatproc/dwi_nii.nii.gz -in_col_matT /home/ahoxha/Desktop/dti_fatproc/dwi_nii_matT.dat -prefix /home/ahoxha/Desktop/dti_fatproc/filt -select '0..$'

In general, if you aren’t filtering out any volumes, you probably don’t need to use this program, because the input and outputs will just be the same; however, I could guess that you might be using this in a general pipeline, and it is just the case that some subjects having nothing to filter. Therefore, using the above should sort things out.

Please let me know how that works for you.

And you may be aware of this already, but the string that comes after ‘-select …’ can be built using the fat_proc_select_vols program, which uses some nice AFNI driving functionality (courtesy of J. Rajendra) to have the user click on a montage view of the DWIs to point out bad volumes, building a selection string. But one can also specify the selection string based on other approaches, as well.

–pt [borrowing g. chen’s login]