v2.0.0
Loading...
Searching...
No Matches
DISPLIB::RtFiffRawViewModel Class Reference

Circular-buffer QAbstractTableModel feeding the real-time FIFF raw browser. More...

#include <rtfiffrawviewmodel.h>

Public Types

typedef QSharedPointer< RtFiffRawViewModel > SPtr
typedef QSharedPointer< const RtFiffRawViewModel > ConstSPtr

Signals

void newSelection (const QList< qint32 > &selection)
void windowSizeChanged (int windowSize)
void triggerDetected (int numberDetectedTriggers, const QMap< int, QList< QPair< int, double > > > &mapDetectedTriggers)

Public Member Functions

 RtFiffRawViewModel (QObject *parent=0)
 ~RtFiffRawViewModel ()
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
void setFiffInfo (QSharedPointer< FIFFLIB::FiffInfo > &p_pFiffInfo)
void setSamplingInfo (float sps, int T, bool bSetZero=false)
Eigen::MatrixXd getLastBlock ()
void addData (const QList< Eigen::MatrixXd > &data)
FIFFLIB::fiff_int_t getKind (qint32 row) const
FIFFLIB::fiff_int_t getUnit (qint32 row) const
FIFFLIB::fiff_int_t getCoil (qint32 row) const
qint32 getMaxSamples () const
qint32 getCurrentSampleIndex () const
double getLastBlockFirstValue (int row) const
const QMap< qint32, qint32 > & getIdxSelMap () const
void selectRows (const QList< qint32 > &selection)
void hideRows (const QList< qint32 > &selection)
void resetSelection ()
void toggleFreeze (const QModelIndex &index)
void setScaling (const QMap< qint32, float > &p_qMapChScaling)
void updateProjection (const QList< FIFFLIB::FiffProj > &projs)
void updateCompensator (int to)
void updateSpharaActivation (bool state)
void updateSpharaOptions (const QString &sSytemType, int nBaseFctsFirst, int nBaseFctsSecond)
void setFilter (QList< UTILSLIB::FilterKernel > filterData)
void setFilterActive (bool state)
void setBackgroundColor (const QColor &color)
void setFilterChannelType (const QString &channelType)
void markChBad (QModelIndex ch, bool status)
void markChBad (QModelIndexList chlist, bool status)
void triggerInfoChanged (const QMap< double, QColor > &colorMap, bool active, QString triggerCh, double threshold)
void distanceTimeSpacerChanged (int value)
void resetTriggerCounter ()
qint32 numVLines () const
bool isFreezed () const
const QMap< qint32, float > & getScaling () const
QList< QPair< int, double > > getDetectedTriggers () const
QList< QPair< int, double > > getDetectedTriggersOld () const
QMap< double, QColor > getTriggerColor () const
int getNumberOfTimeSpacers () const
double getTriggerThreshold () const
QString getTriggerName () const
int getCurrentTriggerIndex () const
bool triggerDetectionActive () const
int getCurrentOverlapAddDelay () const
int getFirstSampleOffset () const
int getSampleAtColumn (int iColumn) const
double getValueAtColumn (int iRow, int iColumn) const
double getMaxValueFromRawViewModel (int row) const
void addEvent (int iSample)
std::vector< int > getEventsToDisplay (int iBegin, int iEnd) const
void setEventCallbacks (std::function< void(int)> addFn, std::function< std::vector< int >(int, int)> getFn)

Detailed Description

Circular-buffer QAbstractTableModel feeding the real-time FIFF raw browser.

Keeps the last few seconds of streaming FIFF data in a per-channel ring buffer and forwards bad-channel flips, trigger detections and annotation edits back to the underlying FiffInfo / event list.

Definition at line 92 of file rtfiffrawviewmodel.h.

Inheritance diagram for DISPLIB::RtFiffRawViewModel:
Inheritance graph

Member Typedef Documentation

◆ ConstSPtr

Const shared pointer type for RtFiffRawViewModel.

Definition at line 98 of file rtfiffrawviewmodel.h.

◆ SPtr

Shared pointer type for RtFiffRawViewModel.

Definition at line 97 of file rtfiffrawviewmodel.h.

Constructor & Destructor Documentation

◆ RtFiffRawViewModel()

RtFiffRawViewModel::RtFiffRawViewModel ( QObject * parent = 0)

Constructs an real-time multi sample array table model for the given parent.

