Commit 82b6f9c8 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE]

- Merged
parents fc6a0fab c18f025f
......@@ -19,6 +19,10 @@
\usepackage{wrapfig}
\bibliographystyle{alpha}
\newcommand{\todo}[1]{\textcolor{white}{\colorbox{red}{\\ Noch zu %
tun:}}\ \ #1 \textcolor{red}{\colorbox{red}{I}}\\\ \\\ }
\newcommand{\here}{\textcolor{white}{\colorbox{red}{\\\LARGE HIER}} }
\begin{document}
\titlehead{
OpenWalnut Project\\
......@@ -35,6 +39,15 @@
\tableofcontents
\chapter{GUI}
The GUI module is the only part where we allow gui-toolkit related code. For example, this means that the use of any QT class is prohibited outside the GUI module.
\chapter{GE (Graphics Engine)}
\todo{This is still wrong}
The GraphicsEngine module is the only part where we allow OpenGL or shader code.
There are different kind of objects being treated in the GraphicsEngine:
Graphics primitives like triangles, lines, ...
Textures, at least 2D and 3D
3D textures often are the representation of data from a data set in the DataHandler that is needed for rendering.
\chapter{DataHandler}
The sections in this chapter are organized according to different
types od recording or imaging data.
......@@ -42,6 +55,50 @@ types od recording or imaging data.
\subsection{Note}
sread in BIOSIG C++ toolbox provides start and length parameters ... these should be used as EEG might not fit or at least is not intended to be completely in the main memory. This should also be reflected in the design of the data structure.
Is segment-wise loading a good solution?
\section{Taken from Wiki}
\todo{Has to be fixed as it was
This page describes the main ideas of the architecture of our /src/dataHandler.
WDataHandler is the main entry point to the module. It contains all
the data sets. Each of the data sets is encapsulated by a WDataSet
object.
WDataSet is the base class for a number of subclasses representing
different types of data sets, e.g.
\begin{itemize}
\item WDataSetSingle - A simple single data set.
\item WDatSetTimeDependent - A data set that encapsulates a number of
data sets for different time steps.
\end{itemize}
WDataSet has a WMetaInfo
A WDataSetSingle is a WDataSet and has a WValueSet
and a WGrid
A WDataSetTimeDependent is a WDataSet has more than one WValueSet and
at least one WGrid (at the moment, i.e. 2009-05-13 we expect only one
WGrid)
A WMetaInfo has a number of attribute describing a WDataSet, e.g.:
Name of data set
FileName: Name of the file the data was loaded from.
...
A WMetaInfoTimeDependent is a WMetaInfo and has a
a number of additional attributes.
A WValueSet has subclasses for different types of values.
A data set has a low level access for the GraphicsEngine? to ensure
performance. This access is realized by a function similar to
\begin{verbatim}
T* getValuesPointer< class T >()
\end{verbatim}
and code to get the access then look similar to
\begin{verbatim}
float *myValuePointer;
myValuePointer = getValuesPointer<float *>()
\end{verbatim}
Data can not be manipulated!
\end{document}
......@@ -25,7 +25,7 @@
#include <vector>
#include "WDataHandler.h"
#include "WDataSet.h"
#include "WSubject.h"
#include "exceptions/WNoSuchDataSetException.h"
#include "WLoaderManager.h"
......@@ -34,23 +34,23 @@ WDataHandler::WDataHandler()
}
boost::shared_ptr< const WDataSet > WDataHandler::getDataSet( const unsigned int dataSetId ) const
boost::shared_ptr< const WSubject > WDataHandler::getSubject( const unsigned int subjectId ) const
{
if( dataSetId >= m_dataSets.size() )
if( subjectId >= m_subjects.size() )
throw WNoSuchDataSetException( "Index too large." );
return m_dataSets.at(dataSetId);
return m_subjects.at( subjectId );
}
void WDataHandler::addDataSet( boost::shared_ptr< WDataSet > newDataSet )
void WDataHandler::addSubject( boost::shared_ptr< WSubject > newSubject )
{
m_dataSets.push_back( newDataSet );
m_subjects.push_back( newSubject );
}
unsigned int WDataHandler::getNumberOfDataSets() const
unsigned int WDataHandler::getNumberOfSubjects() const
{
return m_dataSets.size();
return m_subjects.size();
}
......@@ -59,6 +59,7 @@ void WDataHandler::loadDataSets( std::vector< std::string > fileNames )
WLoaderManager lm;
for ( size_t i = 0 ; i < fileNames.size() ; ++i)
{
lm.load( fileNames[i], ( boost::shared_ptr<WDataHandler> )this );
// TODO( wiebel ): need to associate the dataset to its subject
lm.load( fileNames[i], ( boost::shared_ptr< WDataHandler > )this );
}
}
......@@ -29,10 +29,12 @@
#include <boost/shared_ptr.hpp>
class WDataSet;
class WSubject;
/**
* Provides the environment for storing and accessing DataSets.
* Provides the environment for storing and accessing different subjects.
* As all measured data belongs to one subject, this is the main access point
* to our data.
* \ingroup dataHandler
*/
class WDataHandler
......@@ -49,20 +51,20 @@ public:
WDataHandler();
/**
* Get the pointer to the i'th DataSet. The return type is const since we
* want to ensure that each DataSet cannot modified after retrival.
* Get the pointer to the i'th WSubject. The return type is const since we
* want to ensure that each subject cannot modified after retrival.
*/
boost::shared_ptr< const WDataSet > getDataSet( const unsigned int dataSetId ) const;
boost::shared_ptr< const WSubject > getSubject( const unsigned int subjectId ) const;
/**
* Insert a new DataSet referenced by a pointer.
* Insert a new WSubject referenced by a pointer.
*/
void addDataSet( boost::shared_ptr< WDataSet > newDataSet );
void addSubject( boost::shared_ptr< WSubject > newSubject );
/**
* Get the number of DataSets which are actually handled by our DataHandler.
* Get the number of subjects which are actually handled by our WDataHandler.
*/
unsigned int getNumberOfDataSets() const;
unsigned int getNumberOfSubjects() const;
/**
* Calls WLoaderManager to load the given input file.
......@@ -73,9 +75,9 @@ protected:
private:
/**
* A container for all DataSets.
* A container for all WSubjects.
*/
std::vector< boost::shared_ptr< WDataSet > > m_dataSets;
std::vector< boost::shared_ptr< WSubject > > m_subjects;
};
/**
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// 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/>.
//
//---------------------------------------------------------------------------
#include "WSubject.h"
#include "exceptions/WNoSuchDataSetException.h"
WSubject::WSubject()
{
}
boost::shared_ptr< const WDataSet > WSubject::getDataSet( const unsigned int dataSetId ) const
{
if( dataSetId >= m_dataSets.size() )
throw WNoSuchDataSetException( "Index too large." );
return m_dataSets.at( dataSetId );
}
void WSubject::addDataSet( boost::shared_ptr< WDataSet > newDataSet )
{
m_dataSets.push_back( newDataSet );
}
unsigned int WSubject::getNumberOfDataSets() const
{
return m_dataSets.size();
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// 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 WSUBJECT_H
#define WSUBJECT_H
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
class WDataSet;
/**
* Container for all WDataSets belonging to one subject.
* \ingroup dataHandler
*/
class WSubject
{
public:
/**
* Empty standard constructor.
*/
WSubject();
/**
* Get the pointer to the i'th WDataSet. The return type is const since we
* want to ensure that each DataSet cannot modified after retrival.
*/
boost::shared_ptr< const WDataSet > getDataSet( const unsigned int subjectId ) const;
/**
* Insert a new DataSet referenced by a pointer.
*/
void addDataSet( boost::shared_ptr< WDataSet > newDataSet );
/**
* Get the number of DataSets which are actually handled by our subject.
*/
unsigned int getNumberOfDataSets() const;
protected:
private:
/**
* A container for all WDataSets belonging to the subject.
*/
std::vector< boost::shared_ptr< WDataSet > > m_dataSets;
};
#endif // WSUBJECT_H
......@@ -29,8 +29,9 @@
#include "../../common/WException.h"
/**
* Should be thrown when an invalid index is used to get a WDataSet from the
* WDataHandler. An index is invalid if it's greater or equal than the number
* Should be thrown when an invalid index is used to get a WSubject from
* the WDataHandler or a WDataSet from the
* WSubject. An index is invalid if it's greater or equal than the number
* of WDataSets in that WDataHandler.
*
* It's subclassed from std::logic_error since it represents a mistake by a
......
......@@ -33,6 +33,7 @@
#include "../WDataHandler.h"
#include "../WMetaInfo.h"
#include "../WEEG.h"
#include "../WSubject.h"
#include "../../common/WException.h"
WLoaderBiosig::WLoaderBiosig( std::string fileName, boost::shared_ptr< WDataHandler > dataHandler )
......@@ -127,7 +128,10 @@ void WLoaderBiosig::biosigLoader()
}
boost::shared_ptr< WEEG > eeg = boost::shared_ptr< WEEG >( new WEEG( metaInfo, segments, lib, labels ) );
m_dataHandler->addDataSet( eeg );
boost::shared_ptr< WSubject > subject; // TODO( wiebel ): this is a dummy
subject->addDataSet( eeg );
m_dataHandler->addSubject( subject );
std::cout << "BIOSIG loading done." << std::endl;
std::cout << "===================================" << std::endl;
......
......@@ -28,6 +28,7 @@
#include <boost/lexical_cast.hpp>
#include "WLoaderEEGASCII.h"
#include "../WSubject.h"
#include "../WEEG.h"
#include "../WMetaInfo.h"
#include "../../common/WException.h"
......@@ -84,5 +85,10 @@ void WLoaderEEGASCII::operator()()
WEEGElectrodeLibrary lib; // TODO( wiebel ): this is a dummy
boost::shared_ptr< WEEG > eeg = boost::shared_ptr< WEEG >( new WEEG( metaInfo, segments, lib, labels ) );
m_dataHandler->addDataSet( eeg );
// TODO( wiebel ): this is a dummy
boost::shared_ptr< WSubject > subject = boost::shared_ptr< WSubject >( new WSubject );
subject->addDataSet( eeg );
m_dataHandler->addSubject( subject );
}
......@@ -29,6 +29,7 @@
#include "WLoaderNIfTI.h"
#include "../WDataHandler.h"
#include "../WDataSet.h"
#include "../WSubject.h"
#include "../WDataSetSingle.h"
#include "../WGrid.h"
#include "../WGridRegular3D.h"
......@@ -132,7 +133,12 @@ void WLoaderNIfTI::operator()()
boost::shared_ptr< WDataSet > newDataSet = boost::shared_ptr< WDataSet >(
new WDataSetSingle( newValueSet, newGrid, metaInfo ) );
m_dataHandler->addDataSet( newDataSet );
// TODO( wiebel ): this is a dummy
boost::shared_ptr< WSubject > subject = boost::shared_ptr< WSubject >( new WSubject );
subject->addDataSet( newDataSet );
m_dataHandler->addSubject( subject );
}
......
......@@ -48,7 +48,7 @@ public:
std::cout << std::endl << "Test loading of " << fileName << "." << std::endl;
boost::shared_ptr< WDataHandler > dataHandler =
boost::shared_ptr< WDataHandler >( new WDataHandler() );
TS_ASSERT_EQUALS( dataHandler->getNumberOfDataSets(), 0 );
TS_ASSERT_EQUALS( dataHandler->getNumberOfSubjects(), 0 );
// WLoaderBiosig biosigLoader( fileName, dataHandler );
// boost::thread loaderThread( biosigLoader );
......
......@@ -46,12 +46,14 @@ public:
boost::shared_ptr< WDataHandler > dataHandler =
boost::shared_ptr< WDataHandler >( new WDataHandler() );
TS_ASSERT_EQUALS( dataHandler->getNumberOfDataSets(), 0 );
TS_ASSERT_EQUALS( dataHandler->getNumberOfSubjects(), 0 );
WLoaderEEGASCII eegASCIILoader( fileName, dataHandler );
boost::thread loaderThread( eegASCIILoader );
sleep( 3 );
TS_ASSERT_EQUALS( dataHandler->getNumberOfDataSets(), 1 );
// TODO( wiebel ): we need to change this because loading, in the end,
// should not always increase the number of subjects.
TS_ASSERT_EQUALS( dataHandler->getNumberOfSubjects(), 1 );
}
};
......
......@@ -27,24 +27,21 @@
#include <cxxtest/TestSuite.h>
#include "../WDataHandler.h"
#include "../WDataSet.h"
#include "../WMetaInfo.h"
#include "../WSubject.h"
#include "../exceptions/WNoSuchDataSetException.h"
class WDataHandlerTest : public CxxTest::TestSuite
{
public:
boost::shared_ptr< WDataSet > dummyDataSet;
boost::shared_ptr< WSubject > dummySubject;
/**
* Constructs unit test environment.
*/
void setUp( void )
{
// create a DataSet dummy, since this is needed in almost every test
boost::shared_ptr< WMetaInfo > metaInfo =
boost::shared_ptr< WMetaInfo >( new WMetaInfo );
dummyDataSet = boost::shared_ptr< WDataSet >( new WDataSet( metaInfo ) );
// create a subject dummy, since this is needed in almost every test
dummySubject = boost::shared_ptr< WSubject >( new WSubject() );
}
/**
......@@ -62,54 +59,52 @@ public:
void testAddDataSet( void )
{
WDataHandler dataHandler;
TS_ASSERT_EQUALS( dataHandler.m_dataSets.size(), 0 );
TS_ASSERT_THROWS_NOTHING( dataHandler.addDataSet( dummyDataSet ) );
TS_ASSERT_EQUALS( dataHandler.m_dataSets.size(), 1 );
TS_ASSERT_EQUALS( dataHandler.m_subjects.size(), 0 );
TS_ASSERT_THROWS_NOTHING( dataHandler.addSubject( dummySubject ) );
TS_ASSERT_EQUALS( dataHandler.m_subjects.size(), 1 );
}
/**
* Checks if the size (meaning the number of elements) of our container
* works properly.
*/
void testGetNumberOfDataSets( void )
void testGetNumberOfSubjects( void )
{
WDataHandler dataHandler;
TS_ASSERT_EQUALS( dataHandler.getNumberOfDataSets(), 0 );
dataHandler.addDataSet( dummyDataSet );
TS_ASSERT_EQUALS( dataHandler.getNumberOfDataSets(), 1 );
dataHandler.addDataSet( dummyDataSet );
TS_ASSERT_EQUALS( dataHandler.getNumberOfDataSets(), 2 );
TS_ASSERT_EQUALS( dataHandler.getNumberOfSubjects(), 0 );
dataHandler.addSubject( dummySubject );
TS_ASSERT_EQUALS( dataHandler.getNumberOfSubjects(), 1 );
dataHandler.addSubject( dummySubject );
TS_ASSERT_EQUALS( dataHandler.getNumberOfSubjects(), 2 );
}
/**
* When retrieving a DataSet only valid indices are allowed.
* When retrieving a subject only valid indices are allowed.
*/
void testGetDataSets( void )
void testGetSubjects( void )
{
WDataHandler dataHandler;
boost::shared_ptr< WMetaInfo > metaInfo = boost::shared_ptr< WMetaInfo >( new WMetaInfo );
metaInfo->setName( "Other Data Set" );
boost::shared_ptr< WDataSet > otherDataSet =
boost::shared_ptr< WDataSet >( new WDataSet( metaInfo ) );
dataHandler.addDataSet( dummyDataSet );
dataHandler.addDataSet( otherDataSet );
TS_ASSERT_THROWS_NOTHING( dataHandler.getDataSet( 0 ) );
TS_ASSERT_THROWS_NOTHING( dataHandler.getDataSet( 1 ) );
TS_ASSERT_EQUALS( dataHandler.getDataSet( 0 ), dummyDataSet );
TS_ASSERT_EQUALS( dataHandler.getDataSet( 1 ), otherDataSet );
TS_ASSERT_DIFFERS( dataHandler.getDataSet( 1 ), dummyDataSet );
TS_ASSERT_THROWS( dataHandler.getDataSet( 2 ), WNoSuchDataSetException );
boost::shared_ptr< WSubject > otherSubject =
boost::shared_ptr< WSubject >( new WSubject );
dataHandler.addSubject( dummySubject );
dataHandler.addSubject( otherSubject );
TS_ASSERT_THROWS_NOTHING( dataHandler.getSubject( 0 ) );
TS_ASSERT_THROWS_NOTHING( dataHandler.getSubject( 1 ) );
TS_ASSERT_EQUALS( dataHandler.getSubject( 0 ), dummySubject );
TS_ASSERT_EQUALS( dataHandler.getSubject( 1 ), otherSubject );
TS_ASSERT_DIFFERS( dataHandler.getSubject( 1 ), dummySubject );
TS_ASSERT_THROWS( dataHandler.getSubject( 2 ), WNoSuchDataSetException );
}
/**
* Test prevention of modification of a retrieved DataSet.
* Test prevention of modification of a retrieved subject.
*/
void testConstnessOnDataSet( void )
void testConstnessOnSubject( void )
{
WDataHandler dh;
dh.addDataSet( dummyDataSet );
boost::shared_ptr< const WDataSet > dataSet = dh.getDataSet( 0 );
// ToDo(math): I need to try to modify dataSet in order to test
dh.addSubject( dummySubject );
boost::shared_ptr< const WSubject > dataSet = dh.getSubject( 0 );
// ToDo(math): I need to try to modify subject in order to test
}
};
......
......@@ -53,7 +53,9 @@ public:
WLoaderManager testLoaderManager;
testLoaderManager.load( fileName, dataHandler );
sleep( 4 ); // we need this to allow the thread to terminate
TS_ASSERT( dataHandler->getNumberOfDataSets() );
// TODO( wiebel ): we need to change this because loading, in the end,
// should not always increase the number of subjects.
TS_ASSERT( dataHandler->getNumberOfSubjects() );
}
};
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// 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 WSUBJECT_TEST_H
#define WSUBJECT_TEST_H
#include <cxxtest/TestSuite.h>
#include "../WSubject.h"
/**
* TODO(wiebel): Document this!
*/
class WSubjectTest : public CxxTest::TestSuite
{
public:
/**
* TODO(wiebel): Document this!
*/
void testSomething( void )
{
}
};
#endif // WSUBJECT_TEST_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment