[pymvpa] Using masks with different dimensions than the functional volumes

Shane Hoversten shanusmagnus at gmail.com
Sun Sep 1 03:46:28 UTC 2013

Howdy -

Let me preface this msg by saying that I only _barely_ know what I'm
doing.  This will probably become evident immediately.

In an experiment whose data I'm trying to analyze, I'd like to
localize the analysis based on the results of various masks, including
Brodmann masks created with the wfu pickatlas tool
(http://fmri.wfubmc.edu/software/PickAtlas).  I can use these masks in
the course of univariate analyses with SPM despite the fact that the
masks have different numbers of voxels than do our acquired volumes --
the NIFTI headers apparently contain enough info to match up the mask
and the volumes in physical space, and SPM just does the right thing,
which was a pleasant surprise.

But now I'd like to use these masks with PyMVPA.  I've been working
through the tutorials with the Haxby dataset, and part 2 of the
tutorial demonstrates loading the Haxby BOLD data with a mask, like

ds = fmri_dataset(os.path.join(path, 'bold.nii.gz'),
mask=os.path.join(path, 'mask_vt.nii.gz'))

As it happens, the shape of the voxel matrix for this BOLD data, and
for this mask, are the same.  That's a luxury we don't have in our
dataset, but I crossed my fingers and tried to load one of our volumes
with the mask, but to no avail.  I got this error:

in _forward_data(self, data)
    103             raise ValueError("FlattenMapper has not been
trained for data "
    104                              "shape '%s' (known only '%s')."
--> 105                              % (str(sshape), str(oshape)))
    106         ## input matches the shape of a single sample
    107         #if sshape == oshape:

ValueError: FlattenMapper has not been trained for data shape '(91,
109, 91)' (known only '(96, 96, 37)').

The (91,109,91) are the dimensions of the masks produced by wfu
pickatlas; our data is the (96, 96, 37).  So my question is, how does
one deal with these situations?  I've googled as best as I'm able but
haven't found the issue addressed.  Can anyone point me in a good

Thanks very much,


More information about the Pkg-ExpPsy-PyMVPA mailing list