Functions

Misc

HRB_validatePipeline(pipelineFile, opt)

HRB_VALIDATEPIPELINE - Validate a pipeline by checking that all the required fields are filled and that the overall structure is compatible with HRB.

Examples

>>> :func:`HRB_validatePipeline`(pipelineFile)
>>> :func:`HRB_validatePipeline`(pipelineFile, 'key', 'val')
Parameters:
  • pipelineFile (string) – A file with the pipeline. Allowed formats are json or yaml.

  • OutputFolder (string) – The output folder where to save the logs

Returns:

The validated pipeline converted to matlab string

Return type:

pipeline (string)

See also

JSONDECODE

Authors: Alessandro Tonin, IRCCS San Camillo Hospital, 2024

HRB_loadPipeline(pipelineFile, opt)

HRB_LOADPIPELINE - Load a pipeline from one or multiple files. Allowed formats are json and yaml.

Examples

>>> :func:`HRB_loadPipeline`(pipelineFile)
>>> :func:`HRB_loadPipeline`(pipelineFile1, pipelineFile2, pipelineFile3)
>>> :func:`HRB_loadPipeline`(pipelineFile, 'key', 'val')
Parameters:
  • pipelineFile (string) – A file with the pipeline. Allowed formats are

  • times. (json or yaml. This parameter can be repeated multiple)

  • OutputFolder (string) – The output folder where to save the logs

Returns:

The pipeline converted to matlab struct

Return type:

pipeline (struct)

See also

JSONDECODE

Authors: Alessandro Tonin, IRCCS San Camillo Hospital, 2024

HRB_saveData(data, opt)

HRB_SAVEDATA - Save a data object. The saved data can be in different format depending on the module where it is saved.

Example

>>> :func:`HRB_saveData`(data)
>>> :func:`HRB_saveData`(data, opt.Name)
>>> :func:`HRB_saveData`(data, opt.Name, opt.Folder)
Parameters:
  • data (any) – A set of data

  • Name (string) – The name of the saved file (default: the name of the calling function)

  • Folder (string) – The folder where to save the file (default: the name of the module of the calling function)

  • OutputFolder (string) – The main folder for all output files. (default: ‘output/date’)

See also

SAVE, POP_SAVESET

HRB_createPipeline(pipelineHandlers, opt)

HRB_CREATEPIPELINE - Create a pipeline from a cellarray of function handlers

Examples

>>> :func:`HRB_createPipeline`(pipelineHandlers)
>>> :func:`HRB_createPipeline`(pipelineHandlers, 'key', 'val')
Parameters:
  • pipelineHandlers (cell) – A cell array of function handlers

  • OutputFolder (string) – The output folder where to save the logs

Returns:

The pipeline converted to matlab struct

Return type:

pipeline (struct)

See also

JSONDECODE

Authors: Alessandro Tonin, IRCCS San Camillo Hospital, 2024

Preprocessing

HRB_resample(EEG, opt)

HRB_RESAMPLE - Resample an EEG dataset. Based on EEGLAB functions.

Examples

>>> [EEG] = :func:`HRB_resample`(EEG)
>>> [EEG] = :func:`HRB_resample`(EEG, 'key', val)
>>> [EEG] = :func:`HRB_resample`(EEG, key=val)
Parameters:
  • EEG (struct) – EEG struct using EEGLAB structure system

  • Frequency (double) – The new resampled frequency

  • Save (logical) – Whether to save or not the resampled EEG.

Returns:

resampled EEG struct using EEGLAB structure system

Return type:

EEG (struct)

See also

EEGLAB, POP_RESAMPLE

HRB_subcomp(EEG, opt)

HRB_subcomp removes independent components from EEG data.

Usage:
>>> EEG = :func:`HRB_subcomp`(EEG) %Removes flagged components
>>> EEG = :func:`HRB_subcomp`(EEG, 'Components', [8 13 21]) %Removes specific
components
Parameters:
  • EEG (struct) – EEG struct using EEGLAB struct system.

  • Components (1xN vector) – Vector listing the components to be removed.

  • empty (If)

  • (EEG.reject.gcompreject).

  • Keep (logical) – If true, it keeps the listed components.Default is

  • false.

  • Save (logical) – Whether to save the pruned datase

See also: EEGLAB, pop_subcomp

Authors: Ettore Napoli, University of Bologna, 2026

HRB_rejepochs(EEG, opt)

HRB_rejepochs reject epochs based on amplitudes threshold

