1D index (ijk) to mni coordinates


I am using 3dAutoTcorrelate and I would like to get the mni coordinates from the output 1D file. The information I can get from the 1D file is 1D index (ijk). I know how to calculate the index using the equation ijk = i + jNi + kNi*Nj. But I have trouble getting the 3D indices (i,j,k) or even the mni coordinates from the 1D index. The problem is that I have a very large mask and there are so many voxels that I cannot check out each voxel’s 3D indices. Would you please help me with this? Thank you so much.