[pymvpa] Coordinates retrieved from Searchlight

Matteo Visconti di Oleggio Castello matteo.visconti at gmail.com
Mon Dec 11 11:09:31 UTC 2017


Hi Pegah,

you are saving the coordinates in the ijk coordinate system, that is why
they are all positive. You need the affine matrix to convert from ijk to
xyz coordinates. The affine is stored in ds.a.imgaffine. Then, you can use
something like this to convert from ijk to xyz:

def ijk2xyz(ijk, affine):
     ijk1 = np.hstack((ijk, np.ones(len(ijk))[:, None]))
     return np.dot(affine, ijk1.T).T[:, :-1]

where ijk is e.g., ds.fa.voxel_indices, and affine = ds.a.imgaffine

But I recommend you reading the following page to understand what's going
on: http://nipy.org/nibabel/coordinate_systems.html, and I would also
recommend to double and triple check the outputs. While in theory xyz =
affine * ijk, other programs might change the affine without much warning,
so it's always better to visualize the maps with e.g. afni or FSLeyes.

Matteo

On Mon, Dec 11, 2017 at 9:57 AM, Pegah Kassraian Fard <pegahkf at gmail.com>
wrote:

> Dear pymvpa support, I would be very keen to know how can I map the
> searchlight coordinates to MNI space (and why mine are all positive). Could
> you help me with that?
> Thanks,
> Pegah
>
> Hi all,
>
>
> I am saving the coordinates corresponding to classification accuracies as
> follows:
>
>         max_i = np.argmin(sl_map.samples[0])  # min
>
>         coord = db12s.fa[sprefix_indices_key][max_i]
>
>
>         np.save(dir + '/coords' + str_label_set,
> db12s.fa[sprefix_indices_key])
>
>
>
> Now looking at these coordinates, it strikes me that they all are positive
> - which can't be for MNI coordinates describing the entire cortex (I am not
> masking). How can this be? And if these are not MNI coordinates, how could
> they be translated to such?
>
> Thanks,
> Pegah
>
>
> On Fri, Dec 8, 2017 at 2:03 PM, Pegah Kassraian Fard <pegahkf at gmail.com>
> wrote:
>
>> Hi all,
>>
>>
>> I am saving the coordinates corresponding to classification accuracies as
>> follows:
>>
>>         max_i = np.argmin(sl_map.samples[0])  # min
>>         coord = db12s.fa[sprefix_indices_key][max_i]
>>
>>         np.save(dir + '/coords' + str_label_set,
>> db12s.fa[sprefix_indices_key])
>>
>>
>>
>> Now looking at these coordinates, it strikes me that they all are
>> positive - which can't be for MNI coordinates describing the entire cortex
>> (I am not masking). How can this be? And if these are not MNI coordinates,
>> how could they be translated to such?
>>
>> Thanks,
>> Pegah
>>
>
>
> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa
>



-- 
Matteo Visconti di Oleggio Castello
Ph.D. Candidate in Cognitive Neuroscience
Dartmouth College

+1 (603) 646-8665
mvdoc.me || github.com/mvdoc || linkedin.com/in/matteovisconti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20171211/f5c59263/attachment.html>


More information about the Pkg-ExpPsy-PyMVPA mailing list