AFNI Jazzercise Answers

 

Below are the solutions to the AFNI Jazzercise questions.

 

  1. 3dbucket –prefix some_stats func_slim+origÕ[0,3-$]Õ

 

  1. 3dMean –prefix anat_mean  anat+orig second_anat+orig

 

  1. 3dAutomask –apply_prefix anat_auto anat+orig

3dSkullStrip –input anat+orig –prefix anat_3dSkull &

 

  1. Making and Playing with ROI Masks:
    1. 3dcalc -a Ôfunc_slim+orig[2]Õ -b Ôfunc_slim+orig[4]Õ  \

 -expr Ôispositive(a-4.2) * ispositive(b-4.2)Õ  \

 -prefix VA_mask

 

    1. 3dcalc -a Ôfunc_slim+orig[2]Õ -b Ôfunc_slim+orig[4]Õ    \

 -expr Ôispositive(a-4.2) + 2 *ispositive(b-4.2)Õ \

 -prefix VA_mask_4

           

    1. Use the ÒPos?Ó toggle button (in the AFNI GUIˆDefine OverLay) for positive-only intensities, and set the Ò#**Ó (number of colors) to 4.  Red, orange and yellow are values 1, 2, and 3, respectively. Alternatively, use one of the ROI color scales (right click on the overlay color bar) for the overlay named (ROI_32) and use a corresponding maximum, i.e. 32 with positive only intensities.

 

    1. 3dROIstats –mask VA_mask+orig –quiet epi_r1+orig > VA_mean.1D

 

  1. Fun with 1D files:
    1. count -column 1 10 > col1.1D

count -column 11 20 > col2.1D

count -column 21 30 > col3.1D

 

      or

 

count 1 10  > row1.1D

count 11 20 > row2.1D

count 21 30 > row3.1D

 

1dtranspose row1.1D > col1.1D

1dtranspose row2.1D > col2.1D

1dtranspose row3.1D > col3.1D

 

    1. 1dcat col1.1D col2.1D col3.1D > 3cols.1D

 

or

 

1dcat col?.1D > 3cols.1D

 

or

 

1dcat row1.1D\' row2.1D\' row3.1D\' > 3cols.1D

 

 

 

    1. 1dcat col1.1D col2.1D col3.1D           \

col3.1D col2.1D col1.1D  > 6cols.1D

 

or

 

1dcat 3cols.1D'[0..$,$..0]Õ > 6cols.1D

 

 

    1. 1deval -a Ô6cols.1D[0]Õ -b Ô6cols.1D[1]     \

  -c Ô6cols.1D[2]Õ -d Ô6cols.1D[3]    \

  -e Ô6cols.1D[4]Õ -f Ô6cols.1D[5]    \

  -expr Ô(a+b+c+d+e+f)/6Õ > ex_mean.1D

 

or

 

3dTstat -mean -prefix ex_mean.1D 6cols.1D

 

  1. Fun with the afni GUI:
    1. Right-click the gray-scale bar of any viewing plane (e.g., sagittal) and select the Choose Display Mode Range.  Type in the numbers 300 1200.

 

    1. Go to Define OverLay in the afni GUI.  For both OLay and Thr select sub-brick #0 (Full F-stat).  To display only positive overlay values, click on the ÒPos?Ó button.  To show only 8 panels in the color bar, select the Ò#8Ó button just below the color bar in the overlay panel.  Now place your cursor on the color panel that is colored pink.  If you leave your cursor there for a moment, the numbers 45-90 will appear.  This means that F-values that fall within this range will appear in the Overlay dataset as pink.  To change the color from pink to lime green, left-click on the pink panel and a hidden pop-up menu will appear that allows you to change the color.

 

    1. The easiest way to save a jpeg file is to right-click on the Sav1.ppm button in the sagittal viewer.  This will open a hidden menu that allows you to save the image as a ppm, jpg, gif, tif, etc.  Select the jpg button.  This will change the Sav1.ppm to a Sav1.jpg button.  Click on that and type in the prefix name cool_slide and save it.

 

    1. Right click in one of the viewing planes (e.g., sagittal), which will open a hidden menu.  Select the Talairach To button and select the right cuneus from the menu.

 

    1. Go to the sagittal viewer and click on the Mont (Montage) button at the bottom of the viewer.  This will open the Montage controller.  Select 3 slices Across, 2 slice Down and Set.

 

    1. The Mission Statement is hidden in the empty space in the bottom left-hand corner of the afni GUI (just to the right of the Done button).  Right-click in this empty space to gain access to the Mission Statement and other AFNI tidbits.

 

  1. Doing calculations in AFNI:
    1. 3dinfo func_slim+orig

 

