[pymvpa] PyMVPA surface searchlight

Yaroslav Halchenko debian at onerussian.com
Sun Jun 28 01:40:58 UTC 2015

On Sat, 27 Jun 2015, John Baublitz wrote:

>    Hi all,
>    I am working on a Python script using PyMVPA to read in FreeSurfer
>    recon-all processed data and run a surface-based searchlight analysis. I
>    am running into some problems both with running the searchlight and
>    returning the resulting dataset to the original NIftI space. I've seen
>    some questions about this on the mailing list but there have been no
>    answers to those sharing my exact error messages.
>    This is the link to my script on github:
>    https://github.com/jbaublitz/somerslab-mvpa-wrapper/blob/master/surface_searchlight.py
>    This script gives me a warning and an error. The warning happens while
>    actually running the searchlight and it is:
>    WARNING: Detected incorrect (nan) scl_ fields. Resetting to scl_slope=1.0
>    and scl_inter=0.0
>    A * Please note: warnings are printed only once, but underlying problem
>    might occur many times *

are you using Windows? ;-)
that should be benign...  Even if we don't offset/scale your data
correctly, all that doesn't matter if you do zscoring anyways

>    The error happens while using map2nifti to map the data back to NIftI
>    space and that is:
>    ValueError: shape mismatch: value array of shape (1,112320) could not be
>    broadcast to indexing result of shape (14166,1)

what you are getting is the results per each surface node (not per each
voxel), those results you should save to .niml.dset file (using
niml.write) and visualize e.g. in suma... more info is in the example

if you were to do "volumetric searchlight" (and thus map2nifti at the
end) but use surface only for guidance, there is an argument for
disc_surface_queryengine -- output_modality which you could set to
'volume' and it should then produce volumetric results

>    I have played around with a number of different tweaks to try to get at
>    the problem but I can't seem to get around either of these issues. These
>    include:
>    1. Specifying the imghdr in map2nifti

once again -- wasn't the right thing since you are getting results on

>    2. Using the mapper from the original dataset and samples from the
>    searchlight-processed data

the same

>    3. Following both the tutorial on the surface and volume-based searchlight
>    Also of note is that it WILL save the dataset in a SUMA-readable format
>    but SUMA errors out while trying to load it at the first line of the file
>    header which seems to be malformed. Any ideas?

I see that you have niml.write commented out (but try to save to file
with ".niml.dset" suffix to signal suma 'niml' format may be)...
should have worked I guess -- but that would be another topic -- provide
error msg etc

Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist,            Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        

More information about the Pkg-ExpPsy-PyMVPA mailing list