Clusters defined in channel file?

Hi!

I'm trying to script extract cluster time series from a large bunch of files that I list in a cell array.
This used to work, when defining clusters "on the fly", then with something like this:

sFiles = bst_process('CallProcess', 'process_extract_cluster', sFiles_orig, [], ...
    'timewindow',  [-0.2, 1.2], ...
    'clusters',    [...
          struct(...
            'Sensors',  {{'E147', 'E148', 'E149', 'E150', 'E151', 'E157', 'E158', 'E159', 'E160', 'E161', 'E167', 'E168', 'E169', 'E170', 'E176', 'E177', 'E178', 'E189', 'E190', 'E201'}}, ...
            'Label',    'Or_P1_N1', ...
            'Function', 'Mean+Std'), ...
         struct(...
            'Sensors',  {{'E93', 'E94', 'E95', 'E96', 'E97', 'E104', 'E105', 'E106', 'E107', 'E108', 'E113', 'E114', 'E115', 'E116', 'E122', 'E123', 'E124', 'E135', 'E136', 'E137'}}, ...
            'Label',    'Ol_P1_N1', ...
            'Function', 'Mean+Std')], ...
    'concatenate', 1, ...
    'save',        1);

As I try to do this now after a while, I get a message that "no clusters are defined in the channel file corresponding to my file list.
What is now the proper way of scripting such an operation?

@filipa

Thanks,
Max

Hi Max,

Since last January, Clusters are saved in the Channel file, so Clusters can be shared across Data files that share the same Channel file. This is analogous to Scouts being saved in Surface files.

Here some functions can be done with Clusters:
https://neuroimage.usc.edu/brainstorm/Tutorials/ChannelClusters#Scripting

However, the process_extract_cluster still can handle clusters defined "on the fly", as in the snippet you shared. In fact, it does work with out trouble.

Best,
Raymundo

Could it be that the "on the fly" feature only works if the channel file has some clusters defined?

Running the lines above, I get the following in the report:

error
[No input]
No clusters available in channel file: sub-003ABpos/@intra/channel.mat
17-May-2023 11:37:16

See this PR.

1 Like

Hi Max,

Thank you for contribution. The PR has been merged into Brainstorm. Indeed my test was made with a channel file with a saved cluster.

Best,
Raymundo