OpenWalnut  1.5.0dev
WEEG.cpp
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #include <memory>
26 #include <string>
27 
28 #include "../common/WPrototyped.h"
29 #include "WEEG.h"
30 
31 // prototype instance as singleton
32 std::shared_ptr< WPrototyped > WEEG::m_prototype = std::shared_ptr< WPrototyped >();
33 
34 WEEG::WEEG( const WEEGSegmentArray& data,
35  const WEEGElectrodeLibrary& electrodeLib,
36  const WEEGChannelLabels& channelLabels )
37  : WRecording()
38 {
39  assert( data.size() <= WRecording::MAX_RECORDING_SEGMENTS );
40  assert( data.size() > 0 ); // ensure that ther is really data
41  for( WEEGSegmentArray::const_iterator it1 = data.begin(); it1 != data.end(); ++it1 )
42  {
43  assert( it1->size() <= WRecording::MAX_RECORDING_CHANNELS );
44  assert( it1->size() > 0 ); // ensure that ther is really data
45  for( WEEGSegment::const_iterator it2 = it1->begin(); it2 != it1->end(); ++it2 )
46  {
47  assert( it2->size() <= WRecording::MAX_RECORDING_SAMPLES );
48  assert( it2->size() > 0 ); // ensure that ther is really data
49  }
50  }
51  m_segments = data;
52  m_electrodeLibrary = electrodeLib;
53  m_channelLabels = channelLabels;
54 }
55 
57  : WRecording()
58 {
59  // do nothing here. Only useful for prototypes.
60 }
61 
62 bool WEEG::isTexture() const
63 {
64  return false;
65 }
66 
67 const std::string WEEG::getName() const
68 {
69  return "WEEG";
70 }
71 
72 const std::string WEEG::getDescription() const
73 {
74  return "Contains data acquired using EEG.";
75 }
76 
77 std::shared_ptr< WPrototyped > WEEG::getPrototype()
78 {
79  if( !m_prototype )
80  {
81  m_prototype = std::shared_ptr< WPrototyped >( new WEEG() );
82  }
83 
84  return m_prototype;
85 }
86 
87 
89  m_position( position )
90 {
91 }
92 
94 {
95  return m_position;
96 }
WPosition getPosition() const
Returns the position of the electrode.
Definition: WEEG.cpp:93
WPosition m_position
Position of the electrode in space.
Definition: WEEG.h:57
WEEGElectrodeObject(WPosition position)
Contructor taking the position of the elctrode.
Definition: WEEG.cpp:88
static std::shared_ptr< WPrototyped > m_prototype
The prototype as singleton.
Definition: WEEG.h:162
WEEGChannelLabels m_channelLabels
Label for each channel.
Definition: WEEG.h:185
static std::shared_ptr< WPrototyped > getPrototype()
Returns a prototype instantiated with the true type of the deriving class.
Definition: WEEG.cpp:77
WEEGElectrodeLibrary m_electrodeLibrary
Information about the electrodes.
Definition: WEEG.h:173
virtual bool isTexture() const
Determines whether this dataset can be used as a texture.
Definition: WEEG.cpp:62
WEEG()
Constructor creating a quite unusable instance.
Definition: WEEG.cpp:56
WEEGSegmentArray m_segments
Contains the EEG data as an arry of segements of data which consist of an array of electrodes which a...
Definition: WEEG.h:180
virtual const std::string getName() const
Gets the name of this prototype.
Definition: WEEG.cpp:67
virtual const std::string getDescription() const
Gets the description for this prototype.
Definition: WEEG.cpp:72
This only is a 3d double vector.
Base class for all recorded data and results with events and sensor positions.
Definition: WRecording.h:41
static const unsigned int MAX_RECORDING_SAMPLES
Maximum number of samples of a recording.
Definition: WRecording.h:78
static const unsigned int MAX_RECORDING_CHANNELS
Maximum number of channels for a certain modality.
Definition: WRecording.h:72
static const unsigned int MAX_RECORDING_SEGMENTS
Maximum number of segments of a recording.
Definition: WRecording.h:83