Commit 05b2f6ca authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[ADD] - EEG potential loader - skeleton

parent f93d3a31
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// 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 <fstream>
#include <string>
#include "WReaderEEGPotentials.h"
WReaderEEGPotentials::WReaderEEGPotentials( std::string fname )
: WReader( fname )
{
// initialize members
}
WReaderEEGPotentials::~WReaderEEGPotentials()
{
// cleanup
}
boost::shared_ptr< WDataSetScalar > WReaderEEGPotentials::read()
{
/*
try
{
std::ifstream ifs = std::ifstream();
ifs.open( m_fname.c_str(), std::ifstream::in | std::ifstream::binary );
if( ifs->bad() )
{
throw WDHIOFailure( "File could not be opened for read." );
}
}
catch( WDHException e )
{
wlog::error( "WReaderFiberVTK" ) << "Abort loading VTK fiber file: " << m_fname << ", due to: " << e.what();
}
boost::shared_ptr< WDataSetFibers > fibers = boost::shared_ptr< WDataSetFibers >( new WDataSetFibers( m_points,
m_fiberStartIndices,
m_fiberLengths,
m_pointFiberMapping ) );
fibers->setFileName( m_fname );
m_ifs->close();
return fibers;*/
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// 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 WREADEREEGPOTENTIALS_H
#define WREADEREEGPOTENTIALS_H
#include <string>
#include <boost/shared_ptr.hpp>
#include "../WDataSetScalar.h"
#include "../exceptions/WDHIOFailure.h"
#include "../exceptions/WDHNoSuchFile.h"
#include "../exceptions/WDHParseError.h"
#include "WReader.h"
/**
* Class loading EEG reconstructed potential fields. The format is quite similar to all these common ASCII VTK files.
*/
class WReaderEEGPotentials: public WReader
{
public:
/**
* Constructs and makes a new reader.
*
* \param fname File name where to read data from
*
* \throws WDHNoSuchFile if the file could not be opened
*/
WReaderEEGPotentials( std::string fname );
/**
* Destructor.
*/
virtual ~WReaderEEGPotentials();
/**
* Reads the potentials file and creates a dataset out of it.
*
* \return Reference to the dataset.
*/
virtual boost::shared_ptr< WDataSetScalar > read();
protected:
private:
};
#endif // WREADEREEGPOTENTIALS_H
......@@ -43,6 +43,7 @@
#include "../../../dataHandler/io/WPagerEEGLibeep.h"
#include "../../../dataHandler/io/WReaderELC.h"
#include "../../../dataHandler/io/WReaderFiberVTK.h"
#include "../../../dataHandler/io/WReaderEEGPotentials.h"
#include "WMData.h"
#include "data.xpm"
......@@ -391,6 +392,11 @@ void WMData::moduleMain()
WReaderFiberVTK fibReader( fileName );
m_dataSet = fibReader.read();
}
else if( suffix == ".pot" )
{
WReaderEEGPotentials potReader( fileName );
m_dataSet = potReader.read();
}
else
{
throw WDHException( "Unknown file type: '" + suffix + "'" );
......
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