Parameters
[in]parentparent of the table model.

Definition at line 86 of file rtfiffrawviewmodel.cpp.

◆ ~RtFiffRawViewModel()

RtFiffRawViewModel::~RtFiffRawViewModel ( )

Destructs RtFiffRawViewModel and stops the use of Shared Memory within the Event Manager.

Definition at line 116 of file rtfiffrawviewmodel.cpp.

Member Function Documentation

◆ addData()

void RtFiffRawViewModel::addData ( const QList< Eigen::MatrixXd > & data)

Adds multiple time points (QVector) for a channel set (VectorXd)

Parameters
[in]datadata to add (Time points of channel samples).

Definition at line 404 of file rtfiffrawviewmodel.cpp.

◆ addEvent()

void RtFiffRawViewModel::addEvent ( int iSample)

Adds event based on input parameters

Parameters
[in]iSampleSample of the new event.

Definition at line 1043 of file rtfiffrawviewmodel.cpp.

◆ columnCount()

int RtFiffRawViewModel::columnCount ( const QModelIndex & parent = QModelIndex()) const
virtual

Returns the number of columns for the children of the given parent.

Parameters
[in]parentnot used.
Returns
number of columns.

Definition at line 133 of file rtfiffrawviewmodel.cpp.

◆ data()

QVariant RtFiffRawViewModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
virtual

Returns the data stored under the given role for the item referred to by the index.

Parameters
[in]indexdetermines item location.
[in]rolerole to return.
Returns
accessed data.

Definition at line 140 of file rtfiffrawviewmodel.cpp.

◆ distanceTimeSpacerChanged()

void RtFiffRawViewModel::distanceTimeSpacerChanged ( int value)

distanceTimeSpacerChanged changes the distance of the time spacers

Parameters
[in]valuethe new distance for the time spacers.

Definition at line 847 of file rtfiffrawviewmodel.cpp.

◆ getCoil()

fiff_int_t RtFiffRawViewModel::getCoil ( qint32 row) const

Returns the coil type of a given channel number

Parameters
[in]rowrow number which correspodns to a given channel.
Returns
coil type of given channel number.

Definition at line 547 of file rtfiffrawviewmodel.cpp.

◆ getCurrentOverlapAddDelay()

int DISPLIB::RtFiffRawViewModel::getCurrentOverlapAddDelay ( ) const
inline

Returns the current overlap add delay

Returns
the current overlap add delay.

Definition at line 837 of file rtfiffrawviewmodel.h.

◆ getCurrentSampleIndex()

qint32 DISPLIB::RtFiffRawViewModel::getCurrentSampleIndex ( ) const
inline

Returns the current sample index which represents the index which the next incoming data will be stored at in the data

Returns
the current sample index.

Definition at line 703 of file rtfiffrawviewmodel.h.

◆ getCurrentTriggerIndex()

int DISPLIB::RtFiffRawViewModel::getCurrentTriggerIndex ( ) const
inline

Returns the current trigger channel index

Returns
the current trigger channel index.

Definition at line 823 of file rtfiffrawviewmodel.h.

◆ getDetectedTriggers()

QList< QPair< int, double > > DISPLIB::RtFiffRawViewModel::getDetectedTriggers ( ) const
inline

Returns current detected trigger flanks

Returns
the current detected trigger flanks.

Definition at line 771 of file rtfiffrawviewmodel.h.

◆ getDetectedTriggersOld()

QList< QPair< int, double > > DISPLIB::RtFiffRawViewModel::getDetectedTriggersOld ( ) const
inline

Returns old detected trigger flanks

Returns
the old detected trigger flanks.

Definition at line 786 of file rtfiffrawviewmodel.h.

◆ getEventsToDisplay()

std::vector< int > RtFiffRawViewModel::getEventsToDisplay ( int iBegin,
int iEnd ) const

Returns event sample positions between two samples.

Parameters
[in]iBeginLower bound for sample (inclusive).
[in]iEndUpper bound for sample (exclusive).
Returns
Vector of event sample positions.

Definition at line 1079 of file rtfiffrawviewmodel.cpp.

◆ getFirstSampleOffset()

int DISPLIB::RtFiffRawViewModel::getFirstSampleOffset ( ) const
inline

Get offset of first drawn sample in the window

Returns
sample offset of window

Definition at line 847 of file rtfiffrawviewmodel.h.

