[pymvpa] Loading multiple ROIs with fmri_dataset

Lyam Bailey Lyam.Bailey at Dal.Ca
Wed Aug 14 15:55:24 BST 2019


Dear Yaroslav,


Thanks so much for the quick reply. I tried implementing this with:


fa_fname = {a: "haxby2001/sub001/masks/25mm/%s.nii.gz" % a for a in ["vt, hoc"]}
temp_ds = fmri_dataset(bold_fname, mask=None, targets = targets, add_fa=fa_fname, chunks = int(i)-1)

The code ran without errors, however when I continued through the example RSA script (http://www.pymvpa.org/examples/rsa_fmri.html) the dissimilarity matrices appeared very different to those generated when using load_tutorial_data. I experimented with
fa_fname = {a: "haxby2001/sub001/masks/25mm/%s.nii.gz" % a for a in ["white"]}


...and this turned out to generate exactly the same results. I also get the same results with add_fa = None. So I get the feeling that add_fa is not actually being implemented. Can you see a problem in the way I've called fmri_dataset?


Thanks again,

Lyam

---------------------------------------------------------

Lyam Bailey, B.Sc., M.Sc.

Doctoral Student

Department of Psychology & Neuroscience
Dalhousie University


________________________________
From: Pkg-ExpPsy-PyMVPA <pkg-exppsy-pymvpa-bounces+lyam.bailey=dal.ca at alioth-lists.debian.net> on behalf of Yaroslav O Halchenko <yoh at onerussian.com>
Sent: Tuesday, August 13, 2019 4:59:53 PM
To: pkg-exppsy-pymvpa at alioth-lists.debian.net <pkg-exppsy-pymvpa at alioth-lists.debian.net>
Subject: Re: [pymvpa] Loading multiple ROIs with fmri_dataset


On Tue, 13 Aug 2019, Lyam Bailey wrote:

>    Dear users,

>    I am trying to manually load in the PyMVPA tutorial data, instead of using
>    the load_tutorial_data convenience function (as shown here, for example:
>    http://www.pymvpa.org/examples/rsa_fmri.html). I have downloaded the
>    tutorial data and replaced the following lines of code from the example
>    script:

>  from mvpa2.datasets.sources.native import load_tutorial_data
>  datapath = pjoin(cfg.get('location', 'tutorial data'), 'haxby2001')
>  ds = load_tutorial_data(roi=(15, 16, 23, 24, 36, 38, 39, 40, 48))

>    with the following loop:

>    data_path = pjoin('haxby2001', 'sub001')
>    runs = [1,2]

>    run_datasets = []
>    targets = SampleAttributes(pjoin(data_path, 'BOLD','task001_run001',
>    'attributes.txt'))['targets']

>    for i in runs:
>        bold_fname = pjoin(data_path, 'BOLD', 'task001_run00' + str(i),
>    'bold.nii.gz')
>        temp_ds = fmri_dataset(bold_fname, mask=None, targets = targets,
>    chunks = i-1)
>        run_datasets.append(temp_ds)
>    ds = vstack(run_datasets, a=0)

>    The one thing I'm missing is how to load in multiple ROIs, as in ds  =
>    load_tutorial_data(roi=(15,  16,  23,  24,  36,  38,  39,  40,  48)). Is
>    there a way to achieve this with fmri_dataset? Or is there a more

fmri_dataset has  an argument:

add_fa : dict or None
  Optional dictionary with additional volumetric data that shall be stored
  as feature attributes in the dataset. The dictionary key serves as the
  feature attribute name. Each value might be of any type supported by the
  'mask' argument of this function

so you could point to any ROI masks/index volumes and get them assigned to a .fa

$> python -c 'import mvpa2.suite as mv ; print(mv.fmri_dataset("mvpa2/data/haxby2001/sub001/BOLD/task001_run001/bold_25mm.nii.gz", add_fa={a: "mvpa2/data/haxby2001/sub001/masks/25mm/%s.nii.gz" % a for a in ["brain", "gray", "vt"]}))'
<Dataset: 121x600 at int16, <sa: time_coords,time_indices>, <fa: brain,gray,voxel_indices,vt>, <a: imgaffine,imghdr,imgtype,mapper,voxel_dim,voxel_eldim>>


--
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

_______________________________________________
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA at alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-exppsy-pymvpa/attachments/20190814/25659de3/attachment.html>


More information about the Pkg-ExpPsy-PyMVPA mailing list