Usage:
>>> EEG = :func:`HRB_rejepochs`(EEG, 'Threshold', 100, 'Channels', [1:32]) %Rejects >+100 and <-100 uV
>>> EEG = :func:`HRB_rejepochs`(EEG, 'Threshold', [min max], 'Channels', [1:32])
Parameters:
  • EEG (struct) – EEG struct using EEGLAB struct system.Epochs must have

  • extracted. (been)

  • Threshold (double) – Amplitude limit in uV. - If scalar (e.g., 100): Limits are set to [-100 100] - If vector (e.g. [-50 150]): Limits are specific

  • Channels (vector) – List of channel indices to check. Default is [] = ALL

  • TimeLimits (1x2 double) – Time window to check in seconds [min max].Default is [] = whole epoch

  • Save (logical) – Save the cleaned dataset

See also: EEGLAB, pop_eegthresh, pop_rejepoch

Authors: Ettore Napoli, University of Bologna, 2026

HRB_filter(EEG, opt)

HRB_FILTER - Filter an EEG dataset. Based on EEGLAB functions.

Examples

>>> [EEG] = :func:`HRB_filter`(EEG);
>>> [EEG] = :func:`HRB_filter`(EEG, 'key', val);
>>> [EEG] = :func:`HRB_filter`(EEG, key=val);
Parameters:
  • EEG (struct) – EEG struct using EEGLAB structure system

  • Type (string) – Type of the filter. Allowed values are: bandpass, lowpass, highpass, bandstop

  • LowCutoff (double) – The low cutoff frequency

  • HighCutoff (double) – The high cutoff frequency

Returns:

filtered EEG struct using EEGLAB structure system

Return type:

EEG (struct)

See also

EEGLAB, POP_EEGFILTNEW

HRB_iclabel(EEG, opt)

HRB_iclabel labels independnt components using ICLabel

Examples

>>> EEG = :func:`HRB_iclabel`(EEG)
>>> EEG = :func:`HRB_iclabel`(EEG, 'key', val)
>>> EEG = :func:`HRB_iclabel`(EEG, key = val)
Parameters:
  • EEG (struct) – EEG struct using EEGLAB struct system. ICs weights must

  • computed (have been)

  • Version (string) – ‘default’, ‘lite’, ‘beta’

  • Save (logical) – whether to save or not the dataset with labeled

  • components

See also: EEGLAB, pop_iclabel

Authors: Ettore Napoli, University of Bologna, 2026

HRB_removeChannels(EEG, opt)

HRB_REMOVECHANNELS - Remove a list of channels from an EEG dataset.

Examples

>>> [EEG] = :func:`HRB_removeChannels`(EEG)
>>> [EEG] = :func:`HRB_removeChannels`(EEG, 'key', val)
>>> [EEG] = :func:`HRB_removeChannels`(EEG, key=val)
Parameters:
  • EEG (struct) – EEG struct using EEGLAB structure system

  • Channels ({str}) – Cell array with channel names

Returns:

EEG struct using EEGLAB structure system

Return type:

EEG (struct)

See also

EEGLAB, POP_SELECT

HRB_runica(EEG, opt)

HRB_RUNICA - Perform ICA decomposition with Infomax ICA algorithm.

Examples

>>> [EEG] = :func:`HRB_runica`(EEG)
>>> [EEG] = :func:`HRB_runica`(EEG, 'key', val)
>>> [EEG] = :func:`HRB_runica`(EEG, key=val)
Parameters:
  • EEG (struct) – EEG struct using EEGLAB structure system

  • Extended (integer) – perform TANH “extended-ICA” with sign estimation N training blocks

  • Interrupt (logical) – draw interrupt figure

  • SaveBefore (logical) – save data before running ICA

  • SaveBeforeName (string) – name of saved data before running ICA

Returns:

EEG struct using EEGLAB structure system

Return type:

EEG (struct)

See also

EEGLAB, POP_RUNICA, RUNICA

HRB_selectTime(EEG, opt)

HRB_SELECTTIME - Select a time window from an EEG dataset.

Examples

>>> [EEG] = :func:`HRB_selectTime`(EEG)
>>> [EEG] = :func:`HRB_selectTime`(EEG, 'key', val)
>>> [EEG] = :func:`HRB_selectTime`(EEG, key=val)
Parameters:
  • EEG (struct) – EEG struct using EEGLAB structure system

  • AfterStart (double) – Seconds to select after the start of the recording

  • BeforeEnd (double) – Seconds to select before the end of the recording

Returns:

EEG struct using EEGLAB structure system

Return type:

EEG (struct)

See also

EEGLAB, POP_SELECT

HRB_selectChannels(EEG, opt)

