ICA with Fieldtrip (2)
Independant Component Analysis — Visualization
1 min readJan 8, 2017
Go back to the reference page
We will, of course, visualize the data resulting from the ICA (ICA with Fieldtrip 1) one subject at a time, one block at a time (altough we will load all blocks at once in the loop ‘for block’).
Give the subject number ID (it’s place in the suj.m function):
subject = 1;
and the total number of blocks:
nb_blocks = 4;
Then, load the data for the selected subjects (loop ‘for block’):
%%% declare the subject structure 'S'
S = struct();for block = 1:nb_blocks
%%%load the results of the ICA
load ([icapath char(subjects_list (subject,:)) …
‘_comp_block’ num2str(block)], ‘comp’);
%%% put it in the subject structure 'S'
S(subject).block(block) = comp; clear comp;
end;% for block
We can now, for the previously selected subject, specify the components of our interest (resulting from the ICA):
components = 1:20;
in the block of our choice:
block_visu = 1;
And look at it
icaview = ...
show_ica(subject_structure, subject, block_visu, components);
Finally, the most of the fun: the function icaview.m
function icaview = ...
show_ica(subject_structure, subject, block_visu, components)cfg=[];
cfg.component = components;
cfg.layout = 'CTF275.lay';
cfg.zlim = 'maxabs';
icaview.topo = ...
ft_topoplotIC(cfg, subject_structure(subject).block(block_visu));
cfg.viewmode = 'vertical';
icaview.timecourse = ...
ft_databrowser(cfg, ... subject_structure(subject).block(block_visu));
Go back to the reference page