[pymvpa] Dataset with multidimensional feature vector per voxel

Yaroslav Halchenko debian at onerussian.com
Wed Nov 4 16:27:51 UTC 2015

On Wed, 04 Nov 2015, Ulrike Kuhl wrote:

> Dear PyMVPA experts,

> first of all: thank you so much for the great work on providing such a nice and handy toolbox!

thank you for the thank you!

> I started working with PyMVPA less than a week ago and while the tutorial provides a great overview on how to set up one's fMRI data, I am kind of stuck on how to proceed with my structural data.

> What's my story?
> I plan to perform an MVPA analysis on structural MRI data. To be exact, I have several maps of parameters derived from diffusion weighted MRI per subject, like fractional anisotropy (FA), mean diffusivity (MD) and the like. Eventually I want to train a classifier on the combination of these parameters per voxel in order to see which voxels (using a searchlight approach) predict best whether the corresponding subject belongs to group A or group B (groups derived based on behavioural measure).

> I would like to set up my data in the following way:

> * one sample = one participant
> * features per sample = 2D-data of the form: numberOfVoxels X numberOfDiffusionDerivedParameters

> That is, for each voxel that is encoded in the feature dimension, I want a vector containing the respective diffusion-derived parameters for that voxel.

> What's the best way to set up data this way using PyMVPA? 
> Is it even possible to do it and then train a classifier on this parameter-vector instead single voxel values?


I would say that the easiest way is to hstack those together so you
still have subject x features  2d matrix, but where per each feature you
would have some descriptor on what is the "modality" of that value. e.g.
smth like (just typing, might not work as is)

dss = []
for suf_index, suf in enumerate(('anat', 'fa', 'md')):
  ds = fmri_dataset('file_%s.nii.gz' % suf, mask='mask.nii.gz')
  ds.fa['modality'] = suf
  ds.fa['modality_index'] = suf_index  # this as numeric might come handy for searchlights later
dsall = hstack(dss)

then you would have all the information  you need to later on even do a
searchlight across the brain while picking up all modalities for that
voxel (would need a bit more of glue though... if interested -- will
show whenever you get the basic code running)


Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
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