HRB_SELECTCHANNELS - Select a list of channels from an EEG dataset.

Examples

>>> [EEG] = :func:`HRB_selectChannels`(EEG)
>>> [EEG] = :func:`HRB_selectChannels`(EEG, 'key', val)
>>> [EEG] = :func:`HRB_selectChannels`(EEG, key=val)
Parameters:
  • EEG (struct) – EEG struct using EEGLAB structure system

  • Channels ({str}) – Cell array with channel names

Returns:

EEG struct using EEGLAB structure system

Return type:

EEG (struct)

See also

EEGLAB, POP_SELECT

HRB_icflag(EEG, opt)

HRB_icflag flags artifactual components based on ICLabel

Usage:
>>> EEG = :func:`HRB_icflag`(EEG, 'Muscle', [0.9, 1], 'Eye', [0.9, 1])
Parameters:

EEG (struct) – EEG struct using EEGLAB struct system. ICs weights must

:param have been computed and labeled through HRB_iclabel:

Parameters:
  • parameters (Threshold) – Each parameter accept a [min max]

  • vector (1x2 double)

  • NaN]. (will be flagged. Default is [NaN)

  • follow (The parameters are as) – Brain, Muscle, Eye, Heart,

  • LineNoise

  • ChannelNoise

  • Other.

  • Save (logical) – Whether to save the dataset with the flagged

  • components.

See also: EEGLAB, pop_iclabel, pop_icflag

Authors: Ettore Napoli, University of Bologna, 2026

HRB_chanedit(EEG, opt)

HRB_CHANEDIT - edit channel file

Usage:

>> [EEG] = :func:`HRB_chanedit`(chan_file) >> [EEG] = :func:`HRB_chanedit`(chan_file, ‘key’, val) >> [EEG] = :func:`HRB_chanedit`(chan_file, key=val)

Inputs:

EEG = [struct] EEG struct using EEGLAB structure system chan_file = [string] channel file path OR template filetype =

Outputs:

EEG = [struct] EEG struct using EEGLAB structure system

Authors: Sara Lago, IRCCS San Camillo Hospital, 2024

See also: EEGLAB, POP_CHANEDIT

HRB_cleanData(EEG, opt)

HRB_CLEANDATA - Automatic data cleaning removing bad channels.

Examples

>>> [EEG] = :func:`HRB_cleanData`(EEG)
>>> [EEG] = :func:`HRB_cleanData`(EEG, 'key', val)
>>> [EEG] = :func:`HRB_cleanData`(EEG, key=val)
Parameters:
  • EEG (struct) – EEG struct using EEGLAB structure system

  • Severity (string) – Severity of the paraemters to clean data. Available values are “loose” or “strict”.

  • SaveExcludedChannels (logical) – Whether to save or not the list of excluded channels.

Returns:

EEG struct using EEGLAB structure system

Return type:

EEG (struct)

See also

EEGLAB, POP_SELECT

HRB_epoch(EEG, opt)
HRB_epoch performs epoching and baseline correction

on either task-based or resting state EEG data

Usage:
>>> EEG = :func:`HRB_epoch`(EEG, 'Mode', 'Event', 'Events', {'S1'}, 'Limits',[-1 2])
>>> EEG = :func:`HRB_epoch`(EEG, 'Mode', 'Time', 'Recurrence', 2, 'Limits', [0 2])
Parameters:

EEG (struct): EEG struct using EEGLAB struct system.

Other Parameters:
Mode (string): ‘Event’ (default) or ‘Time’
  • ‘Event’: Extracts epochs locked to a specific Event (task)

  • ‘Time’: Cuts data into regular intervals (Resting state)

— Mode ‘Event’ specific parameters —

Events (string / cell): Event types to time-lock to. If [] uses all Events

— Mode ‘Time’ specific parameters —

Recurrence (double): Interval in seconds between epochs (default 1)

— Common parameters —
Limits (1x2 double): Epoch lantecy limits [start end] in seconds
  • For “Event”: relative to a marker (e.g. [-1 2])

  • For “Time”: duration of the chunk (e.g. [0 2])

Baseline (1x2 double): Baseline correction [start end] in seconds. If empty (e.g. []), no baseline correction is applied

Save (logical): Save the epoched dataset

See also: EEGLAB, pop_epoch, eeg_regepochs, pop_rmbase

Authors: Ettore Napoli, University of Bologna, 2026

Head Model

Source Estimation

Connectivity

Network

Utils

logger
cprintf()

The type of the None singleton.

catStruct()

The type of the None singleton.

RenameField()

The type of the None singleton.