How to convert from voxel index to MNI coordinates and vice versa.

Please see the figure below (aal.nii opened by MRIcroN).
The MNI coordinates of the current position is -66 -92 -40, and its value is 0. (-66x-92x-40= 0 on the titile).
The voxel index is 25 34 32. (X 25 Y 34 Z 32). 

1. Read the file header:
[Data Header]=rest_ReadNiftiImage('aal.nii');

2. Convert from voxel index to MNI coordinates:
MNI_Coordinates = Header.mat*[25;34;32;1]

MNI_Coordinates =
 
   -66
   -92
   -40
     1

2. Convert from MNI coordinates to voxel index:

Voxel_Index = inv(Header.mat)*[-66;-92;-40;1]
 
Voxel_Index =
 
    25
    34
    32
     1



Error | Forum of resting-state fMRI

Error

The website encountered an unexpected error. Please try again later.