No, but that's not the problem. The issue is when you use that result to index into the array:
$ 3dmaskdump -index -xyz -ibox 123 118 58 \
> -ibox 123 119 59 \
> -ibox 124 119 59 ~/abin/MNI152_T1_2009c+tlrc
++ 3dmaskdump: AFNI version=AFNI_2011_12_21_1014 (May 13 2015) [64-bit]
++ 8530021 voxels in the entire dataset (no mask)
++ 3 voxels in the boxes and/or balls
++ Using only the boxes+balls mask
2586323 123 118 58 -27 14 -20 173 # voxel I claim MATLAB thinks is at our ijk
2630713 123 119 59 -27 13 -19 170 # voxel I claim MATLAB thinks is at our linear index
2630714 124 119 59 -28 13 -19 171 # voxel we care about
$ matlab -nojvm <<EOF
> [err, MNI.brik, MNI.head, msg] = BrikLoad('~/abin/MNI152_T1_2009c+tlrc', struct());
> [~, idx] = AFNI_XYZcontinuous2Index([-28 13 -19], MNI.head)
> matlab_idx = num2cell(idx + 1); idx = num2cell(idx);
> [~, lin_idx] = AFNI_XYZcontinuous2Index([-28 13 -19], MNI.head, [], 1)
> MNI.brik(idx{:}) # give MATLAB the ijk we want
> MNI.brik(lin_idx) # give MATLAB the linear index we want
> MNI.brik(matlab_idx{:}) # give MATLAB ijk + 1
> MNI.brik(lin_idx + 1) # give MATLAB linear index + 1
> EOF
< M A T L A B (R) >
Copyright 1984-2014 The MathWorks, Inc.
R2014b (8.4.0.150421) 64-bit (glnxa64)
September 15, 2014
For online documentation, see [www.mathworks.com]
For product information, visit www.mathworks.com.
>> >>
idx =
124 119 59 # AFNI_XYZcontinuous2Index gives AFNI's ijk index
>> >>
lin_idx =
2630714 # AFNI_XYZcontinuous2Index gives AFNI's linear index
>>
ans =
173 # but MATLAB hits the wrong voxel when fed ijk
>>
ans =
170 # and when fed the linear index
>>
ans =
171 # but ijk + 1 works
>>
ans =
171 # as does linear index + 1
>>
Edited 1 time(s). Last edit at 06/23/2015 04:30PM by Isaac Schwabacher.