Independent Component Analysis

Independent Component Analysis

Independent component analysis (ICA) is a statistical method by which the signal is untangled into multiple independent components. 3dICA.R, available now in AFNI, runs spatial ICA with an algorithm of fastICA.

The following assumes that you've already installed R and a few packages.


(1) Pre-processing. Right now this is a step you have to take care of. For example, dimensionality reduction is desirable by using 3dpc (e.g., 3dpc -reduce ...). 3dICA.R can only take one input file, either data from one subject or combined data from multiple subjects.

(2) Create a text file par.txt in the following format which stores all the parameters:


Line 1: Input is the input file name. Only one input file is allowed currently.

Line 2: CompOutput specifies the output file (3D AFNI format) storing the spatial components. No suffix such as tlrc is needed.

Line 3: MixOutput specifies the 1D file of the mixing matrix with each column representing the time series of each component. No suffix such as .1D is needed.

Line 4: NoComp specifies the number of components in the analysis. 

Line 5: Func can be either "logcosh" (log coshine) or "exp" (exponential) which specifies the approximation method of non-Gaussianity to neg-entropy.

Line 6: Type is either "parallel" (all components are extracted simultaneously) or "deflation" (components are extracted sequentially). 

(3) Execute the following command at the prompt in the directory where file par.txt resides:

3dICA.R MyOutput


If you anticipate a long runtime, you may want to put an "&" at the end of the above command line so that the execution runs in the background. Check the progress in file MyOutput which stores stdout and stderr. It is done if you see "Congratulations! You've got output ..." at the end of the file. 

If you run the analysis on a remote host computer, you can use the following command line so that you can safely log out at the local machine without terminating the running job:


nohup 3dICA.R MyOutput &

The file you are interested, OutputFileName+tlrc.*, is the output file that contains as many sub-bricks as the number of components you requested. The time courses of the components are automatically plotted out when the analysis is done. Enjoy component hunting...


Thank Tom Ross for assistance during the development of the package.