In the output, look for lines starting with Ô--At sub-brickÕ.  The datum type is given following Ôdatum type isÕ.

 

    1. ccalc Ô22.3 * 44.5Õ

 

c. 1deval -num 100 -dx 0.2 -expr 'sin(x)/(1+x)' | 1dplot -dx 0.2 -stdin

 

  1. Aligning data:

align_epi_anat.py –anat anat+origepi epi_r1+orig –epi_base 4 –suffix _jazzal \

  -AddEdge

cd AddEdge

afni –niml –yesplugouts &

@AddEdge

 

 

 

  1. Image Filtering:
    1. 3dmerge -1blur_fwhm 8 -doall -prefix ex_blur8 epi_r1+orig

or

            3dBlurInMask -input epi_r1+orig -FWHM 8 -automask

 

    1. 3dLocalstat –nbhd ÔRECT(0,0, -3)Õ –stat min \

-prefix ex_minz3 anat+orig

 

    1. 3danisosmooth –viewer –prefix ex_anisotest ex_minz3+orig

3danisosmooth –prefix ex_anisoiters 3 ex_minz3+orig

 

 

  1. Random Exercises with AFNI Datasets:
    1. 3dinfo anat+orig    (and look for –orient)

3daxialize –prefix exLPI –orient LPI anat+orig

3dresample –prefix exLPI –orient lpi –inset anat+orig

 

    1. 3dbucket –prefix ex_arel_coef func_slim+origÕ[3]Õ

3dbucket –prefix ex_arel_tstat func_slim+origÕ[4]Õ

 

    1. 3dbucket –prefix ex_arel \

   ex_arel_coef+orig ex_arel_tstat+orig

 

    1. adwarpapar anat+tlrcdpar func_slim+orig \

 -prefix func_slim4mm –dxyz 4

 

    1. 3dmaxima –input func_slim4mm+tlrcÕ[0]Õ | head

whereami –22 93 16 -rai

 

    1. 3dZcutup –keep 40 90 –prefix anat_40_90 anat+orig

 

  1. Volume Rendering:
    1. Define Datamode, Plugins, Render [New]. Select Underlay to be anat+tlrc. Render with Draw. Rotate with the roll, pitch, yaw controls (preferably with DynaDraw turned on)
    2. If you do not already have the func_slim4mm+tlrc dataset created in 10d, select Overlay dataset to be func_slim+orig in main AFNI controller. In Define Datamode meu, choose Write Olay to disk to write out func_slim+tlrc dataset (or use adwarp or @auto_tlrc to do the same from the command line). In Render menu, choose Overlay, ÒChoose Overlay DatasetÓ and choose func_slim+tlrc. Set the overlay and threshold sub-bricks to Full F-stat as in the usual Overlay control panel adjusting the threshold to 10. Set ÒShow thruÓ, and the ÒShow thruÓ percent to be about 70% and color opacity to 0.5.
    3. Right-click on the image viewer and select ÒWhere am I?Ó Depending on whether you pick a voxel on the left or right you may find cuneus, fusiform gyrus or middle occipital gyrus. Right-click on the image viewer again and choose ÒShow Atlas colorsÓ or create an ROI datasets with the Draw Dataset plugin and add a Talairach region. Select the region you found with ÒWhere am I?Ó and choose a color for it. In the Render plugin (and the overlay panel if you want to see it in the normal image viewer too), turn on ÒSee TT atlasÓ. Nudge the overlay threshold again and choose ÒDrawÓ again. If you turn on the ÒaccumulateÓ function, you can get a video recording of changes you do in the rendering.  Record as you ÒrollÓ and ÒpitchÓ the rendering and play back the video
  2. Simple statistics:
    1. 3dinfo -verb rall_func+orig | less
    2. 3dinfo -verb rall_func+orig | less
    3.  cdf -t2p fitt 4.25 436

    fdrval -pval rall_func+orig 6 4.25

d.  cdf -p2t fitt 0.0001 436

fdrval -pval rall_func+orig 6 3.92689

cdf -p2t fitt 0.0002 436

fdrval -pval rall_func+orig 6 3.75089