Convenience function to load and preprocess data into a dataset.
It wraps any given callable that converts data in some format into a PyMVPA dataset. Specifically, this function does three things.
First, data is loaded with the specific raw_loader, and any desired raw data pre-processing is performed by calling `` preproc_raw`` with the output of the loader function. Next, ds_converter is called to yield an initial dataset. The user is responsible for passing callabled that are input/output compatible with each other.
Afterwards, any additional sample attributes are assigned to the dataset. Lastly, the resulting dataset is subjected to another pre-processing step by passing it to preproc_ds. This is another callable that can be any of PyMVPA’s mapper implementations (or another functions that takes a dataset as argument and returns a dataset).
Parameters: | src : any
raw_loader : callable
ds_converter : callable
preproc_raw : callable or None
preproc_ds : callable or None
add_sa : dict or recarray or None
**kwargs :
|
---|---|
Returns: | Dataset : |
Examples
Load 4D BOLD fMRI data
>>> import nibabel as nb
>>> from mvpa2.datasets.mri import fmri_dataset
>>> from mvpa2.mappers.detrend import PolyDetrendMapper
>>> ds = preprocessed_dataset(
... 'mvpa2/data/bold.nii.gz', nb.load, fmri_dataset,
... mask='mvpa2/data/mask.nii.gz',
... preproc_ds=PolyDetrendMapper(polyord=2, auto_train=True))