Skip to content

Commit

Permalink
Connectivity: Deprecation of older AEC processes, replaced with HENV
Browse files Browse the repository at this point in the history
  • Loading branch information
ftadel committed Jun 9, 2022
1 parent 7318986 commit 33a5ffa
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 92 deletions.
2 changes: 1 addition & 1 deletion doc/license.html
Expand Up @@ -5,7 +5,7 @@
<body alink="#fff000" link="#fff000" vlink="#fff000">
<h4><span style="font-family: Arial Black; color: #ffffff;"><strong>THERE IS NO UNDO BUTTON!<BR>SET UP A <FONT color=red>BACKUP</FONT> OF YOUR DATABASE</strong></span></h4>
<HR>
<!-- LICENCE_START -->Version: 3.220608 (08-Jun-2022)<br>
<!-- LICENCE_START -->Version: 3.220609 (09-Jun-2022)<br>
<span style="font-style: italic;">COPYRIGHT &copy; 2000-2022
USC &amp; McGill University.<br>
</span>
Expand Down
5 changes: 5 additions & 0 deletions doc/updates.txt
@@ -1,3 +1,8 @@
June 2022
- Connectivity: New slider to threshold by percentile in Display tab
- Connectivity: Deprecation of older AEC processes, replaced with HENV
- GUI: Keep file selection when navigating between tabs
--------------------------------------------------------------
May 2022
- IO: Fixed export to Plotly
- New process: Threshold by percentile
Expand Down
2 changes: 1 addition & 1 deletion doc/version.txt
@@ -1,2 +1,2 @@
% Brainstorm
% v. 3.220608 (08-Jun-2022)
% v. 3.220609 (09-Jun-2022)
4 changes: 3 additions & 1 deletion toolbox/connectivity/bst_connectivity.m
Expand Up @@ -467,7 +467,9 @@
R = reshape(R, size(R,1), size(R,2), 1, size(R,3));

% ==== AEC ====
case 'aec'
% WARNING: This function has been deprecated. Now using the HENV implementation instead
% See discussion on the forum: https://neuroimage.usc.edu/forums/t/30358
case 'aec' % DEPRECATED
bst_progress('text', sprintf('Calculating: AEC [%dx%d]...', size(sInputA.Data,1), size(sInputB.Data,1)));
Comment = 'AEC: ';
% Get frequency bands
Expand Down
3 changes: 3 additions & 0 deletions toolbox/connectivity/bst_henv.m
Expand Up @@ -24,6 +24,9 @@
% - timePoints : Time vector corresponding to the connectivity matrix
% - nWindows : Number of estimator windows
%
% REFERENCES:
% - Comparisons with previous AEC implementation is discussed on the forum: https://neuroimage.usc.edu/forums/t/30358
%
% @=============================================================================
% This function is part of the Brainstorm software:
% https://neuroimage.usc.edu/brainstorm
Expand Down
2 changes: 1 addition & 1 deletion toolbox/gui/figure_spectrum.m
Expand Up @@ -1537,7 +1537,7 @@ function UpdateFigurePlot(hFig, isForced)
strAmp = 'Corrected imaginary phase locking value';
case {'plvm', 'plvtm'}
strAmp = 'Phase locking value magnitude';
case 'aec'
case 'aec' % DEPRECATED
strAmp = 'Average envelope correlation';
% Hilbert (time-varying)
case 'coh'
Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,88 +1,88 @@
function varargout = process_aec2( varargin )
% PROCESS_AEC2: Compute amplitude envelope correlation between one signal in one file, and all the signals in another file.

% @=============================================================================
% This function is part of the Brainstorm software:
% https://neuroimage.usc.edu/brainstorm
%
% Copyright (c) University of Southern California & McGill University
% This software is distributed under the terms of the GNU General Public License
% as published by the Free Software Foundation. Further details on the GPLv3
% license can be found at http://www.gnu.org/copyleft/gpl.html.
%
% FOR RESEARCH PURPOSES ONLY. THE SOFTWARE IS PROVIDED "AS IS," AND THE
% UNIVERSITY OF SOUTHERN CALIFORNIA AND ITS COLLABORATORS DO NOT MAKE ANY
% WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
% MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, NOR DO THEY ASSUME ANY
% LIABILITY OR RESPONSIBILITY FOR THE USE OF THIS SOFTWARE.
%
% For more information type "brainstorm license" at command prompt.
% =============================================================================@
%
% Authors: Francois Tadel, 2012-2014
% Peter Donhauser, 2017

eval(macro_method);
end


%% ===== GET DESCRIPTION =====
function sProcess = GetDescription() %#ok<DEFNU>
% Description the process
sProcess.Comment = 'Amplitude Envelope Correlation AxB';
sProcess.Category = 'Custom';
sProcess.SubGroup = 'Connectivity';
sProcess.Index = 657;
sProcess.Description = 'https://neuroimage.usc.edu/brainstorm/Tutorials/Connectivity';
% Definition of the input accepted by this process
sProcess.InputTypes = {'data', 'results', 'matrix'};
sProcess.OutputTypes = {'timefreq', 'timefreq', 'timefreq'};
sProcess.nInputs = 2;
sProcess.nMinFiles = 1;
sProcess.isPaired = 1;

