(1) Overview

Introduction

Statement of need

Research on body-brain interactions has been growing exponentially [], with particular emphasis on cardiac signals. This has demanded scientists to update their methodological toolboxes [], creating the need for new tasks and software [e.g., , ]. Presenting stimuli at different phases of the cardiac cycle (i.e., systole and diastole) is a crucial experimental manipulation to study heart-brain interactions and its integration into behavioural tasks was made easier by commendable efforts []. However, the implementations so far rely on indirect measures of cardiac activity (i.e., photoplethysmography) or equipment that is unsuitable for functional Magnetic Resonance Imaging (fMRI) research. Transferring the cardiac cycle manipulation inside the MRI scanner can allow testing theories of interoception neurally []. However, recording an electrocardiogram (ECG) inside the MRI scanner presents technical challenges. Here, we present Cuspis, a MATLAB suite for presenting cardiac-contingent stimuli in fMRI tasks. To achieve this, Cuspis uses a few core functions and minimal MRI-compatible hardware.

Introduction

The continuous processing of internal bodily signals by the brain is referred to as interoception []. In the past years, the scientific interest in interoception has been rising due to the important role it plays in a range of cognitive processes [, ]. Traditionally, interoceptive research investigated cardiac signals, with early works focusing on the conscious perception of heartbeats [e.g., , ]. As the field advanced, this approach revealed its limitations [, , but see , , ], indicating the need for reconsidering current methods []. Recently, a more mechanistic approach to the study of interoception has focused on the afferent heart-to-brain signals conveyed by the baroreceptors. In such instances, a cardiac cycle manipulation is used, whereby stimuli are time-locked either to the participants’ systole (~200–400 ms after the ECG’s R-wave) or to their diastole (~500–800 ms after the ECG’s R-wave). This manipulation has been used in many studies, as it allows to investigate the pre-conscious influence of cardiac signals in domains like perception [e.g., , ], learning and memory [e.g., , ], as well as social cognition [e.g., , ].

Combining the cardiac-contingent presentation of stimuli with imaging techniques is fundamental to testing theories of interoception at the neural level [] by uncovering the mechanisms that underpin heart-brain interactions. The relevant literature already counts several publications with magnetoencephalography (MEG) [see ] and electroencephalography (EEG) [see ], but these techniques come with complementary trade-offs. On one hand, MEG offers high spatial resolution in the face of substantial costs for researchers []; on the other hand, EEG is considerably more affordable but falls short of targeting major brain areas of the interoceptive network, which lie underneath the cortical surface [, ]. In this respect, fMRI represents an ideal compromise, harbouring huge potential for the field.

To date, fMRI experiments where the cardiac-contingent presentation of stimuli is directly triggered by heartbeats are not common [, , ]. Although it is difficult to pinpoint the reasons behind this scarcity, we speculate that the methodological challenges posed by the cardiac cycle manipulation may play a role. Indeed, this manipulation requires complex setups and technical skills and it often needs to be adapted to photoplethysmography (PPG), a measure relying on a proxy of heartbeats (i.e., pulse wave peak), or to estimate the heartbeats’ onsets []. Thus, access to the cardiac cycle manipulation is limited and this, in turn, reduces the degrees of freedom in experimental design. Ad hoc software may support researchers interested in cardiac signals and several applications have been recently released with this intention [, , , ].

To the best of our knowledge, software for the cardiac-contingent presentation of stimuli for fMRI is not yet available. The cardiac cycle manipulation has already been implemented as part of a Python package [], but it uses PPG and equipment that is inadequate for the MRI environment. To address this limitation, we developed Cuspis (Latin: [kuspis], meaning “sharp point”), a MATLAB suite that works with ECG and MRI-compatible equipment. Cuspis is built on the BIOPAC Hardware API (BHAPI) [] to interface the ECG100C-MRI [] for ECG recording and Psychtoolbox [, ] for stimulus presentation. Cuspis uses a few core functions and requires a minimal setup to detect the ECG’s R-wave and display an image at systole or diastole, according to a predefined stimulus onset asynchrony (SOA). We hope that Cuspis will help researchers interested in heart-brain interactions to replicate and extend current findings in new neuroimaging experiments, as well as encourage multicentre studies with adequate statistical power.

Implementation and architecture

