AFNI Jazzercise Answers

Below are the solutions to the AFNI Jazzercise questions.

1.  3dbucket --prefix some_stats func_slim+orig'\[0,3-\$\]'

2.  3dMean --prefix anat_mean anat1+orig anat2+orig anat3+orig

3.  3dAutomask --prefix anat_auto anat+orig

> 3dSkullStrip --input anat+orig --prefix anat_3dSkull &

4.  Making and Playing with ROI Masks:

    a.  3dcalc -a 'func_slim+orig\[2\]' -b 'func_slim+orig\[4\]' \\

> -expr 'ispositive(a-4.2) \* ispositive(b-4.2)' \\
>
> -prefix PN_mask

b.  3dcalc -a 'func_slim+orig\[2\]' -b 'func_slim+orig\[4\]' \\

> -expr 'ispositive(a-4.2) + 2 \*ispositive(b-4.2)' \\
>
> -prefix PN_mask_4

c.  Use the "**Pos?**" toggle button (in the AFNI GUIDefine 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.

d.  3dROIstats --mask PN_mask+orig --quiet epi_r1+orig \> PN_mean.1D

```{=html}
<!-- -->
```
5.  Fun with 1D files:

    a.  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

b.  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

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

> col3.1D col2.1D col1.1D \> 6cols.1D
>
> or
>
> 1dcat 3cols.1D\'\[0..\$,\$..0\]' \> 6cols.1D

d.  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

6.  Fun with the afni GUI:

    a.  Right-click the gray-scale bar of any viewing plane (e.g.,
        sagittal) and select the **Choose Display Mode Range**. Type in
        the numbers **500 1500**.

    b.  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. Now place
        your cursor on the color panel that is colored pink. If you
        leave your cursor there for a moment, the numbers 14.2-28.4 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.

    c.  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.

    d.  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 fusiform gyrus from the menu.

    e.  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**.

    f.  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.

7.  Doing calculations in AFNI:

    a.  3dinfo func_slim+orig

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

b.  ccalc '22.3 \* 44.5'

```{=html}
<!-- -->
```
8.  Image Filtering:

    a.  3dmerge -1blur_fwhm 8 -doall -prefix ex_blur8 epi_r1+orig

    b.  3dLocalstat --nbhd 'RECT(-3,0,0)' --stat min \\

> -prefix ex_minx3 anat+orig

c.  3danisosmooth --viewer --prefix ex_anisotest ex_minz3+orig

> 3danisosmooth --prefix ex_aniso --iters 3 ex_minz3+orig

9.  Random Exercises with AFNI Datasets:

    a.  3dinfo anat+orig (and look for --orient)

> 3daxialize --prefix exLPI --orient LPI anat+orig
>
> 3dresample --prefix exLPI --orient lpi --inset anat+orig

b.  3dbucket --prefix ex_fneg_coef func_slim+orig'\[3\]'

> 3dbucket --prefix ex_fneg_tstat func_slim+orig'\[4\]'

c.  3dbucket --prefix ex_fneg \\

> ex_fneg_coef+orig ex_fneg_tstat+orig

d.  adwarp --apar anat+tlrc --dpar func_slim+orig \\

> -prefix func_slim4mm --dxyz 4

e.  3dmaxima --input func_slim+orig'\[0\]' \| head

> whereami --38.9 28.72 --1.93 -rai

f.  3dZcutup --keep 40 90 --prefix anat_40_90 anat+orig