% === CONNECT INPUT
sProcess = process_corr2('DefineConnectOptions', sProcess);
% === FREQ BANDS
sProcess.options.freqbands.Comment = 'Frequency bands for the Hilbert transform:';
sProcess.options.freqbands.Type = 'groupbands';
sProcess.options.freqbands.Value = bst_get('DefaultFreqBands');
% === Orthogonalize pairs of signals
sProcess.options.isorth.Comment = 'Orthogonalize signal pairs before envelope computation';
sProcess.options.isorth.Type = 'checkbox';
sProcess.options.isorth.Value = 0;
% === OUTPUT MODE
sProcess.options.outputmode.Comment = {'Save individual results (one file per input file)', 'Concatenate input files before processing (one file)', 'Save average connectivity matrix (one file)'};
sProcess.options.outputmode.Type = 'radio';
sProcess.options.outputmode.Value = 1;
sProcess.options.outputmode.Group = 'output';
end


%% ===== FORMAT COMMENT =====
function Comment = FormatComment(sProcess) %#ok<DEFNU>
Comment = sProcess.Comment;
end


%% ===== RUN =====
function OutputFiles = Run(sProcess, sInputA, sInputB) %#ok<DEFNU>
% Input options
OPTIONS = process_corr2('GetConnectOptions', sProcess, sInputA, sInputB);
if isempty(OPTIONS)
OutputFiles = {};
return
end

OPTIONS.Method = 'aec';
% Hilbert and frequency bands options
OPTIONS.Freqs = sProcess.options.freqbands.Value;
OPTIONS.isOrth = sProcess.options.isorth.Value;

% Compute metric
OutputFiles = bst_connectivity({sInputA.FileName}, {sInputB.FileName}, OPTIONS);
end




function varargout = process_aec2( varargin )
% PROCESS_AEC2: Compute amplitude envelope correlation between one signal in one file, and all the signals in another file.

% @=============================================================================
% This function is part of the Brainstorm software:
% https://neuroimage.usc.edu/brainstorm
%
% Copyright (c) University of Southern California & McGill University
% This software is distributed under the terms of the GNU General Public License
% as published by the Free Software Foundation. Further details on the GPLv3
% license can be found at http://www.gnu.org/copyleft/gpl.html.
%
% FOR RESEARCH PURPOSES ONLY. THE SOFTWARE IS PROVIDED "AS IS," AND THE
% UNIVERSITY OF SOUTHERN CALIFORNIA AND ITS COLLABORATORS DO NOT MAKE ANY
% WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
% MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, NOR DO THEY ASSUME ANY
% LIABILITY OR RESPONSIBILITY FOR THE USE OF THIS SOFTWARE.
%
% For more information type "brainstorm license" at command prompt.
% =============================================================================@
%
% Authors: Francois Tadel, 2012-2014
% Peter Donhauser, 2017

eval(macro_method);
end


%% ===== GET DESCRIPTION =====
function sProcess = GetDescription() %#ok<DEFNU>
% Description the process
sProcess.Comment = 'Amplitude Envelope Correlation AxB';
sProcess.Category = 'Custom';
sProcess.SubGroup = 'Connectivity';
sProcess.Index = 657;
sProcess.Description = 'https://neuroimage.usc.edu/brainstorm/Tutorials/Connectivity';
% Definition of the input accepted by this process
sProcess.InputTypes = {'data', 'results', 'matrix'};
sProcess.OutputTypes = {'timefreq', 'timefreq', 'timefreq'};
sProcess.nInputs = 2;
sProcess.nMinFiles = 1;
sProcess.isPaired = 1;

% === CONNECT INPUT
sProcess = process_corr2('DefineConnectOptions', sProcess);
% === FREQ BANDS
sProcess.options.freqbands.Comment = 'Frequency bands for the Hilbert transform:';
sProcess.options.freqbands.Type = 'groupbands';
sProcess.options.freqbands.Value = bst_get('DefaultFreqBands');
% === Orthogonalize pairs of signals
sProcess.options.isorth.Comment = 'Orthogonalize signal pairs before envelope computation';
sProcess.options.isorth.Type = 'checkbox';
sProcess.options.isorth.Value = 0;
% === OUTPUT MODE
sProcess.options.outputmode.Comment = {'Save individual results (one file per input file)', 'Concatenate input files before processing (one file)', 'Save average connectivity matrix (one file)'};
sProcess.options.outputmode.Type = 'radio';
sProcess.options.outputmode.Value = 1;
sProcess.options.outputmode.Group = 'output';
end


%% ===== FORMAT COMMENT =====
function Comment = FormatComment(sProcess) %#ok<DEFNU>
Comment = sProcess.Comment;
end


%% ===== RUN =====
function OutputFiles = Run(sProcess, sInputA, sInputB) %#ok<DEFNU>
% Input options
OPTIONS = process_corr2('GetConnectOptions', sProcess, sInputA, sInputB);
if isempty(OPTIONS)
OutputFiles = {};
return
end

OPTIONS.Method = 'aec';
% Hilbert and frequency bands options
OPTIONS.Freqs = sProcess.options.freqbands.Value;
OPTIONS.isOrth = sProcess.options.isorth.Value;

% Compute metric
OutputFiles = bst_connectivity({sInputA.FileName}, {sInputB.FileName}, OPTIONS);
end




0 comments on commit 33a5ffa

Please sign in to comment.