Skip to content

Commit

Permalink
Latest changes TSIExchanger plugin 1.1.0.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Gijsen committed Dec 18, 2015
1 parent f6b50a8 commit e164334
Show file tree
Hide file tree
Showing 28 changed files with 1,123 additions and 7,253 deletions.
675 changes: 675 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

6,884 changes: 0 additions & 6,884 deletions NetworkPlugin_guide.rtf

This file was deleted.

29 changes: 29 additions & 0 deletions README
@@ -0,0 +1,29 @@
----------------------------------
TSIExchanger, a BrainStim plugin
----------------------------------

The BrainStim Project page is located at:
<http://github.com/svengijsen/BrainStim>

This plugins documentation is located at:
<http://svengijsen.github.io/TSIExchanger/>

and can be downloaded from:
<http://github.com/svengijsen/TSIExchanger/releases>

This plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.




77 changes: 76 additions & 1 deletion TSIExchanger.cpp
Expand Up @@ -18,7 +18,7 @@
#include "TSIExchanger.h"
#include <QDebug>

QScriptValue TSIExchanger::ctor__extensionname(QScriptContext* context, QScriptEngine* engine)
QScriptValue TSIExchanger::ctor_TSIExchanger(QScriptContext* context, QScriptEngine* engine)
{
Q_UNUSED(context);
//this function gets called first whenever a new object is constructed trough the script
Expand Down Expand Up @@ -85,6 +85,81 @@ bool TSIExchanger::initialize(bool autoConnect, bool autoReconnect)
return true;
}

int TSIExchanger::tGetCurrentTimePoint()
{
return tsiNetwIntFace->tGetCurrentTimePoint();
}

int TSIExchanger::tGetNrOfChannels()
{
return tsiNetwIntFace->tGetNrOfChannels();
}

QString TSIExchanger::tGetValuesFeedbackFolder()
{
return tsiNetwIntFace->tGetValuesFeedbackFolder();
}

QString TSIExchanger::tGetImagesFeedbackFolder()
{
return tsiNetwIntFace->tGetImagesFeedbackFolder();
}

int TSIExchanger::tGetNrOfSelectedChannels()
{
return tsiNetwIntFace->tGetNrOfSelectedChannels();
}

QList<int> TSIExchanger::tGetSelectedChannels()
{
return tsiNetwIntFace->tGetSelectedChannels();
}

float TSIExchanger::tGetRawDataScaleFactor()
{
return tsiNetwIntFace->tGetRawDataScaleFactor();
}

float TSIExchanger::tGetRawDataWL1(int channel, int timePoint)
{
return tsiNetwIntFace->tGetRawDataWL1(channel, timePoint);
}

float TSIExchanger::tGetRawDataWL2(int channel, int timePoint)
{
return tsiNetwIntFace->tGetRawDataWL2(channel, timePoint);
}

int TSIExchanger::tIsDataOxyDeoxyConverted()
{
return tsiNetwIntFace->tIsDataOxyDeoxyConverted();
}

float TSIExchanger::tGetOxyDataScaleFactor()
{
return tsiNetwIntFace->tGetOxyDataScaleFactor();
}

float TSIExchanger::tGetDataOxy(int channel, int timePoint)
{
return tsiNetwIntFace->tGetDataOxy(channel, timePoint);
}

float TSIExchanger::tGetDataDeoxy(int channel, int timePoint)
{
return tsiNetwIntFace->tGetDataDeoxy(channel, timePoint);
}

bool TSIExchanger::connectToServer(QString sIPAddress, int port)
{
return tsiNetwIntFace->connectToServer(sIPAddress.toLatin1().data(), (quint16)port);
}

bool TSIExchanger::disconnectFromServer()
{
return tsiNetwIntFace->disconnectFromServer();
}

