Print

Print


Hi,

If you use fslhd as the command line then it will show the full sform matrix (which you can at least use for checking).  To read it into matlab you might want to look at:
  http://niftilib.sourceforge.net/mat_api_html/README.txt
as this was written by John Ashburner who was on the original NIFTI committee.

All the best,
Mark



From: FSL - FMRIB's Software Library <[log in to unmask]> on behalf of Sisy <[log in to unmask]>
Reply-To: FSL - FMRIB's Software Library <[log in to unmask]>
Date: Wednesday, 7 October 2015 05:45
To: "[log in to unmask]" <[log in to unmask]>
Subject: Re: [FSL] How to map the MNI coordinate back to NIFTI voxel index?

Hi Alle,

I think you're right, the matrix seems not correct, currently I'm using
[info] = nii_read_header('XXX.nii')

And I also tried another software:
[Data Header]=rest_ReadNiftiImage('XXX.nii');

They got similar rotation matrix, however both are not correct, at least for my data. What is the correct way to get the sform matrix?

Thanks for your reply,
Hong





At 2015-10-07 03:42:38, "Alle Meije Wink" <[log in to unmask]> wrote:

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 Wink




Date: 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 header

Sform =

-3 0 0 78 -> SrowX
0 3 0 -112 -> SrowY
0 0 3 -50 -> SrowZ
0 0 0 1 -> appended

and I got voxel_index = inv(Sform)*[-7 -72 16 1]';
voxel_index =

28.3333
13.3333
22.0000
1.0000

But 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