31 #include "WReaderEEGASCII.h"
32 #include "core/common/WAssert.h"
33 #include "core/common/WException.h"
34 #include "core/common/WStringUtils.h"
35 #include "core/dataHandler/WEEG.h"
36 #include "core/dataHandler/WSubject.h"
45 std::ifstream in(
m_fname.c_str() );
53 const unsigned int nbChannels = tokens.size() / 3;
54 WEEGChannelLabels labels( nbChannels );
55 for(
unsigned int i = 0; i < nbChannels; ++i )
57 labels[i].first = tokens[3*i] +
" " + tokens[3*i+1] +
" " + tokens[3*i+2];
61 WEEGSegmentArray segments( 1 );
63 for(
unsigned int i = 0; i < nbChannels; ++i )
65 segments[0].push_back( WEEGElectrode( 0 ) );
72 WAssert( tokens.size() == nbChannels,
"Error." );
73 for(
unsigned int i = 0; i < nbChannels; ++i )
75 segments[0][i].push_back( string_utils::fromString< double >( tokens[i].c_str() ) );
83 WEEGElectrodeLibrary lib;
85 std::shared_ptr< WEEG > eeg(
new WEEG( segments, lib, labels ) );
Contains EEG recording data.
WReaderEEGASCII(std::string fileName)
Constructs a loader to be executed in its own thread and sets the data needed for the loader when exe...
virtual std::shared_ptr< WDataSet > load()
Loads the dataset.
Abstract base class for all Readers who handle with EEG data.
std::string m_fname
Absolute path of the file to read from.
std::vector< std::string > tokenize(const std::string &source, const std::string &delim=WHITESPACE, bool compress=true)
Splits the given string into a vector of strings (so called tokens).