[pymvpa] Concatenate Nifti data sets

Anaelia Ovalle anaeliaovalle at gmail.com
Fri Mar 3 06:20:09 UTC 2017

Hi, this is my first time working with PyMVPA and I'm looking to build one fmri dataset from 10 individual fmri runs. I was wondering how I would go about this? As a brute force approach, I was thinking to import the first run, then looping through the rest of the runs and appending the data. However, how would I go about adding the attribute targets and chunks to it?? Below is an attempt to do this....

Any help would be much appreciated! 

def loadData():
    data_path = "/Users/..."
    #start with run1 and append runs 2-10
    bold_fname = os.path.join(data_path, 'run1_mask+orig.nii.gz')

    #upload BOLD data with its mask
    ds = fmri_dataset(samples = bold_fname)

    #iterate through runs 2-10 and append each fmri dataset to ds
    for i in range(2,11):
        path = 'run'+str(i)+'_mask+orig.nii.gz'
        bold_fname = os.path.join(data_path, path)
        sub = fmri_dataset(samples = bold_fname)

        ds = vstack((ds,sub))

    #add the attribute targets/chunks to the data
    ds.sa.targets = attr.targets
    ds.sa.chunks = np.array(attr.chunks)

    print ds.shape

    print ds.summary()
    return ds


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20170302/a904c75d/attachment.html>

More information about the Pkg-ExpPsy-PyMVPA mailing list