Hi Gurus,
Is there any way to export values, say T values or correlation coefficients, in stats file as a BRIK file using a ROI mask?
I’m not familiar with AFNI codes, so I will really appreciate it if you can show me a sample script.
Hi Gurus,
Is there any way to export values, say T values or correlation coefficients, in stats file as a BRIK file using a ROI mask?
I’m not familiar with AFNI codes, so I will really appreciate it if you can show me a sample script.
Hi-
Sure, there are lots of ways to do this kind of thing. The details matter a bit—is your ROI a lone mask region in its own volume, or is it in a “map” of ROIs and you are picking one out?
My guess is “3dcalc” is what you want. You can use subbrick selectors on a dset to pull out specific information. For example, to select the volume with index=7 in a 4D dataset (NB: index counting starts at 0, as in C and Python), you could write it in a 3dcalc expression as: DSET"[7]". Note the use of quotes, so the shell doesn’t interpret the square brackets before AFNI gets a hold of it. From part of 3dcalc’s help
INPUT DATASET NAMES
-------------------
This program accepts datasets that are modified on input according to the
following schemes:
'r1+orig[3..5]' {sub-brick selector}
'r1+orig<100..200>' {sub-range selector}
'r1+orig[3..5]<100..200>' {both selectors}
So, if you wanted to get the [7]th volume from DSET_STATS, and multiply it by a DSET_ROI mask, you could do:
3dcalc \
-a DSET_STATS"[7]" \
-b DSET_ROI \
-expr 'a*step(b)" \
-prefix DSET_OUT
Many AFNI statistics file outputs have string labels attached per volume, to record from whence they came (see “3dinfo DSET” or “3dinfo -verb DSET”). You can use these labels to select the volume as well; if your [7]th volume has the label “AAA#0_Coef”, you could write the equivalent expression to the above as:
3dcalc \
-a DSET_STATS"[AAA#0_Coef]" \
-b DSET_ROI \
-expr 'a*step(b)" \
-prefix DSET_OUT
If DSET_ROI has lots of values, and you want the ROI with value 4, then you could use:
3dcalc \
-a DSET_STATS"[7]" \
-b DSET_ROI"<4>" \
-expr 'a*step(b)" \
-prefix DSET_OUT
Note the different bracket being used to select by value for the “b” dset.
As you are getting familiar with this, checking your results in the GUI is key… and you can also check back here with questions.
For more general info:
You might find the online AFNI Bootcamp videos helpful as a resource:
https://www.youtube.com/c/afnibootcamp
… in particular about ROIs:
https://www.youtube.com/watch?v=po9Rtm61cdU&list=PL_CD549H9kgp2tgfKUskt4U5JgASxOHgR
There is also a categorized list of all/most AFNI programs with brief descriptions, for searchability:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/educational/classified_progs.html
–pt
Thank you very much for your reply!
The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.
Freedom of Information Act |
HHS Vulnerability Disclosure
National Institute of Mental
Health | National Institutes of Health | U.S.
Department of Health and Human Services |