We designed Cuspis as an extension to the cardiac cycle manipulation implemented for the behavioural research conducted at Royal Holloway, University of London [e.g., , ], in the Lab of Action and Body (https://www.manostsakiris.org/intheself). In short, Cuspis records the ECG and detects the R-wave according to a user-defined threshold; once the R-wave is detected, a stimulus is presented with a specific SOA.

Cuspis runs in MATLAB (https://mathworks.com/), a prevalent software in fMRI research, and it is built on the BHAPI [] and Psychtoolbox [, ]. BHAPI is a collection of programming “building blocks” (i.e., a Dynamic Link Library) that can be used to develop MATLAB applications. BHAPI allows communication with BIOPAC’s Data Acquisition (DAQ) systems (e.g., MP160) to collect physiological signals like the ECG. Psychtoolbox is a popular MATLAB package for presenting stimuli in experimental tasks. The setup required to use Cuspis during fMRI includes the following hardware and software components, as detailed below.

Hardware

  1. High-specs computer.
  2. MP160 Starter System (which includes the HLT100C module).
  3. ECG100C-MRI module.
  4. MRI-compatible ECG cables (MECMRI-1 and MECMRI-2), leads (LEAD110), and electrodes (EL508).

Optional, but recommended:

  • 5. Lead adapter (CBL205-MRI) for the ECG’s ground electrode.
  • 6. Electrode paste (GEL101) to improve signal quality.

Software

  1. MATLAB.
  2. BHAPI.
  3. Psychtoolbox.

See the Appendix for more information about the computer and software we used.

Core functions

Cuspis consists of the core functions listed in Table 1.

Table 1

Cuspis’ functions.


NAMEPURPOSE

setApiSet the BHAPI to use.

setDaqSet the DAQ to use.

openApiSwitch on the BHAPI.

closeApiSwitch off the BHAPI.

plotLiveSignalPlot the ECG in real time.

recSignalRecord the ECG for a specific duration.

getEcgThreshCompute the ECG threshold for triggering a trial.

prepStimDefines the settings for the stimulus presentation.

triggerTrialTrigger the stimulus presentation according to a threshold and specific stimulus settings. The stimulus presentation can be single or multiple (cardio-visual stimulation).

plotTrialPlot the trial data: onsets and offsets of events.

To install Cuspis, users should create a new folder called “cuspis” and move the Cuspis’ functions there; then, add that folder to MATLAB’s path. Before using Cuspis, users must also install the BHAPI and Psychtoolbox, which are not provided as part of Cuspis.

Quality control

Quality control is performed by providing an example of how Cuspis can be applied in a typical research scenario (see the Use case section below). As mentioned earlier, transferring the cardiac cycle manipulation inside the MRI scanner is critical to studying heart-brain interactions and their neural underpinnings. Cuspis can be used in such instances and its functions were designed accordingly.

Use case – An example pipeline

We now describe a simplified use case, where some researchers run ten cardio-visual stimulation trials and, on each trial, present an image (i.e., a circle) at systole (i.e., ~0.300 s after the R-wave) for three times. Code blocks are in the MATLAB programming language. For the sake of conciseness, minimal code and pseudocode are used. The reader can also refer to the USECASE.m script and the documentation of Cuspis’ functions, both available on GitHub (https://github.com/PHJT003/cuspis).

At the beginning of an fMRI experiment, researchers prepare their setup and participant. They want to record an ECG signal from Channel 1 of the MP160. They use an Ethernet cable to connect the MP160 to the laptop running Cuspis and set the sampling frequency at 10 kHz. Next, they switch on the BHAPI.

Once they are ready to collect the ECG, the researchers visually check if the signal can be recorded correctly. At this stage, it is crucial to reduce any source of artefacts to maximise the amplitude of the R-waves (see Box 1), which will be used for the cardio-visual stimulation.

Box 1. A note on recording the ECG inside an MRI scanner.

Recording the ECG in an MRI scanner remains challenging, as the electromagnetic field inevitably reduces the signal-to-noise ratio. Therefore, to begin with, it is crucial to record the ECG with the best possible quality. Below, we provide some practical suggestions when recording ECG inside the MRI scanner to present stimuli at systole and diastole.

First and foremost, researchers should invest time when attaching the ECG electrodes to their participants. For example, they should prepare their skin (e.g., cleaning, scrubbing, hair trimming) and apply a conductive gel to lower the impedance [see , , ], as well as use an AC-coupled lead adapter to prevent ground loops. Here, the principle is that there is no good substitute for bad data (see Figure 1).

Secondly, the output of the BIOPAC’s ECG100C-MRI module can be optimised by flicking the switches on its front panel. In our experience, these settings appeared to be the most suitable for R-wave detection.

  • Gain   = 5000.
  • Mode  = R-wave.
  • LP       = 150 Hz.
  • HP      = 1.0 Hz.

Lastly, recording with a high sampling frequency (e.g., 10 kHz) yields a better data reconstruction, hence supporting the cardiac cycle manipulation.

Figure 1 

ECG inside the MRI scanner. All things being equal, participants’ compliance and preparation determine the legibility of the ECG’s R-waves used in the cardiac cycle manipulation. The figure shows the ECG of a participant who did not comply with the researcher’s instructions (top) and another one who did (bottom).

Next, the researchers should record a baseline ECG for five minutes while the participant undergoes a dummy scanning session. Then, the researchers estimate a threshold (see Figure 2), which will be used to trigger the experimental trials.

Figure 2 

Threshold estimation. The function getEcgThresh detects the R-waves and estimates a threshold as a percentage of the average R-wave amplitude. The detected R-waves are marked with a circle, while the threshold is displayed as a red horizontal line.

The experimental task can be now administered. The researchers set the parameters for the trials and stimulus presentation in advance. Each trial will last six seconds and will display the circle.jpg stimulus. The image will be “flashed” three times on the screen, each time for 0.100 s. Importantly, the stimulus will be presented at systole, thus the SOA is set to 0.300 s after the R-wave. The R-waves will be detected once the ECG signal exceeds the estimated threshold.

At the end of the experimental task, the researchers switch off the BHAPI and visually check the cardiac cycle manipulation for a trial (see Figure 3). In this case, they inspect the last trial and verify that the peak detection corresponds to the R-wave (orange, vertical lines) and that the stimulus onset (green, vertical lines) approximates the 0.300 s SOA. For convenience, the theoretical and empirical SOA are annotated on the plot, respectively in the title and on the ECG waveform.

Figure 3 

Trial’s plot. The function plotTrial shows the ECG used in a specific trial, as well as the events of interest. The onsets of detected R-waves and presented stimuli are marked by orange and green vertical lines, respectively. The offset of the stimulus is marked by a green square. The threshold used for the cardiac-contingent presentation of the stimuli is also shown as a dashed, horizontal line.

(2) Availability

Operating system

Cuspis was tested at Royal Holloway, University of London using a Dell Inspiron 15 7000 Gaming laptop (Windows 10 OS), BHAPI 2, MATLAB R2021a, and Psychtoolbox 3, both outside and inside an MRI scanner. In the latter case, a Siemens Tim Trio 3 Tesla scanner was used and whole-brain multiband-gradient EPI functional data were acquired (multiband acceleration factor = 2; TR = 2000 ms; TE = 30 ms; FA = 78°; 50 axial slices; image matrix = 96×96 mm; FoV = 192×192 mm; voxel size = 2×2×2 mm).

Programming language

MATLAB.

Additional system requirements

None, but see the Implementation and architecture section and the Appendix.

Dependencies

BHAPI; Psychtoolbox; Signal Processing Toolbox.

List of contributors

  1. Valerio Villani created the suite and wrote the first draft of the manuscript.
  2. Manos Tsakiris obtained the funding for this project, provided advice during the development of the suite, and contributed to the writing-up of the manuscript.

Software location

Archive

    Name: Zenodo

    Persistent identifier: 10.5281/zenodo.8011115

    Licence: N/A

    Publisher: Villani, Valerio

    Version published: 0.1.0

    Date published: 06/06/23

Code repository

    Name: GitHub

    Identifier: https://github.com/PHJT003/cuspis

    Licence: GPL-3.0 license

    Date published: 06/06/23

Language

English.

(3) Reuse potential

Cuspis was designed for fMRI tasks that implement the cardiac cycle manipulation. Currently, Cuspis supports the cardiac-contingent presentation of images, based on the raw ECG recorded from a single channel. However, researchers can use Cuspis outside the MRI scanner and, in principle, with different bodily rhythms, such as the respiratory cycle. Moreover, researchers with programming experience can easily extend the functionality of Cuspis to present stimuli in other sensory modalities (e.g., sounds) through Psychtoolbox, process the ECG in real-time, or record more than one physiological signal. Cuspis is made freely available on GitHub (https://github.com/PHJT003/cuspis) for use and collaborative development under the GPL-3.0 licence.

Limitations

The applicability of Cuspis presents some limitations that are worth noting. First, Cuspis is intended for fMRI on healthy participants and, therefore, it may be unsuitable to study some clinical populations. For example, in patients with tachycardia, a significantly higher heart rate could result in the spillover of stimuli across the phases of the cardiac cycle. This would, in turn, make it difficult to distinguish between the brain activity associated with events occurring at systole and diastole. Secondly, Cuspis requires researchers to balance out the signal-to-noise ratio of both the heart and the brain activity. Indeed, given that the cardiac cycle lasts on average less than a second [], rapid MRI sequences are necessary while keeping electromagnetic artefacts in the ECG to a minimum (cf. Box 1). Lastly, Cuspis is focused on one dimension of interoception: the pre-conscious impact of afferent cardiac signals [], namely heart-to-brain influences. Cuspis cannot be used to address brain-to-heart influences or to implement other methodological approaches, such as brain-heart synchronisation. However, with the appropriate modifications, Cuspis could in principle support research projects on heart-brain synchronisation with either fMRI [e.g., ] or EEG [e.g., ].

Conclusions

The lack of infrastructure for the fMRI of heart-brain interactions is a strong technical limitation. Cuspis aims to tackle this limitation by providing a software solution that combines BIOPAC’s hardware and Psychtoolbox, two widely used research tools. Cuspis can be further extended by coding and adding features in MATLAB. For example, an algorithm for the objective quantification of noise in the ECG could be implemented, helping researchers discard the trials with an unreliable cardiac cycle manipulation. In conclusion, within the boundaries of its intended use, we believe that Cuspis could be a useful tool in interoceptive research.