# 3dExtrema Strange Behavior

Hello AFNI,

I encountered some strange behavior involving sub-brick selection and the program 3dExtrema. The data file I am analyzing has 7 sub-bricks. The conventional way to select said sub-bricks via AFNI commands is by using file_name.nii’[n]', where n would range from 0-6 (since that is where AFNI begins counting at 0). However, here are some examples from 3dExtrema that have me scratching my head:

3dExtrema -volume -sep_dist 20 AMYG-LME-001-cluster.nii

++ 3dExtrema: AFNI version=AFNI_16.0.10 (Feb 25 2016) [64-bit]
++ Authored by: B. Douglas Ward
Number of volumes = 7

Maxima for Volume #0 (Coordinates Order = RAI):
Index Intensity RL[mm] AP[mm] IS[mm] Count Dist[mm]

``````1          1.650     15.00      3.00    -17.00         5    21.541
2          1.102      3.00     11.00     -1.00         3    21.541
3          0.875     39.00     15.00    -29.00         2    29.394
4          0.770     15.00    -13.00     -1.00         1    22.627
``````

Maxima for Volume #1 (Coordinates Order = RAI):

Maxima for Volume #2 (Coordinates Order = RAI):

Maxima for Volume #3 (Coordinates Order = RAI):
Index Intensity RL[mm] AP[mm] IS[mm] Count Dist[mm]

``````1        252.880      3.00      7.00     43.00         4    48.826
2        247.490    -41.00     23.00     23.00         2    21.541
3        228.340    -29.00     15.00      7.00         3    21.541
``````

Maxima for Volume #4 (Coordinates Order = RAI):
Index Intensity RL[mm] AP[mm] IS[mm] Count Dist[mm]

``````1          0.025     43.00     35.00     55.00         4
``````

Maxima for Volume #5 (Coordinates Order = RAI):

Maxima for Volume #6 (Coordinates Order = RAI):
Index Intensity RL[mm] AP[mm] IS[mm] Count Dist[mm]

``````1          0.576     23.00     -1.00    -13.00         2    25.923
2          0.418    -17.00      3.00     -9.00         5    22.978
3          0.295     19.00    -17.00    -33.00         3    25.923
4          0.278      7.00    -25.00     -1.00         3    31.241
5          0.224    -25.00    -25.00    -29.00         2    25.612
6          0.204     -1.00    -41.00     27.00         2    33.226
7          0.185    -49.00     -1.00    -13.00         1    20.000
8          0.171    -33.00     79.00     23.00         5    26.833
9          0.168     -1.00     11.00     11.00         2    21.909
``````

10 0.168 -33.00 67.00 47.00 1 26.833
11 0.145 23.00 87.00 15.00 3 20.785
12 0.141 19.00 83.00 35.00 3 20.785
13 0.138 19.00 27.00 -1.00 1 28.284
14 0.134 3.00 3.00 31.00 2 21.909
15 0.123 -9.00 91.00 11.00 2 29.394
16 0.120 -21.00 -13.00 55.00 3 24.331
17 0.114 -1.00 47.00 35.00 2 39.598
18 0.111 -37.00 51.00 11.00 3 30.725
19 0.109 3.00 -17.00 55.00 2 24.331
20 0.100 -33.00 -1.00 -25.00 1 20.000
21 0.088 -25.00 71.00 -17.00 1 36.442
22 0.062 -25.00 -25.00 7.00 1 32.985
23 -0.098 51.00 -5.00 11.00 1 37.094

Everything looks good when I run the command and do not specify a sub-brick. However, when I specifically target 0 and 1, I get the same exact output, which is obviously incorrect and not consistent with the above, or the data as I know it:

awdpt800wg3:UNC_AAL_GROWTH salzwedelap\$ 3dExtrema -volume -sep_dist 20 AMYG-LME-001-cluster.nii’[0]’
++ 3dExtrema: AFNI version=AFNI_16.0.10 (Feb 25 2016) [64-bit]
++ Authored by: B. Douglas Ward
Number of volumes = 1

Maxima for Volume #0 (Coordinates Order = RAI):
Index Intensity RL[mm] AP[mm] IS[mm] Count Dist[mm]

