Suppose matrix coordinates: X = 3, Y = 5, Z = 6;
Method a: mx = 90-3 * (X-1); my = 3 * (Y-1) -126; mz = 3 * (Z-1) - 72;
Method two: coor = Header.mat * [3,5,6] '; (PS: where Header is read the header file obtained by the file format .nii rest_ReadNiftImage function)