WEEG.h 4.09 KB
Newer Older
1 2
//---------------------------------------------------------------------------
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5 6
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------

#ifndef WEEG_H
#define WEEG_H

#include <map>
#include <string>
#include <vector>
#include "WRecording.h"


34

35
///======================================
36
// TODO(wiebel): use this szuff or remove it
37
#include "../math/WPosition.h"
38
typedef double WDummyType;
39 40 41 42 43 44
class WEEGElectrodeObject
{
public:
protected:
private:
    wmath::WPosition m_position;
Alexander Wiebel's avatar
Alexander Wiebel committed
45 46 47
    // TODO(wiebel): The following is suggested in the
    // eemagine design document
    // WColor color;
48 49 50 51 52 53
};
class WEEGSegementInfo
{
public:
protected:
private:
54 55 56
    WDummyType m_startSample;
    WDummyType m_endSample;
    WDummyType m_segmentStartDate;
57 58 59
};
//================================================

60 61 62 63 64 65
typedef std::vector< double > WEEGElectrode;
typedef std::vector< WEEGElectrode > WEEGSegment;
typedef std::vector< WEEGSegment > WEEGSegmentArray;

typedef std::vector< WEEGElectrodeObject > WEEGElectrodeLibrary;
typedef std::vector< std::pair< std::string, std::string > > WEEGChannelLabels;
66
/**
wiebel's avatar
wiebel committed
67 68
 * Contains EEG recording data.
 * \ingroup dataHandler
69 70 71 72
 */
class WEEG : public WRecording
{
public:
73

74 75 76 77

    /**
     * TODO(wiebel): Document this!
     */
78
    explicit WEEG( const WEEGSegmentArray& data,
79 80
                   const WEEGElectrodeLibrary& electrodeLib,
                   const WEEGChannelLabels& channelLabels );
81

wiebel's avatar
wiebel committed
82 83 84
    /**
     * Access operator for single samples.
     */
85 86 87 88 89
    const double& operator()( size_t segment, size_t signal, size_t sample ) const
    {
        return m_segments[segment][signal][sample];
    }

90 91 92
    /**
     * Returns number of samples of a given segment.
     */
93
    size_t getNumberOfSamples( size_t segmentId ) const
94 95 96 97 98 99 100
    {
        return m_segments[segmentId][0].size();
    }

    /**
     * Return the number of channels this EEG has.
     */
101
    size_t getNumberOfChannels() const
102 103 104 105 106 107 108
    {
        return m_segments[0].size();
    }

    /**
     * Return the number of segments this EEG consists of.
     */
109
    size_t getNumberOfSegments() const
110 111 112 113
    {
        return m_segments.size();
    }

114 115 116 117 118
    /**
     * Return the label of a certain channel.
     */
    std::string getChannelLabel( size_t channelId ) const
    {
119
        // TODO(wiebel): what is done with the second string of the label?
120 121 122
        return  m_channelLabels[channelId].first;
    }

123 124 125 126 127 128 129 130 131 132 133 134 135 136
protected:
private:
    /**
     * We have only on sampling rate for all channels.
     */
    double m_samplingRate;
    /**
     * Information about segments. An array of WEEGSegmentInfo objects.
     */
    std::vector< WEEGSegementInfo > m_segmentInfo;
    /**
     * Description of electrodes
     */
    std::map< std::string, size_t > m_electrodeDescriptions;
137 138 139 140 141

    /**
     * Information about the electrodes.
     */
    WEEGElectrodeLibrary m_electrodeLibrary;
142 143 144

    /**
     * Contains the EEG data as an arry of segements
wiebel's avatar
wiebel committed
145
     * of data which consist of an array of electrodes
146 147 148
     * which again consist of an array of samples over time.
     */
    WEEGSegmentArray m_segments;
149 150 151 152 153 154 155 156 157 158

    /**
     * Label for each channel.
     */
    WEEGChannelLabels m_channelLabels;

    /**
     * Is the channel enabled?
     */
    std::vector< bool > m_channelEnabled;
159 160 161 162
};


#endif  // WEEG_H