OpenWalnut  1.4.0
WEEG.cpp
00001 //---------------------------------------------------------------------------
00002 //
00003 // Project: OpenWalnut ( http://www.openwalnut.org )
00004 //
00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
00006 // For more information see http://www.openwalnut.org/copying
00007 //
00008 // This file is part of OpenWalnut.
00009 //
00010 // OpenWalnut is free software: you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as published by
00012 // the Free Software Foundation, either version 3 of the License, or
00013 // (at your option) any later version.
00014 //
00015 // OpenWalnut is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public License
00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
00022 //
00023 //---------------------------------------------------------------------------
00024 
00025 #include <string>
00026 
00027 #include "../common/WPrototyped.h"
00028 
00029 #include "WEEG.h"
00030 
00031 // prototype instance as singleton
00032 boost::shared_ptr< WPrototyped > WEEG::m_prototype = boost::shared_ptr< WPrototyped >();
00033 
00034 WEEG::WEEG( const WEEGSegmentArray& data,
00035             const WEEGElectrodeLibrary& electrodeLib,
00036             const WEEGChannelLabels& channelLabels )
00037     : WRecording()
00038 {
00039     assert( data.size() <= WRecording::MAX_RECORDING_SEGMENTS );
00040     assert( data.size() > 0 );  // ensure that ther is really data
00041     for( WEEGSegmentArray::const_iterator it1 = data.begin(); it1 != data.end(); ++it1 )
00042     {
00043         assert( it1->size() <= WRecording::MAX_RECORDING_CHANNELS );
00044         assert( it1->size() > 0 );  // ensure that ther is really data
00045         for( WEEGSegment::const_iterator it2 = it1->begin(); it2 != it1->end(); ++it2 )
00046         {
00047             assert( it2->size() <= WRecording::MAX_RECORDING_SAMPLES );
00048             assert( it2->size() > 0 );  // ensure that ther is really data
00049         }
00050     }
00051     m_segments = data;
00052     m_electrodeLibrary = electrodeLib;
00053     m_channelLabels = channelLabels;
00054 }
00055 
00056 WEEG::WEEG()
00057     : WRecording()
00058 {
00059     // do nothing here. Only useful for prototypes.
00060 }
00061 
00062 bool WEEG::isTexture() const
00063 {
00064     return false;
00065 }
00066 
00067 const std::string WEEG::getName() const
00068 {
00069     return "WEEG";
00070 }
00071 
00072 const std::string WEEG::getDescription() const
00073 {
00074     return "Contains data acquired using EEG.";
00075 }
00076 
00077 boost::shared_ptr< WPrototyped > WEEG::getPrototype()
00078 {
00079     if( !m_prototype )
00080     {
00081         m_prototype = boost::shared_ptr< WPrototyped >( new WEEG() );
00082     }
00083 
00084     return m_prototype;
00085 }
00086 
00087 
00088 WEEGElectrodeObject::WEEGElectrodeObject( WPosition position ):
00089     m_position( position )
00090 {
00091 }
00092 
00093 WPosition WEEGElectrodeObject::getPosition() const
00094 {
00095     return m_position;
00096 }