Skip to content

5. Rapid Subclass

ForoughHa edited this page Apr 10, 2019 · 10 revisions

The rapid.m class which is a subclass of magstim.m, is used to control Rapid^2 Magstim stimulators. This subclass inherits all the methods from its parent class, magstim.m, while also overwriting a few (i.e, getParameters, remoteControl, and setAmplitude) as well as adding some more commands for dealing with a Rapid device.

Inherited methods include Initialising, Connecting, Disconnecting, Enabling and Disabling the device, Sending Single Trigger, and Getting Coil Temperature.

- Note that for Rapid2 stimulators with firmware versions V9.0 and above, a device-specific unlock code (to be obtained from the manufacturer) has to be set when initializing the stimulator object to enable remote control.

- Note that some of the following commands might not be available in your device depending on its version.

Enabling/Disabling Remote Control:

This function overwrites the one in the parent class and maintains effective communication with a Rapid device.

magstimObject.remoteControl(enable, varargin);

  • enable {boolean}: is a boolean that can be True(1) to enable and False(0) to disable the device

  • varargin {bool}: refers to getResponse {bool} that can be True (1) or False (0) indicating whether a response from the device is required or not. The default value is set to false.

Setting Amplitude:

To change to your target power value in a Rapid device, you can call this function:

magstimObject.setAmplitudeA(power, varargin);

  • power {double}: is the desired power amplitude for stimulator A.

  • varargin {bool}: refers to getResponse {bool} that can be True (1) or False (0) indicating whether a response from the device is required or not. The default value is set to false.

Setting Frequency, Duration, and Number of Pulses:

This method allows you to alter the working stimulation frequency, duration of train and number of pulses in a single train for your device.

magstimObject.setTrain(trainParameters , varargin);

  • trainParameters {double struct}: is a numeric struct with three fields indicating the desired 'frequency', 'nPulses', 'duration'. In each call of the function, only two of the three parameters can be set, leaving the third field null ([]). Frequency, Duration, and NPulses must be double numeric values.

  • varargin {bool}: refers to getResponse {bool} that can be True (1) or False (0) indicating whether a response from the device is required or not. The default value is set to false.

-Note that one of the three fields must always be left empty. 
-The toolbox will automatically set the third parameter to the only possible valid value.

This function automatically checks for valid input boundaries with respect to the corresponding Energy-Power table of your Rapid device.

Enabling/Disabling Enhanced Power Mode:

In order to switch your device to work in enhanced power mode, you need to simply call the following function.

magstimObject.enhancedPowerMode(enable, varargin);

  • enable {boolean}: is a boolean that can be True(1) to enable and False(0) to disable the enhanced power mode.

  • varargin {bool}: refers to getResponse {bool} that can be True (1) or False (0) indicating whether a response from the device is required or not. The default value is set to false.

Ignoring Coil Interlock Switch:

Calling this command will cause the device to function while ignoring coil safety interclock.

magstimObject.ignoreCoilSafetyInterlock(varargin);

  • varargin {bool}: refers to getResponse {bool} that can be True (1) or False (0) indicating whether a response from the device is required or not. The default value is set to false.

Switching Between Single-Pulse and Repetitive Mode:

This is done by calling the following function:

magstimObject.rTMSMode(enable, varargin);

  • enable {boolean}: is a boolean that can be True(1) to enable and False(0) to disable the switching between single-pulse and repetitive mode.

  • varargin {bool}: refers to getResponse {bool} that can be True (1) or False (0) indicating whether a response from the device is required or not. The default value is set to false.

Getting Rapid Parameters:

This function overwrites the same method in its parent class and provides you with all the available information about the current instrument status and its various parameters.

magstimObject.getParameters();

Getting Device Version:

To retrieve the version of your device, you can call:

magstimObject.getDeviceVersion();

Getting System Status:

To retrieve the status of your device (i.e, Rapod and Instrument status), you need to call the following function:

magstimObject.getSystemStatus();

- This command is not available in stimulator software versions prior to V9.0.

Getting Error Code:

To be informed of the type of any possible error that might have occurred, you can call:

magstimObject.getErrorCode();

You can refer to the Rapid^2 user manual for a complete list of possible error codes.

Calculating Minimum Wait Time:

In order to ensure the reliability of the Rapid2 system, it is important to consider the maximum allowable energy dissipation of the system. In order to ensure this requirement, a minimum wait time must be enforced between each stimulation train. The calculation of the minimum wait time is done by utilizing the Energy Table and the corresponding formula in the Rapid² Host Interface Communication Protocol. For this calculation, you can use the following command:

magstimObject.calcMinWaitTime(power, frequency, nPulses);

- Note that the device will force a minimum wait time of 500ms between pulse trains in case the specified parameters result in a lower wait time than this constraint.

Setting and Getting Charge Delay:

You can use this function in order to set the charge delay to your desired value or get information from the device about the value of the current charge delay.

magstimObject.setChargeDelay(chargeDelay, varargin);

  • chargeDelay {double}: is the desired duration of the charge delay.

  • varargin {bool}: refers to getResponse {bool} that can be True (1) or False (0) indicating whether a response from the device is required or not. The default value is set to false.

magstimObject.getChargeDelay();