Code covered by the BSD License  

Highlights from
Generate synthetic fMRI data

5.0

5.0 | 2 ratings Rate this file 48 Downloads (last 30 days) File Size: 87.6 KB File ID: #36125
image thumbnail

Generate synthetic fMRI data

by

 

11 Apr 2012 (Updated )

This program is useful for debugging fMRI analyses and models.

| Watch this File

File Information
Description

Given a set of voxel location (sample file provided), experimental design matrix, and a desired signal-to-noise ratio, this program generates a set of synthesized voxel activations.

Each experimental covariate (which can be activated to varying degrees during each trial, as specified in the design matrix) is assigned a single radial basis function. The basis function's center is chosen uniformly within the confines of the specified brain, and the width is also chosen uniformly. (Note: you can associate multiple radial basis functions with each covariate by giving each covariate multiple columns in the design matrix.)

The synthesized brain image for each trial is a weighted combination of the basis functions for the sources active during that trial, plus zero-mean Gaussian noise. (The standard deviation of the Gaussian noise is controlled via the SNR parameter.)

For added realism, an optional flag allows the user to specify whether the synthetic data incorporate a synthetic hemodynamic response function.

The synthetic data can be saved in NIFTI format (this relies on code, included in the download, from http://www.mathworks.com/matlabcentral/fileexchange/8797-tools-for-nifti-and-analyze-image).

Acknowledgements

Tools For N If Ti And Analyze Image inspired this file.

MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
21 Jan 2013 Edward King

a

23 Dec 2012 Jeremy Manning

Hi Nes,

You're having trouble downloading the brain plots package? You should add a comment to that submission page, not this one. But if you just click the "Download Submission" link and unzip the file you download, all of the .m files should be in the resulting folder. I just re-downloaded that package to verify, and it looks OK to me...

23 Dec 2012 Nes

Hi Jeremy,
I'm searching http://www.mathworks.com/matlabcentral/fileexchange/36139-2d-and-3d-brain-plots) page, but I cant see any file which I can download.
Your file is erased, isn't it?
Thank you

16 May 2012 ladyme

thanks!

11 May 2012 Jeremy Manning

The "data" variable contains the images for each trial specified by the design matrix (see above). That's what you pass to plot_brain2d or plot_brain3d. The 2d plots usually work better for viewing the synthetic data. This is because, whereas in real data "interesting stuff" often happens on the outer surface, in the synthetic data the sources are equally likely to be anywhere within the brain volume.

Let's say you want to generat a simple dataset with two trials, one unique source active per trial, and infinite signal-to-noise:

[data,cov_images] = generate_data(meta,eye(2),inf);

To generate 2d plot of first trial using default settings (requires installing http://www.mathworks.com/matlabcentral/fileexchange/36139-2d-and-3d-brain-plots), use:

plot_brain2d(data{1},meta);

To generate a 3d plot of second trial using default settings, use:

plot_brain3d(data{2},meta);

In each of the above examples, "meta" is the matrix included with the download of this package. (See documentation for additional details on the meta matrix.)

11 May 2012 ladyme

so i just fed the result from the generate_data into the plot_brain3d? which to use? data or cov_images? would you mind showing the line how it works? thanks

10 May 2012 Jeremy Manning

Hi ladyme,

To plot the images, you can use http://www.mathworks.com/matlabcentral/fileexchange/36139-2d-and-3d-brain-plots

10 May 2012 ladyme

sorry for such a silly question, but how can i plot the image?

26 Apr 2012 Jeremy Manning

I've updated the submission with some example design matrices -- I hope that helps! (Give it a day or so for the update to show up.)

26 Apr 2012 Karl

The design matrix, X, must be a matrix of real numbers. Each column of X corresponds to a single covariate. Each row of X corresponds to a single trial (one image will be generated per trial). So row i, column j controls how active covariate j is during trial i. For example

X = eye(5);

corresponds to 5 trials, with one covariate active per trial.

X = rand(10,5);

gives you 10 trials, with 5 covariates randomly active during each trial. Finally,

X = [eye(5) eye(5)]

gives you 5 trials, with 2 covariates active during each trial.

26 Apr 2012 mizzue

hi Jeremy,

i am curious how do you design the X matrix?

Updates
11 Apr 2012

minor change to program description.

12 Apr 2012

minor change to program description.

27 Apr 2012

updated help text to include usage examples.

15 May 2012

added support for SNR = 0

27 Feb 2013

support convolution with hemodynamic response function, outputting to NIFTI format.

07 Mar 2013

modified the meta struct so that the function produces more realistic brain images. i also added an option to output source parameters.

07 Mar 2013

updated description, added pointer to http://www.mathworks.com/matlabcentral/fileexchange/8797-tools-for-nifti-and-analyze-image

01 Jul 2013

updated HRF convolution, added additional files from file exchange submission #8797

Contact us