◆ getIdxSelMap()

const QMap< qint32, qint32 > & DISPLIB::RtFiffRawViewModel::getIdxSelMap ( ) const
inline

Returns a map which conatins the channel idx and its corresponding selection status

Returns
the channel idx to selection status.

Definition at line 731 of file rtfiffrawviewmodel.h.

◆ getKind()

fiff_int_t RtFiffRawViewModel::getKind ( qint32 row) const

Returns the kind of a given channel number

Parameters
[in]rowrow number which correspodns to a given channel.
Returns
kind of given channel number.

Definition at line 523 of file rtfiffrawviewmodel.cpp.

◆ getLastBlock()

MatrixXd RtFiffRawViewModel::getLastBlock ( )

Returns the last received data block.

Returns
the last data block.

Definition at line 388 of file rtfiffrawviewmodel.cpp.

◆ getLastBlockFirstValue()

double DISPLIB::RtFiffRawViewModel::getLastBlockFirstValue ( int row) const
inline

Returns the first value of the last complete data display block

Parameters
[in]rowrow for which the first value is to be returned.
Returns
the first value of the last complete data display block.

Definition at line 718 of file rtfiffrawviewmodel.h.

◆ getMaxSamples()

qint32 DISPLIB::RtFiffRawViewModel::getMaxSamples ( ) const
inline

Returns the maximal number of samples of the downsampled data to display

Returns
the maximal number of samples.

Definition at line 696 of file rtfiffrawviewmodel.h.

◆ getMaxValueFromRawViewModel()

double RtFiffRawViewModel::getMaxValueFromRawViewModel ( int row) const

Get maximum range of respective channel type. range value in FiffChInfo does not seem to contain a reasonable value

Parameters
[in]rowRow of the model.
Returns
the max value of the y axis for the channel

Definition at line 981 of file rtfiffrawviewmodel.cpp.

◆ getNumberOfTimeSpacers()

int DISPLIB::RtFiffRawViewModel::getNumberOfTimeSpacers ( ) const
inline

Returns the current number for the time spacers

Returns
the current number for the time spacers.

Definition at line 801 of file rtfiffrawviewmodel.h.

◆ getSampleAtColumn()

int RtFiffRawViewModel::getSampleAtColumn ( int iColumn) const

Maps a displayed buffer column to the sample it shows.

Parameters
[in]iColumnBuffer column, 0 .. getMaxSamples() - 1.
Returns
The sample index since the start of the stream, or -1 if the column holds no data yet.

Definition at line 1052 of file rtfiffrawviewmodel.cpp.

◆ getScaling()

const QMap< qint32, float > & DISPLIB::RtFiffRawViewModel::getScaling ( ) const
inline

Returns current scaling

Returns
the current scaling.

Definition at line 752 of file rtfiffrawviewmodel.h.

◆ getTriggerColor()

QMap< double, QColor > DISPLIB::RtFiffRawViewModel::getTriggerColor ( ) const
inline

Returns current trigger color

Returns
the current trigger color map fpr each detected type.

Definition at line 759 of file rtfiffrawviewmodel.h.

◆ getTriggerName()

QString DISPLIB::RtFiffRawViewModel::getTriggerName ( ) const
inline

Returns the current trigger name

Returns
the current trigger name.

Definition at line 816 of file rtfiffrawviewmodel.h.

◆ getTriggerThreshold()

double DISPLIB::RtFiffRawViewModel::getTriggerThreshold ( ) const
inline

Returns the current trigger threshold

Returns
the current trigger threshold.

Definition at line 809 of file rtfiffrawviewmodel.h.

◆ getUnit()

fiff_int_t RtFiffRawViewModel::getUnit ( qint32 row) const

Returns the unit of a given channel number

Parameters
[in]rowrow number which correspodns to a given channel.
Returns
unit of given channel number.

Definition at line 535 of file rtfiffrawviewmodel.cpp.

◆ getValueAtColumn()

double RtFiffRawViewModel::getValueAtColumn ( int iRow,
int iColumn ) const

Returns the displayed value of a row at a buffer column, i.e. after projectors, compensators and filters.

Parameters
[in]iRowRow of the model.
[in]iColumnBuffer column, 0 .. getMaxSamples() - 1.
Returns
The value in SI units, 0 for an invalid row or column.

Definition at line 1067 of file rtfiffrawviewmodel.cpp.

◆ headerData()

