To create a single subject design matrix, the same procedure can be followed like for the stimulation protocol.
Note on BrainVoyager QX 1.10.2: it is also possible to save the design matrix file as an *.sdm file; just replace the "rtc" extension by "sdm".
Please note that via scripting, the Boynton model will be applied, while when constructing via the BrainVoyager QX user interface, the 2-gamma function is used by default.
Via scripting |
Via the BrainVoyager user interface |
|
|
Step 1: open the FMR project To obtain the FMR name in a simple way, we can let the user of the script select the file during runtime:
var fmrname = FileDialog.getOpenFileName();
Then, the FMR project is opened in the BrainVoyager window by providing the fmrname to the OpenDocument() function:
var doc = BrainVoyagerQX.OpenDocument(fmrname);
|
Via the BrainVoyager user interface, also a file can be selected via the FileDialog selector by clicking the 'Open File' icon
or via the main menu 'File' > 'Open'.... Then, BrainVoyager will open the FMR project. |
Step 2: remove the current link from the project to an *.rtc file To start with a new design matrix, use the function ClearDesignMatrix(). This function does not take arguments:
doc.ClearDesignMatrix();
|
|
Step 3: Create empty predictors Predictors can be created by using the AddPredictor() function. The name for the predictor should be provided as argument. Later in the process, the values of the predictor can be set by using this name.
doc.AddPredictor("LVF"); doc.AddPredictor("RVF"); doc.AddPredictor("BVF");
|
In the BrainVoyager user interface, create a predictor via the button 'Add Pred'.
Then change the name in the name field:
|
Step 4: Set predictor values Set the predictor values active for the moments that the stimulus is shown. This is equal to clicking in the color bar of the condition in the Single Study General Linear Model dialog.
doc.SetPredictorValuesFromCondition("LVF", "Objects in LVF", 1.0); doc.SetPredictorValuesFromCondition("RVF", "Objects in RVF", 1.0); doc.SetPredictorValuesFromCondition("BVF", "Objects in BVF", 1.0);
|
In the BrainVoyager user interface this can be achieved by right-clicking on the color bar of the condition in the plot window of the Single Study General Linear Model: |
Step 5: Include the HRF in the model The hemodynamic response function (HRF) can be applied to the created predictors via the function ApplyHemodynamicResponseFunctionToPredictor( <name predictor> ). For the BrainVoyagerQX sample data and CG_OBJECTS.prt the code would be:
doc.ApplyHemodynamicResponseFunctionToPredictor("LVF"); doc.ApplyHemodynamicResponseFunctionToPredictor("RVF"); doc.ApplyHemodynamicResponseFunctionToPredictor("BVF");
The applied model is the Boynton HRF. To use the 2-gamma HRF, one could switch to creating BrainVoyager QX plugins (see the 'Design Matrix Access Functions' topic in the 'Plugins' chapter of the BrainVoyager QX User's Guide). |
Via the BrainVoyager user interface, click 'HRF' to apply the hemodynamic response function:
|
Step 6: Save the *.rtc file
By using the 'FileDialog' method 'getSaveFileName()', the user of the script can specify the name via a file dialog during runtime; the statement
var rtcname = FileDialog.getSaveFileName("*.rtc", "Please choose a name for the RTC file");
results in:
Now we have obtained a name for the RTC file via the FileDialog, save the RTC file via the command SaveSingleStudyGLMDesignMatrix():
doc.SaveSingleStudyGLMDesignMatrix(rtcname);
|
By clicking the 'Save...' button in BrainVoyager QX:
the same type of file dialog will pop up as that is used in the script via FileDialog.getSaveFileName(). |
For a sample script, see *.rtc sample script.
Methods
ClearDesignMatrix()
LoadSingleStudyGLMDesignMatrix( <name *.rtc> )
AddPredictor( <name> )
AutoAddConstantPredictor()
SetPredictorValues( <name>, volnr, volnr, value )
SetPredictorValuesFromCondition( <name predictor>, <name condition>, <value> )
ScalePredictorValues() // doc.ScalePredictorValues("Linear Trend", 1.0, false);
ApplyHemodynamicResponseFunctionToPredictor()
LoadSingleStudyGLMDesignMatrix()
SaveSingleStudyGLMDesignMatrix()
Properties
CorrectForSerialCorrelations