<div dir="ltr">Hi Pegah,<div><br></div><div>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:</div><div><br></div><div><div>def ijk2xyz(ijk, affine):</div><div> ijk1 = np.hstack((ijk, np.ones(len(ijk))[:, None]))</div><div> return np.dot(affine, ijk1.T).T[:, :-1]</div></div><div><br></div><div>where ijk is e.g., ds.fa.voxel_indices, and affine = ds.a.imgaffine</div><div><br></div><div>But I recommend you reading the following page to understand what's going on: <a href="http://nipy.org/nibabel/coordinate_systems.html">http://nipy.org/nibabel/coordinate_systems.html</a>, 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.</div><div><br></div><div>Matteo<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 11, 2017 at 9:57 AM, Pegah Kassraian Fard <span dir="ltr"><<a href="mailto:pegahkf@gmail.com" target="_blank">pegahkf@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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?<div>Thanks,</div><div>Pegah</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><span style="font-size:12.8px">Hi all,</span></div><div><br style="font-size:12.8px"></div><div><br style="font-size:12.8px"></div><div><span style="font-size:12.8px">I am saving the coordinates corresponding to classification accuracies as follows:</span></div><div><br style="font-size:12.8px"></div><div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"> max_i = np.argmin(sl_map.samples[0]) # min</blockquote></div><div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"> coord = db12s.fa[sprefix_indices_key][<wbr>max_i]</blockquote></div><div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><br></blockquote></div><div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"> np.save(dir + '/coords' + str_label_set, db12s.fa[sprefix_indices_key])</blockquote></div><div><br style="font-size:12.8px"></div><div><br style="font-size:12.8px"></div><div><span style="font-size:12.8px">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?</span></div><div><br style="font-size:12.8px"></div><div><span style="font-size:12.8px">Thanks,</span></div><div><span style="font-size:12.8px">Pegah</span></div></blockquote></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 8, 2017 at 2:03 PM, Pegah Kassraian Fard <span dir="ltr"><<a href="mailto:pegahkf@gmail.com" target="_blank">pegahkf@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
Hi all,<br><br><br>I am saving the coordinates corresponding to classification accuracies as follows:<br><br><blockquote style="margin:0 0 0 40px;border:none;padding:0px"> max_i = np.argmin(sl_map.samples[0]) # min<br> coord = db12s.fa[sprefix_indices_key][<wbr>max_i]<br><br> np.save(dir + '/coords' + str_label_set, db12s.fa[sprefix_indices_key])</blockquote><br><br>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?<br><br>Thanks,<br>Pegah</div>
</blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
Pkg-ExpPsy-PyMVPA mailing list<br>
<a href="mailto:Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org">Pkg-ExpPsy-PyMVPA@lists.<wbr>alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa" rel="noreferrer" target="_blank">http://lists.alioth.debian.<wbr>org/cgi-bin/mailman/listinfo/<wbr>pkg-exppsy-pymvpa</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px">Matteo Visconti di Oleggio Castello<br>Ph.D. Candidate in Cognitive Neuroscience<br>Dartmouth College<br><br><span title="Call with Google Voice">+1 (603) 646-8665</span></div><div style="font-size:12.8px"><a href="http://mvdoc.me/" target="_blank">mvdoc.me</a> || <a href="http://github.com/mvdoc" target="_blank">github.com/mvdoc</a> || <a href="http://linkedin.com/in/matteovisconti" style="font-size:12.8px" target="_blank">linkedin.com/in/matteovisconti</a></div></div></div></div></div></div></div>
</div>