QVariant RtFiffRawViewModel::headerData ( int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const
virtual

Returns the data for the given role and section in the header with the specified orientation.

Parameters
[in]sectionFor horizontal headers, the section number corresponds to the column number. Similarly, for vertical headers, the section number corresponds to the row number.
[in]orientationQt::Horizontal or Qt::Vertical.
[in]rolerole to show.
Returns
accessed eader data.

Definition at line 205 of file rtfiffrawviewmodel.cpp.

◆ hideRows()

void RtFiffRawViewModel::hideRows ( const QList< qint32 > & selection)

Hides the given list of channel

Parameters
[in]selectionchannel index list to select.

Definition at line 580 of file rtfiffrawviewmodel.cpp.

◆ isFreezed()

bool DISPLIB::RtFiffRawViewModel::isFreezed ( ) const
inline

Returns current freezing status

Returns
the current freezing status.

Definition at line 745 of file rtfiffrawviewmodel.h.

◆ markChBad() [1/2]

void RtFiffRawViewModel::markChBad ( QModelIndex ch,
bool status )

markChBad marks the selected channels as bad/good in m_chInfolist

Parameters
[in]chindex that is selected for marking.
[in]statusMark as bad when true, as good when false.

Definition at line 797 of file rtfiffrawviewmodel.cpp.

◆ markChBad() [2/2]

void RtFiffRawViewModel::markChBad ( QModelIndexList chlist,
bool status )

markChBad marks the selected channels as bad/good in m_chInfolist

Parameters
[in]chlistis the list of indices that are selected for marking.
[in]statusMark as bad when true, as good when false.

Definition at line 865 of file rtfiffrawviewmodel.cpp.

◆ newSelection

void DISPLIB::RtFiffRawViewModel::newSelection ( const QList< qint32 > & selection)
signal

Emmited when new selcetion was made

Parameters
[in]selectionlist of all selected channels.

◆ numVLines()

qint32 DISPLIB::RtFiffRawViewModel::numVLines ( ) const
inline

Returns the number of vertical lines (one per second)

Returns
number of vertical lines.

Definition at line 738 of file rtfiffrawviewmodel.h.

◆ resetSelection()

void RtFiffRawViewModel::resetSelection ( )

Resets the current selection (selects all channels)

Definition at line 597 of file rtfiffrawviewmodel.cpp.

◆ resetTriggerCounter()

void RtFiffRawViewModel::resetTriggerCounter ( )

resetTriggerCounter resets the trigger counter

Definition at line 858 of file rtfiffrawviewmodel.cpp.

◆ rowCount()

int RtFiffRawViewModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
virtual

Returns the number of rows under the given parent. When the parent is valid it means that rowCount is returning the number of children of parent.

Parameters
[in]parentnot used.
Returns
number of rows.

Definition at line 122 of file rtfiffrawviewmodel.cpp.

◆ selectRows()

void RtFiffRawViewModel::selectRows ( const QList< qint32 > & selection)

Selects the given list of channel indeces and unselect all other channels

Parameters
[in]selectionchannel index list to select.

Definition at line 559 of file rtfiffrawviewmodel.cpp.

◆ setBackgroundColor()

void RtFiffRawViewModel::setBackgroundColor ( const QColor & color)

Set the background color

Parameters
[in]colorThe background color.

Definition at line 773 of file rtfiffrawviewmodel.cpp.

◆ setEventCallbacks()

void RtFiffRawViewModel::setEventCallbacks ( std::function< void(int)> addFn,
std::function< std::vector< int >(int, int)> getFn )

Sets callbacks for adding and querying events.

Parameters
[in]addFnCallback invoked when an event is added.
[in]getFnCallback returning event sample positions in a range.

Definition at line 1089 of file rtfiffrawviewmodel.cpp.

◆ setFiffInfo()

void RtFiffRawViewModel::setFiffInfo ( QSharedPointer< FIFFLIB::FiffInfo > & p_pFiffInfo)

Sets corresponding fiff information

Parameters
[in]p_pFiffInfoThe corresponding fiff information.

Definition at line 300 of file rtfiffrawviewmodel.cpp.

◆ setFilter()

void RtFiffRawViewModel::setFilter ( QList< UTILSLIB::FilterKernel > filterData)

Set new filter parameters

Parameters
[in]filterDatalist of the new filter.

Definition at line 747 of file rtfiffrawviewmodel.cpp.

◆ setFilterActive()

void RtFiffRawViewModel::setFilterActive ( bool state)

Set filter activation

Parameters
[in]statefilter on/off flag.

Definition at line 766 of file rtfiffrawviewmodel.cpp.

◆ setFilterChannelType()

void RtFiffRawViewModel::setFilterChannelType ( const QString & channelType)

Sets the type of channel which are to be filtered

Parameters
[in]channelTypethe channel type which is to be filtered (EEG, MEG, All).

Definition at line 780 of file rtfiffrawviewmodel.cpp.

◆ setSamplingInfo()

void RtFiffRawViewModel::setSamplingInfo ( float sps,
int T,
bool bSetZero = false )

Sets the sampling information and calculates the resulting downsampling factor between actual sps and desired sps

Parameters
[in]spsSamples per second of incomming data.
[in]TTime window length to display.
[in]bSetZeroIf data should be set to zero. Default is false.

Definition at line 357 of file rtfiffrawviewmodel.cpp.

◆ setScaling()

void RtFiffRawViewModel::setScaling ( const QMap< qint32, float > & p_qMapChScaling)

Set scaling channel scaling

Parameters
[in]p_qMapChScalingMap of scaling factors.

Definition at line 636 of file rtfiffrawviewmodel.cpp.

◆ toggleFreeze()

void RtFiffRawViewModel::toggleFreeze ( const QModelIndex & index)

Toggle freeze for all channels when a channel is double clicked

Parameters
[in]indexof the channel which has been double clicked.

Definition at line 612 of file rtfiffrawviewmodel.cpp.

◆ triggerDetected

void DISPLIB::RtFiffRawViewModel::triggerDetected ( int numberDetectedTriggers,
const QMap< int, QList< QPair< int, double > > > & mapDetectedTriggers )
signal

Emmited when trigger detection was performed

◆ triggerDetectionActive()

bool DISPLIB::RtFiffRawViewModel::triggerDetectionActive ( ) const
inline

Returns whether trigger detection is active or not

Returns
whether trigger detection is active or not.

Definition at line 830 of file rtfiffrawviewmodel.h.

◆ triggerInfoChanged()

void RtFiffRawViewModel::triggerInfoChanged ( const QMap< double, QColor > & colorMap,
bool active,
QString triggerCh,
double threshold )

markChBad marks the selected channels as bad/good in m_chInfolist

Parameters
[in]colorMapcolor for each trigger channel.
[in]activereal time trigger detection active.
[in]triggerChcurrent trigger channel to scan.
[in]thresholdthreshold for the detection process.

Definition at line 820 of file rtfiffrawviewmodel.cpp.

◆ updateCompensator()

void RtFiffRawViewModel::updateCompensator ( int to)

Update the compensator

Parameters
[in]toCompensator to use in fiff constant format FiffCtfComp.kind (NOT FiffCtfComp.ctfkind).

Definition at line 678 of file rtfiffrawviewmodel.cpp.

◆ updateProjection()

void RtFiffRawViewModel::updateProjection ( const QList< FIFFLIB::FiffProj > & projs)

Update the SSP projection

Parameters
[in]projsThe new projectors.

Definition at line 645 of file rtfiffrawviewmodel.cpp.

◆ updateSpharaActivation()

void RtFiffRawViewModel::updateSpharaActivation ( bool state)

Update the SPHARA operator

Parameters
[in]stateThe current state of teh SPHARA tool.

Definition at line 709 of file rtfiffrawviewmodel.cpp.

◆ updateSpharaOptions()

void RtFiffRawViewModel::updateSpharaOptions ( const QString & sSytemType,
int nBaseFctsFirst,
int nBaseFctsSecond )

Update the SPHARA operator

Parameters
[in]sSytemTypeThe current acquisition system type (VectorView, BabyMEG, EEG).
[in]nBaseFctsFirstThe new number of basis function to use for the first SPHARA operator.
[in]nBaseFctsSecondThe new number of basis function to use for the second SPHARA operator.

Definition at line 716 of file rtfiffrawviewmodel.cpp.

◆ windowSizeChanged

void DISPLIB::RtFiffRawViewModel::windowSizeChanged ( int windowSize)
signal

Emmited when the window size/max number of samples changed

Parameters
[in]windowSizenumber of samples in the window.

The documentation for this class was generated from the following files: