Friday, June 6, 2014

Independent Components Analysis, Part II: Using FSL Example Data

For our next step, we will be working with FSL example data - somewhat artificial data, true, and much better quality than anything you can ever expect from the likes of your data, which will only lead to toil, sweat, and the garret. Sufficient unto the day is the frustration thereof.

However, it is a necessary step to see what ICA analysis ought to look like, as well as learning how to examine and identify components related to tasks and networks that you are interested in. Also - and possibly more important - you will learn to recognize sources of noise, such as components related to head motion and physiological artifacts.

First, go to the link and scroll to the bottom for instructions on how to download the datasets. You can use either wget or curl. For this demonstration, we will be using datasets 2 and 6:

curl -# -O -C -
curl -# -O -C -

Once you have downloaded them, unzip them using gunzip, and then "tar -xf" on the resulting tar files. This will create a folder called fsl_course_data, which you should rename so that they do not conflict with each other. Within fsl_course_data2, navigate to the /melodic/av directory, where you will find a small functional dataset that was acquired while the participant was exposed to auditory stimuli and visual stimuli - which sounds much more scientific than saying, "The participant saw stuff and heard stuff."

Open up the MELODIC gui either through the FSL gui, or through typing Melodic_gui from the command line. Most of the preprocessing steps can be kept as is. However, keep the following points in mind:

1. Double-check the TR. FSL will fill it in automatically from the header of the NIFTI file, but it isn't always reliable.

2. Spatial smoothing isn't required in ICA, but a small amount can help produce better-looking and more identifiable component maps. Somewhere on the order of the size of a voxel or two will usually suffice.

3. By default, MELODIC automatically estimates the number of components for you. However, if you have severe delusions and believe that you know how many components should be generated, you can turn off the "Automatic dimensionality estimation" option in the Stats tab, and enter the number of components you want.

4. The Threshold IC maps option is not the same thing as a p-value correction threshold. I'm not entirely clear on how it relates to the mixture modeling carried out by ICA, but my sense from reading the documentation and papers using ICA is that a higher threshold only keeps those voxels that have a higher probability of belonging to the true signal distribution, instead of the background noise distribution, and it comes down to a balance between false positives and false negatives. I don't have any clear guidelines about what threshold to use, but I've seen cutoffs used within the 0.8-0.9 range in papers.

5. I don't consider myself a snob, but I was using the bathroom at a friend's house recently, and I realized how uncomfortable that cheap, non-quilted toilet paper can be. It's like performing intimate hygiene with roofing materials.

6. Once you have your components, you can load them into FSLview and scroll through them with the "Volumes" button in the lower left corner. You can also load the Atlases from the Tools menu and double-click on it to get a semi-transparent highlight of where different cortical regions are. This can be useful when trying to determine whether certain components fall within network areas that you would expect them to.

More details in the videos below, separately for the visual-auditory and resting-state datasets.


  1. Hi Andy,

    Thank you very much for your insightful videos. They have helped me at all those times when I felt I could no longer handle the complexity of neuroimaging data. So, sincerely, thank you again!
    I also just wanted to check in with you: I am currently running FSL's MELODIC with 2 resting state scans. Specifically, I am using the concatenated, registered, normalized, motion scrubbed res4d images (or the residual functional images obtained after pre-processing and accounting for motion WM/CSF in the GLM model for each scan) as the input to the MELODIC. I have a specific question I have been unable to resolve:
    My understanding based on the FSL forums is that the res4D image should not be registered during the MELODIC stage (e.g. , see here: Thus, in my design file, I set all registrations (from functional to high res (native) structural, then from high res structural to std. space, as 0).
    When I look at the IC components generated in the html log file, the areas of activation can be clearly identified and are interpretable, but the slices themselves are white. That is to say, the ventricle regions do not appear "dark", as would expect them to. Would you have any suggestions for why this may be the case? I can share some screenshots if you'd like.
    Thank you again! You are awesome!

  2. Hi Andy,
    thanks for the posts, they are very helpful!
    I've a quite conceptual question related to ICA analysis, i would like to know your opinion. Do you think i can do a "resting Ica analysis" on a task related functional dataset? e.g., using fsl melodic without regressing out the task related brain activity. There are some recent papers showing high correspondence between brain functional networks at task and at rest, actually you can retrieve the typical resting networks (e.g., those showed in Smith et al. 2009 PNAS) if you apply concatenated melodic ICA on the whole task related activity . The reason to do that is that I am interested to study changes in the resting state networks of different groups, i have not acquired resting state data but i Have task related fmri. I m not sure if its conceptually valid.

    Thank you very much,

    Diana LB.

    1. Hi Diana,

      I hadn't heard of that, but that is interesting; if true, that would be a reason against collecting a separate resting state scan. I haven't tried it, but I'm curious what other people have found. Can you post the references for the papers where they have done that?


  3. Hi Andrew, Thank you for making this blog.

    I have a question regarding the visualization of the groupICA result.

    I have the melodic_IC volume file after the analysis was completed but I don't have a specific *.mat file for running the flirt command. How can I register the result to the standard MNI template?

    1. Hey there,

      Assuming that your groupICA map was coregistered to your anatomical, you can warp your anatomical to MNI space, and then apply those transforms to your groupICA map.



  4. Hi Andy,

    Thank you for you wonderful videos and tutorials! Though, I still don't understand how the thresholding works... It seems that in the video you have left it at 0.5 - which according to FSL docs keeps the balance between false positives and negatives equal, but you say most papers use 0.8-0.9? Also the thresholding of spatial maps of z-score you brought it to 2 - 10, was that on top of the already applied threshold during melodic processing?

    Thank you,