``````1          1.650     15.00      3.00    -17.00         5    21.541
2          1.102      3.00     11.00     -1.00         3    21.541
3          0.875     39.00     15.00    -29.00         2    29.394
4          0.770     15.00    -13.00     -1.00         1    22.627
``````

awdpt800wg3:UNC_AAL_GROWTH salzwedelap\$ 3dExtrema -volume -sep_dist 20 AMYG-LME-001-cluster.nii’[1]’
++ 3dExtrema: AFNI version=AFNI_16.0.10 (Feb 25 2016) [64-bit]
++ Authored by: B. Douglas Ward
Number of volumes = 1

Maxima for Volume #0 (Coordinates Order = RAI):
Index Intensity RL[mm] AP[mm] IS[mm] Count Dist[mm]

``````1          1.650     15.00      3.00    -17.00         5    21.541
2          1.102      3.00     11.00     -1.00         3    21.541
3          0.875     39.00     15.00    -29.00         2    29.394
4          0.770     15.00    -13.00     -1.00         1    22.627
``````

To make matters more confusing I have to use sub-brick selection = 7 to get the final volume…

awdpt800wg3:UNC_AAL_GROWTH salzwedelap\$ 3dExtrema -volume -sep_dist 20 AMYG-LME-001-cluster.nii’[7]’
++ 3dExtrema: AFNI version=AFNI_16.0.10 (Feb 25 2016) [64-bit]
++ Authored by: B. Douglas Ward
Number of volumes = 1

Maxima for Volume #0 (Coordinates Order = RAI):
Index Intensity RL[mm] AP[mm] IS[mm] Count Dist[mm]

``````1          0.576     23.00     -1.00    -13.00         2    25.923
2          0.418    -17.00      3.00     -9.00         5    22.978
3          0.295     19.00    -17.00    -33.00         3    25.923
4          0.278      7.00    -25.00     -1.00         3    31.241
5          0.224    -25.00    -25.00    -29.00         2    25.612
6          0.204     -1.00    -41.00     27.00         2    33.226
7          0.185    -49.00     -1.00    -13.00         1    20.000
8          0.171    -33.00     79.00     23.00         5    26.833
9          0.168     -1.00     11.00     11.00         2    21.909
``````

10 0.168 -33.00 67.00 47.00 1 26.833
11 0.145 23.00 87.00 15.00 3 20.785
12 0.141 19.00 83.00 35.00 3 20.785
13 0.138 19.00 27.00 -1.00 1 28.284
14 0.134 3.00 3.00 31.00 2 21.909
15 0.123 -9.00 91.00 11.00 2 29.394
16 0.120 -21.00 -13.00 55.00 3 24.331
17 0.114 -1.00 47.00 35.00 2 39.598
18 0.111 -37.00 51.00 11.00 3 30.725
19 0.109 3.00 -17.00 55.00 2 24.331
20 0.100 -33.00 -1.00 -25.00 1 20.000
21 0.088 -25.00 71.00 -17.00 1 36.442
22 0.062 -25.00 -25.00 7.00 1 32.985
23 -0.098 51.00 -5.00 11.00 1 37.094

-Andy

Hi Andy,

That is certainly peculiar. I do not have trouble running
the same commands with that same software version,
so perhaps it has something to do with the NIFTI format.

What program created that file?

If you would like me to take a direct look, let me know
and I will send you instructions to upload the dataset.

• rick

Hi Rick,

I create the file using a series of system calls through matlab. Basically, I build up the dataset using this function:

function [] = udump_and_glue(master,oneDfile,label,fglue)

[b][~,~] = system(['3dUndump -datum float -prefix temp.nii -master ’ master ’ -orient RAI -xyz ’ oneDfile]);
[~,~] = system([‘3drefit -sublabel 0 ’ label ’ temp.nii’]);
[~,~] = system(['3dbucket -aglueto ’ fglue ‘+orig temp.nii’]);

delete(‘temp*’)[/b]

Then, when I am done I run 3dcopy to create a .nii file from the +orig. One final point of confusion; I have another file created in the same manner and it “behaves” appropriately when it comes to 3dExtrema. In the AFNI viewer and 3dinfo both have the proper # of sub-bricks, etc. I would be happy to upload both for the sake of troubleshooting.

Thanks,
Andy