[pymvpa] events with model of bold response?

Brian Murphy brian.murphy at unitn.it
Wed Mar 30 17:05:24 UTC 2011


Hi,

to follow up on a very old post of mine... I'm now again trying to build 
a BOLD-sensitive averaged version of a dataset, to achieve the same 
thing as...
    averageDataset = 
dataset.get_mapped(M.mean_group_sample(['chunks','targets']))
... but with the average image for each trial/event based on a 
HRF-weighted average of the sequence of volumes, using 
transform_with_boxcar, rather than a flat "box" average.

As a first validation step I tried to recreate the "box" average using 
transform_with_boxcar. The first issue I had was that 
transform_with_boxcar only operates on the sample data, so I thought I 
would use a hacky work-around with eventrelated_dataset to get the 
attributes right, as such:
    events = M.find_events(targets=dataset.sa.targets, 
chunks=dataset.sa.chunks) # extract event attributes from volume 
descriptions
    manualAvDataset = M.eventrelated_dataset(dataset, events=events)
    manualAvDataset.samples = 
M.misc.support.transform_with_boxcar(dataset.samples, [e['onset'] for e 
in events], 4, offset=3)

While this doesn't produce any errors, I run into problems when I try to 
learn on the data:
    results = foldwiseCvedAnovaSelectedSMLR(manualAvDataset)
    ValueError: Collectable 'voxel_indices' with length [114330] does 
not match the required length [38110] of collection 
'<FeatureAttributesCollection>'.

Should I build the transformed dataset from scratch, or perhaps copy 
attributes selectively from the original and event datasets?

Once I have a working solution I'll repost it to the list together with 
the interesting HRF bit...

best,

Brian


> Hey,
>
> On Mon, Nov 01, 2010 at 11:35:57AM +0100, Brian Murphy wrote:
> >/ Hi,
> />/ 
> />/ I see that there are several handy ways to get an aggregate BOLD
> />/ measure for each fMRI event: transform_with_boxcar, BoxCarMapper,
> />/ and ERNiftiDataset. And by default they use a simple average of a
> />/ fixed number of volumes. Is there a way to make them use another
> />/ averaging method (transform_with_boxcar at least seems to allow
> />/ this), and if so, does PyMVPA or any other part of NeuroDebian have
> />/ a function for modelling the BOLD response?
> /
> You can indeed provide a custom function to process the boxcars. There
> is GLM (a very very very basic implementation) to do fitting and stuff
> like {single,double}GammaHRF() to create a design. There is also FslGLMDesign()
> to load an existing GLM setup from FSL is you happen to have one.
>
> So depending on what exactly you want to achieve (per event/run/subject
> betas) you should be able to get it done. Of course you can also craft a
> modeling function with NiPy and feed that into transformWithBoxcar(), or
> you could also use NiPy or some other toolkit to do the full modelling
> and only load beta image into PyMVPA for further processing.
>
> HTH,
>
> Michael
>
>   



More information about the Pkg-ExpPsy-PyMVPA mailing list