bool TSIExchanger::activateAutoConnection()
{
return tsiNetwIntFace->setAutoConnection(true);
Expand Down
60 changes: 39 additions & 21 deletions TSIExchanger.h
Expand Up @@ -17,8 +17,8 @@

//This file defines the script binding interface, all below function are scriptable except for the destructor

#ifndef TSIExchanger_H
#define TSIExchanger_H
#ifndef TSIEXCHANGER_H
#define TSIEXCHANGER_H
#include <QObject>
#include <QString>
#include <QtScript>
Expand All @@ -31,7 +31,7 @@ inline unsigned arraysize(const T (&v)[S]) { return S; }

//! The TSIExchanger class.
/*!
The TSIExchanger can be used to communicate with the Turbo-BrainVoyager software (3.2) from Brain Innovation (see http://www.brainvoyager.com/downloads/install_turbobrainvoyager.html).
The TSIExchanger can be used to communicate with the Turbo-Satori software from Brain Innovation (see http://www.brainvoyager.com/products/turbosatori.html).
*/
class TSIExchanger : public QObject, protected QScriptable
{
Expand Down Expand Up @@ -70,89 +70,106 @@ class TSIExchanger : public QObject, protected QScriptable
~TSIExchanger();
TSIExchanger(const TSIExchanger& other ){Q_UNUSED(other);}//TODO fill in copy constructor, should be used for the Q_DECLARE_METATYPE macro

static QScriptValue ctor__extensionname(QScriptContext* context, QScriptEngine* engine);
static QScriptValue ctor_TSIExchanger(QScriptContext* context, QScriptEngine* engine);

public slots:
bool makeThisAvailableInScript(QString strObjectScriptName = "", QObject *engine = NULL);//To make the objects (e.g. defined in a *.exml file) available in the script

//Basic Project Functions
//Basic Project Functions
/** @name Basic Project Functions
@anchor BasicProjectFunctions
*/
//@{
//! tGetCurrentTimePoint slot.
/*!
Provides the number of the currently processed step during real-time processing as an integer. Note that this function is 1-based, i.e. when the first step is processed the function returns "1" not "0"; this is important when the return value is used to access time-related information; in this case subtract "1" from the returned value.
*/
int tGetCurrentTimePoint() {return tsiNetwIntFace->tGetCurrentTimePoint();};
int tGetCurrentTimePoint();
//! tGetNrOfChannels slot.
/*!
Provides the number of time points as an integer. The name contains the term "expected" since a real-time run might be interrupted by the user, i.e. this is the intended number of volumes as specified in the TSI settings file.
*/
int tGetNrOfChannels() {return tsiNetwIntFace->tGetNrOfChannels();};
int tGetNrOfChannels();
//! tGetValuesFeedbackFolder slot.
/*!
Provides the dimensions of the functional volumes; "dim_x" and "dim_y" are the dimensions of the slices constituting the volume and "dim_z" corresponds to the number of slices.
*/
QString tGetValuesFeedbackFolder() {return tsiNetwIntFace->tGetValuesFeedbackFolder();};
QString tGetValuesFeedbackFolder();
//! tGetImagesFeedbackFolder slot.
/*!
Provides the name of the project as specified in the TSI file as a C string; note that the received data must point to a pre-allocated array that is large enough (a buffer of 100 bytes should be sufficient). The returned name can, for example, be used as part of names identifying exported data (see example "Export Volume Data" client).
*/
QString tGetImagesFeedbackFolder() {return tsiNetwIntFace->tGetImagesFeedbackFolder();};
QString tGetImagesFeedbackFolder();
//! tGetNrOfSelectedChannels slot.
/*!
Provides the path of the "watch folder" as specified in the TSI file as a C string; Note that the received data must point to a pre-allocated array that is large enough for the returned path (a buffer of 513 bytes is recommended).
*/
int tGetNrOfSelectedChannels() {return tsiNetwIntFace->tGetNrOfSelectedChannels();};
int tGetNrOfSelectedChannels();
//@}

//Selected Channels Info Functions
/** @name Selected Channels Info Functions
@anchor SelectedChannelsInfoFunctions
*/
//@{
//! tGetSelectedChannels slot.
/*!
Provides the path of the "target folder" as specified in the TSI file as a C string; note that the received data must point to a pre-allocated array that is large enough for the returned path (a buffer of 513 bytes is recommended). The target folder can be used to export data for custom processing (see example "Export Volume Data" client).
*/
QList<int> tGetSelectedChannels() {return tsiNetwIntFace->tGetSelectedChannels();};
QList<int> tGetSelectedChannels();
//! tGetRawDataScaleFactor slot.
/*!
Provides the path of the "feedback folder" as specified in the TSI file as a C string; note that the provided data must point to a pre-allocated array that is large enough for the received path (a buffer of 513 bytes is recommended). The feedback folder can be used to store the result of custom calculations, e.g. providing custom input for the "Presenter" software tool.
*/
float tGetRawDataScaleFactor() {return tsiNetwIntFace->tGetRawDataScaleFactor();};
float tGetRawDataScaleFactor();
//! tGetRawDataWL1 slot.
/*!
Provides the index of the currently "active" condition of the protocol (0-based), i.e. the condition that has a defined interval enclosing the current time point.
*/
float tGetRawDataWL1(int channel, int timePoint) {return tsiNetwIntFace->tGetRawDataWL1(channel, timePoint);};
float tGetRawDataWL1(int channel, int timePoint);
//! tGetRawDataWL2 slot.
/*!
Provides the number of predictors of the design matrix. Note that this query returns the "full" number of intended predictors while the "tGetCurrentNrOfPredictors" returns the number of predictors currently in use.
*/
float tGetRawDataWL2(int channel, int timePoint) {return tsiNetwIntFace->tGetRawDataWL2(channel, timePoint);};
float tGetRawDataWL2(int channel, int timePoint);
//! tIsDataOxyDeoxyConverted slot.
/*!
Provides the currently effective number of predictors. Note that this query may return a smaller number than the "tGetFullNrOfPredictors" query since the internal GLM calculations use a restricted set of predictors in case that for one or more predictors not enough non-zero data points are available. Roughly speaking, the number of current predictors increases each time when a new condition is encountered during real-time processing.
*/
int tIsDataOxyDeoxyConverted() {return tsiNetwIntFace->tIsDataOxyDeoxyConverted();};
int tIsDataOxyDeoxyConverted();
//! tGetOxyDataScaleFactor slot.
/*!
Provides the full number of confound predictors. To get the full/effective number of predictors-of-interest, subtract the returned value from the "tGetFullNrOfPredictors" or "tGetCurrentNrOfPredictors" function, respectively.
*/
float tGetOxyDataScaleFactor() {return tsiNetwIntFace->tGetOxyDataScaleFactor();};
float tGetOxyDataScaleFactor();
//! tGetDataOxy slot.
/*!
Provides the value of a predictor at a given time point of the current design matrix. Note that the design matrix always contains the "full" set of predictors, a reduced set of predictors is only used internally (predictors that are not used internally are those containing only "0.0" entries up to the current time point). Note that the "timepoint" parameter must be smaller than the value returned by the "tGetCurrentTimePoint" query. For details, see the provided example clients.
*/
float tGetDataOxy(int channel, int timePoint) {return tsiNetwIntFace->tGetDataOxy(channel, timePoint);};
float tGetDataOxy(int channel, int timePoint);
//! tGetDataDeoxy slot.
/*!
Provides the number of (automatically or manually) specified contrasts in the TSI settings file. This value is important for accessing t maps, see the "tGetMapValueOfVoxel" and "tGetContrastMaps" queries.
*/
float tGetDataDeoxy(int channel, int timePoint) {return tsiNetwIntFace->tGetDataDeoxy(channel, timePoint);};
float tGetDataDeoxy(int channel, int timePoint);
//@}

//Connection Functions
/** @name Connection Functions
@anchor ConnectionFunctions
*/
//@{
//Connection functions
//! connectToServer slot.
/*!
Connect to the server using ip and port.
*/
bool connectToServer(QString sIPAddress,int port) {return tsiNetwIntFace->connectToServer(sIPAddress.toLatin1().data(),(quint16)port);};
bool connectToServer(QString sIPAddress, int port);
//! disconnectFromServer slot.
/*!
Disconnect from the server.
*/
bool disconnectFromServer() {return tsiNetwIntFace->disconnectFromServer();};
bool disconnectFromServer();
//! activateAutoConnection slot.
/*!
Activates the automatic connect functionality to connect to a TSI server if available and accessible.
Expand All @@ -173,6 +190,7 @@ public slots:
Deactivates the automatic Reconnect functionality.
*/
bool deactivateAutoReconnect();
//@}

private:
bool initialize(bool autoConnect, bool autoReconnect);
Expand All @@ -182,4 +200,4 @@ public slots:
TSINetworkInterface *tsiNetwIntFace;
};

#endif // TSIExchanger_H
#endif // TSIEXCHANGER_H
22 changes: 0 additions & 22 deletions TSIExchanger_dialog.cpp
Expand Up @@ -22,28 +22,6 @@ TSIExchanger_Dialog::TSIExchanger_Dialog(QWidget *parent) : QDialog(parent)
{
//Gets constructed only once during the load of the plugin
ui.setupUi(this);

QFile *fDoc = new QFile(":/dataTSI/html/NetworkPlugin_guide_v100.htm");
QString html;
if (fDoc->exists())
{
if (fDoc->open(QIODevice::ReadOnly))
{
html = fDoc->readAll();
fDoc->close();
}
}
doc = new QTextDocument();
doc->setHtml(html);
doc->addResource(QTextDocument::ImageResource, QUrl("NetworkPlugin_guide_files/image001.png"), QPixmap(":/dataTSI/html/NetworkPlugin_guide_files/image001.png"));
doc->addResource(QTextDocument::ImageResource, QUrl("NetworkPlugin_guide_files/image002.png"), QPixmap(":/dataTSI/html/NetworkPlugin_guide_files/image002.png"));
doc->addResource(QTextDocument::ImageResource, QUrl("NetworkPlugin_guide_files/image003.png"), QPixmap(":/dataTSI/html/NetworkPlugin_guide_files/image003.png"));
doc->addResource(QTextDocument::ImageResource, QUrl("NetworkPlugin_guide_files/image004.png"), QPixmap(":/dataTSI/html/NetworkPlugin_guide_files/image004.png"));
doc->addResource(QTextDocument::ImageResource, QUrl("NetworkPlugin_guide_files/image005.png"), QPixmap(":/dataTSI/html/NetworkPlugin_guide_files/image005.png"));
doc->addResource(QTextDocument::ImageResource, QUrl("NetworkPlugin_guide_files/image006.png"), QPixmap(":/dataTSI/html/NetworkPlugin_guide_files/image006.png"));
doc->addResource(QTextDocument::ImageResource, QUrl("NetworkPlugin_guide_files/image007.png"), QPixmap(":/dataTSI/html/NetworkPlugin_guide_files/image007.png"));
doc->addResource(QTextDocument::ImageResource, QUrl("NetworkPlugin_guide_files/image008.png"), QPixmap(":/dataTSI/html/NetworkPlugin_guide_files/image008.png"));
ui.textBrowser->setDocument(doc);
}

TSIExchanger_Dialog::~TSIExchanger_Dialog()
Expand Down
14 changes: 1 addition & 13 deletions TSIExchanger_dialog.ui
Expand Up @@ -14,7 +14,7 @@
<string>TSIExchanger_Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<item row="0" column="0">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
Expand Down Expand Up @@ -60,18 +60,6 @@
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QTextBrowser" name="textBrowser">
<property name="html">
<string notr="true"></string>
</property>
<property name="source">
<url>
<string></string>
</url>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
Expand Down
2 changes: 1 addition & 1 deletion TSIExchangerplugin.cpp
Expand Up @@ -42,7 +42,7 @@ int TSIExchangerPlugin::ConfigureScriptEngine(QScriptEngine &engine)
{
QScriptValue TSIExchangerProto = engine.newQObject(TSIExchangerObject);
engine.setDefaultPrototype(qMetaTypeId<TSIExchanger*>(), TSIExchangerProto);
QScriptValue TSIExchangerCtor = engine.newFunction(TSIExchanger::ctor__extensionname, TSIExchangerProto);
QScriptValue TSIExchangerCtor = engine.newFunction(TSIExchanger::ctor_TSIExchanger, TSIExchangerProto);
engine.globalObject().setProperty(PLUGIN_SCRIPTOBJECT_NAME, TSIExchangerCtor);
int nMetaType = qRegisterMetaType<TSIExchanger>(PLUGIN_SCRIPTOBJECT_NAME);
//FinalizeScriptObjectScriptContext(engine, TSIExchangerObject);
Expand Down
1 change: 1 addition & 0 deletions TSIExchangerplugin.h
Expand Up @@ -53,6 +53,7 @@ class TSIExchangerPlugin : public QObject, ExtensionInterface
TSIExchanger_Dialog *TSIExchangerDiagObject;

public slots:
bool HasGUI() { return false; };
bool ShowGUI();
bool IsCompatible() {return PluginInterface::IsCompatible();};// ExtensionInterface PluginInterface::IsCompatible();};
//QStringList GetAdditionalFileExtensions() {return (QStringList() << "TSIExchanger files (*.TSIExchanger);;");};
Expand Down

0 comments on commit e164334

Please sign in to comment.