31 #include "WEEGEvent.h"
32 #include "WEEGSourceCalculator.h"
33 #include "core/common/WAssert.h"
34 #include "core/common/math/linearAlgebra/WPosition.h"
35 #include "core/dataHandler/WEEG2.h"
36 #include "core/dataHandler/WEEGChannelInfo.h"
37 #include "core/dataHandler/exceptions/WDHException.h"
48 for( std::size_t channelID = 0; channelID <
m_eeg->getNumberOfChannels(); ++channelID )
52 m_eeg->getChannelInfo( channelID )->getPosition();
65 const std::vector< double >& values =
event->getValues();
66 WAssert( values.size() ==
m_hasPosition.size(),
"Event and loaded EEG dataset have to have the same number of channels" );
69 double min = std::numeric_limits< double >::infinity();
70 for( std::size_t channelID = 0; channelID < values.size(); ++channelID )
74 sum += values[channelID];
75 if( values[channelID] < min )
77 min = values[channelID];
85 for( std::size_t channelID = 0; channelID < values.size(); ++channelID )
89 source += ( values[channelID] - min ) / sum *
m_eeg->getChannelInfo( channelID )->getPosition();
General purpose exception and therefore base class for all DataHandler related exceptions.
const std::shared_ptr< const WEEG2 > m_eeg
pointer to the EEG dataset
std::vector< bool > m_hasPosition
vector which saves for each channel whether there exists a position in the EEG dataset or not
std::size_t m_numPositions
how many channels with positions exist in the EEG dataset
WEEGSourceCalculator(const std::shared_ptr< const WEEG2 > eeg)
Constructor.
WPosition calculate(const std::shared_ptr< const WEEGEvent > event) const
Does the calculation.
This only is a 3d double vector.