Like shown in the figure below, the BrainVoyager QX application object can create a project (CreateProjectVMR(), CreateProjectAMR(), CreateProjectMosaicFMR() and CreateProjectFMR()), open a project (OpenDocument()). The BrainVoyager object has also control over the window and can set the current directory.
An example of controlling the position of the BrainVoyager window is shown in the function moveBVQXWindow():
function moveBVQXWindow(horizontalPx, verticalPx) {
var BVQX = Application.BrainVoyagerQX;
var currentHorizontalWindowPosition = BVQX.x;
var currentVerticalWindowPosition = BVQX.y;
BVQX.MoveWindow(currentHorizontalWindowPosition + horizontalPx, currentVerticalWindowPosition + verticalPx);
}
The function can be invoked by another function, f.e. testMoveBVQXWindow():
function testMoveBVQXWindow() {
moveBVQXWindow(20, 30);
}
An example of controlling the size of the BrainVoyager window is shown in the following function:
function resizeBVQXWindow(widthInPx, heightInPx) {
var BVQX = Application.BrainVoyagerQX;
var windowWidth = BVQX.w;
var windowHeight = BVQX.h;
BVQX.ResizeWindow(windowWidth + widthInPx, windowHeight + heightInPx);
}
The function can be invoked by another function, f.e. testResizeBVQXWindow():
function testResizeBVQXWindow() {
resizeBVQXWindow(-20, -30);
}
When a BrainVoyager AMR, FMR or VMR document is already opened, the method ActiveDocument() will return the current selected document:
function getActiveDocument() {
var BVdoc = BrainVoyagerQX.ActiveDocument();
if (BVdoc == undefined) {
MessageBox.information("No document available");
BVdoc = BrainVoyagerQX.OpenDocument(FileDialog.getOpenFileName());
} else {
MessageBox.information("Name of current document: " + BVdoc.name);
}
return BVdoc;
}