Dear Than,
The way you compute voxel_index looks spot on to me. But the Sform does not look like a standard MNI Sform (at least not the 2x2x2 mm one in which most atlases are defined). Could this have caused your problem?
With best wishes
Alle Meije WinkDate: Wed, 7 Oct 2015 02:48:50 +0800
From: Sisy <[log in to unmask]>
Subject: How to map the MNI coordinate back to NIFTI voxel index?Hi All,
I have a general question to ask. How to map the MNI coordinate back to NIFTI voxel index, that we could access data from nii_object.img?
For example, I'd like to get the voxel data locates in the calcarine area, where the MNI coordinate shows [-7 -72 16 1], so I use Sform matrix where I got from the headerSform =
-3 0 0 78 -> SrowX
0 3 0 -112 -> SrowY
0 0 3 -50 -> SrowZ
0 0 0 1 -> appendedand I got voxel_index = inv(Sform)*[-7 -72 16 1]';
voxel_index =28.3333
13.3333
22.0000
1.0000But if I use nii_object.img(28,13, 22) I couldn't get the same value as it shows. Consider Matlab is 1 based, I also tried (29,14,23) but it doesn't work either.
Than
gmail sent from phone