Commit 9f1713b5 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[MERGE]

parents bd2b2f21 a11cba97
This diff is collapsed.
......@@ -34,13 +34,17 @@ WDataHandler::WDataHandler()
}
boost::shared_ptr< const WSubject > WDataHandler::getSubject( const unsigned int subjectId ) const
boost::shared_ptr< WSubject > WDataHandler::getSubject( const unsigned int subjectId ) const
{
if( subjectId >= m_subjects.size() )
throw WNoSuchDataSetException( "Index too large." );
return m_subjects.at( subjectId );
}
boost::shared_ptr< WSubject > WDataHandler::operator[]( size_t subjectId ) const
{
return getSubject( subjectId );
}
void WDataHandler::addSubject( boost::shared_ptr< WSubject > newSubject )
{
......@@ -59,7 +63,7 @@ void WDataHandler::loadDataSets( std::vector< std::string > fileNames )
WLoaderManager lm;
for ( size_t i = 0 ; i < fileNames.size() ; ++i)
{
// TODO( wiebel ): need to associate the dataset to its subject
// TODO(wiebel): need to associate the dataset to its subject
lm.load( fileNames[i], shared_from_this() );
}
}
......@@ -55,7 +55,13 @@ public:
* 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 WSubject > getSubject( const unsigned int subjectId ) const;
boost::shared_ptr< WSubject > getSubject( const unsigned int subjectId ) const;
/**
* Returns a 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< WSubject > operator[]( size_t subjectId ) const;
/**
* Insert a new WSubject referenced by a pointer.
......
......@@ -21,16 +21,23 @@
//
//---------------------------------------------------------------------------
#include <string>
#include "WDataSet.h"
WDataSet::WDataSet( boost::shared_ptr<WMetaInfo> newMetaInfo )
: m_metaInfo( newMetaInfo )
WDataSet::WDataSet()
: m_fileName( "" )
{
}
void WDataSet::setFileName( const std::string fileName )
{
assert( newMetaInfo );
assert( fileName != "" );
m_fileName = fileName;
}
boost::shared_ptr<WMetaInfo> WDataSet::getMetaInfo() const
std::string WDataSet::getFileName() const
{
return m_metaInfo;
return m_fileName;
}
......@@ -24,10 +24,9 @@
#ifndef WDATASET_H
#define WDATASET_H
#include <string>
#include <boost/shared_ptr.hpp>
class WMetaInfo;
/**
* Base class for all data set types. This class has a number of subclasses
* specifying the different types of data sets. Two of dataset type reprent
......@@ -42,7 +41,7 @@ public:
* Since every DataSet should have a MetaInfo, we ensure hereby you never
* go without one.
*/
explicit WDataSet( boost::shared_ptr< WMetaInfo > newMetaInfo );
WDataSet();
/**
* Since WDataSet is a base class and thus should be polymorphic we add
......@@ -53,16 +52,22 @@ public:
}
/**
* Returns the MetaInfo object for this DataSet.
* Set the name of the file that this data set stems from.
*/
boost::shared_ptr< WMetaInfo > getMetaInfo() const;
void setFileName( const std::string fileName );
protected:
/**
* Stores meta information like name, dimension, etc. for this DataSet.
* Get the name of the file that this data set stems from.
*/
boost::shared_ptr< WMetaInfo > m_metaInfo;
std::string getFileName() const;
protected:
private:
/**
* Name of the file this data set was loaded from. This information
* may allow hollowing data sets later.
*/
std::string m_fileName;
};
#endif // WDATASET_H
......@@ -37,8 +37,8 @@ public:
* Dummy constructor.
* TODO(wiebel): implement this
*/
explicit WDataSetMultiple( boost::shared_ptr< WMetaInfo > newMetaInfo )
: WDataSet( newMetaInfo )
explicit WDataSetMultiple()
: WDataSet()
{
// TODO(wiebel): implement this
};
......
......@@ -26,13 +26,11 @@
#include "WGrid.h"
WDataSetSingle::WDataSetSingle( boost::shared_ptr<WValueSetBase> newValueSet,
boost::shared_ptr<WGrid> newGrid,
boost::shared_ptr< WMetaInfo > newMetaInfo )
: WDataSet( newMetaInfo )
boost::shared_ptr<WGrid> newGrid )
: WDataSet()
{
assert( newValueSet );
assert( newGrid );
assert( newMetaInfo );
assert( newValueSet->size() == newGrid->size() );
m_valueSet = newValueSet;
......
......@@ -39,11 +39,10 @@ class WDataSetSingle : public WDataSet
{
public:
/**
* Constructs an instance out of a value set, grid and meta information.
* Constructs an instance out of a value set and a grid.
*/
WDataSetSingle( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid,
boost::shared_ptr< WMetaInfo > newMetaInfo );
boost::shared_ptr< WGrid > newGrid );
/**
* Destroys this DataSet instance
......
......@@ -37,8 +37,8 @@ public:
* Dummy constructor.
* TODO(wiebel): implement this
*/
explicit WDataSetTimeDependent( boost::shared_ptr< WMetaInfo > newMetaInfo )
: WDataSet( newMetaInfo )
explicit WDataSetTimeDependent()
: WDataSet()
{
// TODO(wiebel): implement this
};
......
......@@ -25,11 +25,10 @@
#include "../common/WLimits.h"
WEEG::WEEG( boost::shared_ptr< WMetaInfo > metaInfo,
const WEEGSegmentArray& data,
WEEG::WEEG( const WEEGSegmentArray& data,
const WEEGElectrodeLibrary& electrodeLib,
const WEEGChannelLabels& channelLabels )
: WRecording( metaInfo )
: WRecording()
{
assert( data.size() <= wlimits::MAX_RECORDING_SEGMENTS );
assert( data.size() > 0 ); // ensure that ther is really data
......
......@@ -32,7 +32,7 @@
///======================================
// TODO( wiebel ): use this szuff or remove it
// TODO(wiebel): use this szuff or remove it
#include "../math/WPosition.h"
typedef double dummyType;
class WEEGElectrodeObject
......@@ -72,8 +72,7 @@ public:
/**
* TODO(wiebel): Document this!
*/
explicit WEEG( boost::shared_ptr< WMetaInfo > metaInfo,
const WEEGSegmentArray& data,
explicit WEEG( const WEEGSegmentArray& data,
const WEEGElectrodeLibrary& electrodeLib,
const WEEGChannelLabels& channelLabels );
......
//---------------------------------------------------------------------------
//
// 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 <string>
#include <vector>
#include "WMetaInfo.h"
WMetaInfo::WMetaInfo() :
m_name( "" ),
m_fileName( "" ),
m_dataType( 0 ),
m_valueDim( 0 ),
m_nx( 0 ),
m_ny( 0 ),
m_nz( 0 ),
m_dx( 0.0 ),
m_dy( 0.0 ),
m_dz( 0.0 ),
m_xyzUnits( 0 ),
m_xyzUnitsName( "" ),
m_qformCode( 0 ),
m_qformCodeName( "" ),
// m_qtoXyzMatrix
// m_qtoIjkMatrix
m_quaternB( 0.0 ),
m_quaternC( 0.0 ),
m_quaternD( 0.0 ),
m_qoffsetX( 0.0 ),
m_qoffsetY( 0.0 ),
m_qoffsetZ( 0.0 ),
m_qfac( 0.0 ),
m_qformOrientationI( 0 ),
m_qformOrientationJ( 0 ),
m_qformOrientationK( 0 ),
m_freqDim( 0 ),
m_phaseDim( 0 ),
m_sliceDim( 0 )
{
}
std::string WMetaInfo::getName() const
{
return m_name;
}
void WMetaInfo::setName( std::string name )
{
m_name = name;
}
std::string WMetaInfo::getFileName() const
{
return m_fileName;
}
void WMetaInfo::setFileName( std::string fileName )
{
m_fileName = fileName;
}
int WMetaInfo::getDataType() const
{
return m_dataType;
}
void WMetaInfo::setDataType( int dataType )
{
m_dataType = dataType;
}
int WMetaInfo::getValueDim() const
{
return m_valueDim;
}
void WMetaInfo::setValueDim( int valueDim )
{
m_valueDim = valueDim;
}
int WMetaInfo::getNx() const
{
return m_nx;
}
void WMetaInfo::setNx( int nx )
{
m_nx = nx;
}
int WMetaInfo::getNy() const
{
return m_ny;
}
void WMetaInfo::setNy( int ny )
{
m_ny = ny;
}
int WMetaInfo::getNz() const
{
return m_nz;
}
void WMetaInfo::setNz( int nz )
{
m_nz = nz;
}
float WMetaInfo::getDx() const
{
return m_dx;
}
void WMetaInfo::setDx( float dx )
{
m_dx = dx;
}
float WMetaInfo::getDy() const
{
return m_dy;
}
void WMetaInfo::setDy( float dy )
{
m_dy = dy;
}
float WMetaInfo::getDz() const
{
return m_dz;
}
void WMetaInfo::setDz( float dz )
{
m_dz = dz;
}
int WMetaInfo::getXyzUnits() const
{
return m_xyzUnits;
}
void WMetaInfo::setXyzUnits( int xyzUnits )
{
m_xyzUnits = xyzUnits;
}
std::string WMetaInfo::getXyzUnitsName() const
{
return m_xyzUnitsName;
}
void WMetaInfo::setXyzUnitsName( std::string xyzUnitsName )
{
m_xyzUnitsName = xyzUnitsName;
}
int WMetaInfo::getFreqDim() const
{
return m_freqDim;
}
void WMetaInfo::setFreqDim( int freqDim )
{
m_freqDim = freqDim;
}
int WMetaInfo::getPhaseDim() const
{
return m_phaseDim;
}
void WMetaInfo::setPhaseDim( int phaseDim )
{
m_phaseDim = phaseDim;
}
int WMetaInfo::getSliceDim() const
{
return m_sliceDim;
}
void WMetaInfo::setSliceDim( int sliceDim )
{
m_sliceDim = sliceDim;
}
int WMetaInfo::getQformCode() const
{
return m_qformCode;
}
void WMetaInfo::setQformCode( int qformCode )
{
m_qformCode = qformCode;
}
std::string WMetaInfo::getQformCodeName() const
{
return m_qformCodeName;
}
void WMetaInfo::setQformCodeName( std::string qformCodeName )
{
m_qformCodeName = qformCodeName;
}
std::vector<float> WMetaInfo::getQtoXyzMatrix() const
{
return m_qtoXyzMatrix;
}
void WMetaInfo::setQtoXyzMatrix( std::vector<float> qtoXyzMatrix )
{
m_qtoXyzMatrix = qtoXyzMatrix;
}
std::vector<float> WMetaInfo::getQtoIjkMatrix() const
{
return m_qtoIjkMatrix;
}
void WMetaInfo::setQtoIjkMatrix( std::vector<float> qtoIjkMatrix )
{
m_qtoIjkMatrix = qtoIjkMatrix;
}
float WMetaInfo::getQuaternB() const
{
return m_quaternB;
}
void WMetaInfo::setQuaternB( float quaternB )
{
m_quaternB = quaternB;
}
float WMetaInfo::getQuaternC() const
{
return m_quaternC;
}
void WMetaInfo::setQuaternC( float quaternC )
{
m_quaternC = quaternC;
}
float WMetaInfo::getQuaternD() const
{
return m_quaternD;
}
void WMetaInfo::setQuaternD( float quaternD )
{
m_quaternD = quaternD;
}
float WMetaInfo::getQoffsetX() const
{
return m_qoffsetX;
}
void WMetaInfo::setQoffsetX( float qoffsetX )
{
m_qoffsetX = qoffsetX;
}
float WMetaInfo::getQoffsetY() const
{
return m_qoffsetY;
}
void WMetaInfo::setQoffsetY( float qoffsetY )
{
m_qoffsetY = qoffsetY;
}
float WMetaInfo::getQoffsetZ() const
{
return m_qoffsetZ;
}
void WMetaInfo::setQoffsetZ( float qoffsetZ )
{
m_qoffsetZ = qoffsetZ;
}
float WMetaInfo::getQfac() const
{
return m_qfac;
}
void WMetaInfo::setQfac( float qfac )
{
m_qfac = qfac;
}
int WMetaInfo::getQformOrientationI() const
{
return m_qformOrientationI;
}
void WMetaInfo::setQformOrientationI( int qformOrientationI )
{
m_qformOrientationI = qformOrientationI;
}
int WMetaInfo::getQformOrientationJ() const
{
return m_qformOrientationJ;
}
void WMetaInfo::setQformOrientationJ( int qformOrientationJ )
{
m_qformOrientationJ = qformOrientationJ;
}
int WMetaInfo::getQformOrientationK() const
{
return m_qformOrientationK;
}
void WMetaInfo::setQformOrientationK( int qformOrientationK )
{
m_qformOrientationK = qformOrientationK;
}
//---------------------------------------------------------------------------
//
// 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 WMETAINFO_H
#define WMETAINFO_H
#include <string>
#include <vector>
/**
* Stores meta information such as types, file names, etc. associated with a
* WDataSet loaded into OpenWalnut.
* \ingroup dataHandler
*/
class WMetaInfo
{
/**
* Only UnitTests are allowed to be friends of this class
*/
friend class WMetaInfoTest;
public:
WMetaInfo();
std::string getName() const;
void setName( std::string name );
std::string getFileName() const;
void setFileName( std::string fileName );
int getDataType() const;
void setDataType( int dataType );
int getValueDim() const;
void setValueDim( int valueDim );
int getNx() const;
void setNx( int nx );
int getNy() const;
void setNy( int ny );
int getNz() const;
void setNz( int nz );
float getDx() const;
void setDx( float dx );
float getDy() const;
void setDy( float dy );
float getDz() const;
void setDz( float dz );
int getXyzUnits() const;
void setXyzUnits( int xyzUnits );
std::string getXyzUnitsName() const;
void setXyzUnitsName( std::string xyzUnitsName );
int getFreqDim() const;
void setFreqDim( int freqDim );