Commit 03e8b94f authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[MERGE]

parents 680e3d81 526a7e65
......@@ -36,8 +36,10 @@
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/ref_ptr>
#include <osgText/Text>
#include "core/common/exceptions/WOutOfBounds.h"
#include "core/common/WStringUtils.h"
#include "core/dataHandler/WEEG2.h"
#include "core/dataHandler/WEEG2Segment.h"
#include "core/dataHandler/WEEGValueMatrix.h"
......@@ -46,6 +48,7 @@
WEEGEvent::WEEGEvent( double time,
double yPos,
boost::shared_ptr< WEEG2 > eeg,
std::size_t segmentID,
osg::ref_ptr< WGEGroupNode > parentNode ) throw( WOutOfBounds )
......@@ -89,8 +92,23 @@ WEEGEvent::WEEGEvent( double time,
geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, 2 ) );
// create text for the time label
osgText::Text* text = new osgText::Text;
text->setText( string_utils::toString( time ).c_str() );
text->setPosition( osg::Vec3( time, yPos + 10.0, 0.0 ) );
text->setAlignment( osgText::Text::LEFT_CENTER );
text->setAxisAlignment( osgText::Text::SCREEN );
text->setCharacterSize( 12 );
text->setCharacterSizeMode( osgText::Text::SCREEN_COORDS );
text->setColor( osg::Vec4( 0.0, 0.0, 1.0, 1.0 ) );
text->setBackdropType( osgText::Text::OUTLINE );
text->setBackdropColor( osg::Vec4( 1.0, 1.0, 1.0, 1.0 ) );
text->setBackdropOffset( 0.1 );
osg::Geode* geode = new osg::Geode;
geode->addDrawable( geometry );
geode->addDrawable( text );
m_node = geode;
......
......@@ -49,11 +49,13 @@ public:
* Constructor
*
* \param time time position in seconds
* \param yPos y position in pixels
* \param eeg pointer to the loaded EEG dataset
* \param segmentID number of the segment
* \param parentNode node where m_node is inserted and removed from
*/
WEEGEvent( double time,
double yPos,
boost::shared_ptr< WEEG2 > eeg,
std::size_t segmentID,
osg::ref_ptr< WGEGroupNode > parentNode ) throw( WOutOfBounds );
......
......@@ -229,6 +229,7 @@ bool WEEGViewHandler::markEvent( float x )
{
boost::shared_ptr< WEEGEvent > event( new WEEGEvent(
m_timePos->get() + ( x - labelsWidth ) * m_timeRange->get() / m_graphWidth->get(),
m_yPos->get(),
m_eeg,
m_segmentID,
m_eventParentNode ) );
......
......@@ -122,7 +122,7 @@ void WMEEGView::properties()
m_propCondition );
m_proofOfConcept = m_properties->addProperty( "Enable POC",
"Use proof of concept (POC) ROI positioning instead of real dipoles position.",
true,
false,
m_propCondition );
m_butterfly = m_properties->addProperty( "Butterfly plot",
"Overlay all curves in one row.",
......@@ -302,10 +302,11 @@ void WMEEGView::moduleMain()
{
debugLog() << "New event position: " << event->getTime();
if( m_roi )
for( std::vector< osg::ref_ptr< WROIBox > >::iterator iter = m_rois.begin(); iter != m_rois.end(); ++iter)
{
WKernel::getRunningKernel()->getRoiManager()->removeRoi( m_roi );
WKernel::getRunningKernel()->getRoiManager()->removeRoi( *iter );
}
m_rois.clear();
if( m_sourceCalculator )
{
......@@ -313,19 +314,25 @@ void WMEEGView::moduleMain()
{
WPosition position = m_sourceCalculator->calculate( event );
float halfWidth = m_ROIsize->get( true ) * 0.5;
m_roi = new WROIBox( position - WVector3d( halfWidth, halfWidth, halfWidth ),
position + WVector3d( halfWidth, halfWidth, halfWidth ) );
WKernel::getRunningKernel()->getRoiManager()->addRoi( m_roi );
m_rois.push_back( new WROIBox( position - WVector3d( halfWidth, halfWidth, halfWidth ),
position + WVector3d( halfWidth, halfWidth, halfWidth ) ) );
WKernel::getRunningKernel()->getRoiManager()->addRoi( m_rois.back() );
}
else if( m_dipoles->getData() )
{
if( m_dipoles->getData()->getMagnitude( event->getTime() ) != 0 )
boost::shared_ptr< WDataSetDipoles > dipoles = m_dipoles->getData();
debugLog() << "Number of Dipoles: " << dipoles->getNumberOfDipoles();
for( size_t dipoleId = 0; dipoleId < dipoles->getNumberOfDipoles(); ++dipoleId )
{
float halfWidth = m_ROIsize->get( true ) * 0.5;
WPosition position = m_dipoles->getData()->getPosition();
m_roi = new WROIBox( position - WVector3d( halfWidth, halfWidth, halfWidth ),
position + WVector3d( halfWidth, halfWidth, halfWidth ) );
WKernel::getRunningKernel()->getRoiManager()->addRoi( m_roi );
debugLog() << "Dipole[" << dipoleId << "]: " << dipoles->getMagnitude( event->getTime(), dipoleId );
if( dipoles->getMagnitude( event->getTime(), dipoleId ) != 0 )
{
float halfWidth = m_ROIsize->get( true ) * 0.5;
WPosition position = dipoles->getPosition( dipoleId );
m_rois.push_back( new WROIBox( position - WVector3d( halfWidth, halfWidth, halfWidth ),
position + WVector3d( halfWidth, halfWidth, halfWidth ) ) );
WKernel::getRunningKernel()->getRoiManager()->addRoi( m_rois.back() );
}
}
}
else
......@@ -333,10 +340,6 @@ void WMEEGView::moduleMain()
debugLog() << "No dipoles found and not in POC mode: placing NO ROI.";
}
}
else
{
m_roi.release();
}
m_currentEventTime = event->getTime();
}
......
......@@ -26,6 +26,7 @@
#define WMEEGVIEW_H
#include <string>
#include <vector>
#include <osg/Texture1D>
#include <osgSim/ScalarsToColors>
......@@ -266,11 +267,11 @@ private:
osg::ref_ptr< osg::Node > m_labelsNode;
/**
* The ROI around the source dipole position at the time determined by
* The ROIs around the source dipole positions at the time determined by
* m_event.
* Used to select the fibers around this dipole.
* Used to select the fibers around this dipoles.
*/
osg::ref_ptr< WROIBox > m_roi;
std::vector< osg::ref_ptr< WROIBox > > m_rois;
/**
* Bool flag which gets set when the data was changed.
......
......@@ -218,7 +218,7 @@ boost::shared_ptr< WDataSetDipoles > WMReadDipoles::readFiles( std::vector< std:
for( size_t fileId = 1; fileId < filenames.size(); ++fileId )
{
readFile( filenames[fileId], &pos, &times, &magnitudes );
loadedData->addDipole( pos, times, magnitudes );
loadedData->addDipole( pos, magnitudes, times );
}
return loadedData;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment