Skip to content

Commit

Permalink
Add disp params, remove scan plugin from loading, add libs to static …
Browse files Browse the repository at this point in the history
…build
  • Loading branch information
gabrielbmotta committed May 10, 2021
1 parent dfb76b2 commit e58927c
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 51 deletions.
1 change: 1 addition & 0 deletions applications/mne_analyze/mne_analyze/mne_analyze.pro
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ contains(MNECPP_CONFIG, static) {
-lcontrolmanager \
-lchannelselection \
-lcoregistration \
-ltimefrequency \

# Add Qt3D/Disp3D based plugins only if not building against WASM, which does not support Qt3D
!contains(DEFINES, WASMBUILD) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
*
*/

#ifndef TIMEFREQUENCY_H
#define TIMEFREQUENCY_H
#ifndef TIMEFREQUENCY_AN_PLUGIN_H
#define TIMEFREQUENCY_AN_PLUGIN_H

//=============================================================================================================
// INCLUDES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ LIBS += -L$${MNE_LIBRARY_DIR}
CONFIG(debug, debug|release) {
LIBS += -lanSharedd \
-lmnecppDispd \
-lmnecppEventsd \
-lmnecppConnectivityd \
-lmnecppRtProcessingd \
-lmnecppInversed \
Expand All @@ -75,6 +76,7 @@ CONFIG(debug, debug|release) {
} else {
LIBS += -lanShared \
-lmnecppDisp \
-lmnecppEvents \
-lmnecppConnectivity \
-lmnecppRtProcessing \
-lmnecppInverse \
Expand Down
2 changes: 1 addition & 1 deletion applications/mne_scan/plugins/plugins.pro
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ SUBDIRS += \
writetofile \
hpi \
rtfwd \
timefrequency \
#timefrequency \
109 changes: 61 additions & 48 deletions libraries/disp/viewers/timefrequencyview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void TimeFrequencyView::initQMLView()

void TimeFrequencyView::paintEvent(QPaintEvent *event)
{
if (m_pEvokedSetModel){
// if (m_pEvokedSetModel){
QPainter painter(this);

painter.save();
Expand All @@ -170,68 +170,81 @@ void TimeFrequencyView::paintEvent(QPaintEvent *event)

//paint gradient bar

painter.save();
painter.setPen(QPen(Qt::black, 1, Qt::SolidLine));
QRect gradientBar(chartBound.topRight().x() + m_iChartBorderSpacing, chartBound.topRight().y(), m_iChartBorderSpacing, chartBound.height());
painter.drawRect(gradientBar);
painter.restore();
// painter.save();
// painter.setPen(QPen(Qt::black, 1, Qt::SolidLine));
// QRect gradientBar(chartBound.topRight().x() + m_iChartBorderSpacing, chartBound.topRight().y(), m_iChartBorderSpacing, chartBound.height());
// painter.drawRect(gradientBar);
// painter.restore();

// painter.save();
// painter.drawPixmap(gradientBar, m_CoefficientPixmap);
// painter.restore();

painter.save();
painter.drawPixmap(gradientBar, m_CoefficientPixmap);

painter.drawPixmap(chartBound.topRight().x() + m_iChartBorderSpacing, chartBound.topRight().y(), m_iChartBorderSpacing, chartBound.height(), m_CoefficientPixmap);

painter.restore();

//paint axis labels
//test
if(m_pEvokedSetModel->getNumSamples() > 0) {
painter.save();
painter.setPen(QPen(Qt::red, 1, Qt::DashLine));
// QLinearGradient linGrad(this->width() - m_iChartBorderSpacing * 1.5f, chartBound.topRight().y(), this->width() - m_iChartBorderSpacing * 1.5f, chartBound.bottomRight().y());
// painter.save();
// painter.setBrush(linGrad);
// painter.drawRect(chartBound.topRight().x() + m_iChartBorderSpacing, chartBound.topRight().y(), m_iChartBorderSpacing, chartBound.height());

float fDx = (float)(chartBound.width()) / ((float)m_pEvokedSetModel->getNumSamples());
float posX = fDx * ((float)m_pEvokedSetModel->getNumPreStimSamples());
painter.drawLine(chartBound.bottomLeft().x()+posX, chartBound.bottomRight().y(), chartBound.bottomLeft().x() + posX, chartBound.topRight().y());

painter.drawText(QPointF(posX+chartBound.bottomLeft().x(),chartBound.bottomRight().y()-5), QString("0ms / Stimulus"));

painter.restore();
// //paint axis labels
// //test
// if(m_pEvokedSetModel->getNumSamples() > 0) {
// painter.save();
// painter.setPen(QPen(Qt::red, 1, Qt::DashLine));

painter.save();
QColor colorTimeSpacer = Qt::black;
colorTimeSpacer.setAlphaF(0.5);
painter.setPen(QPen(colorTimeSpacer, 1, Qt::DashLine));
// float fDx = (float)(chartBound.width()) / ((float)m_pEvokedSetModel->getNumSamples());
// float posX = fDx * ((float)m_pEvokedSetModel->getNumPreStimSamples());
// painter.drawLine(chartBound.bottomLeft().x()+posX, chartBound.bottomRight().y(), chartBound.bottomLeft().x() + posX, chartBound.topRight().y());

float yStart = chartBound.topLeft().y();
float yEnd = chartBound.bottomRight().y();
// painter.drawText(QPointF(posX+chartBound.bottomLeft().x(),chartBound.bottomRight().y()-5), QString("0ms / Stimulus"));

float sampleCounter = m_pEvokedSetModel->getNumPreStimSamples();
int counter = 1;
float timeDistanceMSec = 50.0;
float timeDistanceSamples = (timeDistanceMSec/1000.0)*m_pEvokedSetModel->getSamplingFrequency(); //time distance corresponding to sampling frequency
// painter.restore();

//spacers before stim
while(sampleCounter-timeDistanceSamples>0) {
sampleCounter-=timeDistanceSamples;
float x = chartBound.bottomLeft().x() + fDx*sampleCounter;
painter.drawLine(x, yStart, x, yEnd);
painter.drawText(QPointF(x - m_iChartBorderSpacing/3, yEnd + m_iChartBorderSpacing/2), QString("-%1ms").arg(timeDistanceMSec*counter));
counter++;
}
// painter.save();
// QColor colorTimeSpacer = Qt::black;
// colorTimeSpacer.setAlphaF(0.5);
// painter.setPen(QPen(colorTimeSpacer, 1, Qt::DashLine));

//spacers after stim
counter = 1;
sampleCounter = m_pEvokedSetModel->getNumPreStimSamples();
while(sampleCounter+timeDistanceSamples<m_pEvokedSetModel->getNumSamples()) {
sampleCounter+=timeDistanceSamples;
float x = chartBound.bottomLeft().x() + fDx*sampleCounter;
painter.drawLine(x, yStart, x, yEnd);
painter.drawText(QPointF(x - m_iChartBorderSpacing/3, yEnd + m_iChartBorderSpacing/2), QString("%1ms").arg(timeDistanceMSec*counter));
counter++;
}
// float yStart = chartBound.topLeft().y();
// float yEnd = chartBound.bottomRight().y();

painter.restore();
// float sampleCounter = m_pEvokedSetModel->getNumPreStimSamples();
// int counter = 1;
// float timeDistanceMSec = 50.0;
// float timeDistanceSamples = (timeDistanceMSec/1000.0)*m_pEvokedSetModel->getSamplingFrequency(); //time distance corresponding to sampling frequency

}
// //spacers before stim
// while(sampleCounter-timeDistanceSamples>0) {
// sampleCounter-=timeDistanceSamples;
// float x = chartBound.bottomLeft().x() + fDx*sampleCounter;
// painter.drawLine(x, yStart, x, yEnd);
// painter.drawText(QPointF(x - m_iChartBorderSpacing/3, yEnd + m_iChartBorderSpacing/2), QString("-%1ms").arg(timeDistanceMSec*counter));
// counter++;
// }

}
// //spacers after stim
// counter = 1;
// sampleCounter = m_pEvokedSetModel->getNumPreStimSamples();
// while(sampleCounter+timeDistanceSamples<m_pEvokedSetModel->getNumSamples()) {
// sampleCounter+=timeDistanceSamples;
// float x = chartBound.bottomLeft().x() + fDx*sampleCounter;
// painter.drawLine(x, yStart, x, yEnd);
// painter.drawText(QPointF(x - m_iChartBorderSpacing/3, yEnd + m_iChartBorderSpacing/2), QString("%1ms").arg(timeDistanceMSec*counter));
// counter++;
// }

// painter.restore();

// }

// }

return QWidget::paintEvent(event);
}
Expand Down

0 comments on commit e58927c

Please sign in to comment.