Commit 8527dfea authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[CLEAN] renamed loaders as readers to fit their new parent class

parent 0ac446aa
......@@ -28,7 +28,7 @@
#include <boost/shared_ptr.hpp>
#include "WLoaderBiosig.h"
#include "WReaderBiosig.h"
#include "../WEEG.h"
#include "../WSubject.h"
#include "../../common/WAssert.h"
......@@ -37,14 +37,14 @@
#include "../../common/WStringUtils.h"
WLoaderBiosig::WLoaderBiosig( std::string fileName )
: WLoaderEEG( fileName ),
WReaderBiosig::WReaderBiosig( std::string fileName )
: WReaderEEG( fileName ),
m_columns( 0 ),
m_rows( 0 )
{
}
void WLoaderBiosig::fillSegmentColumnBased( std::vector<std::vector<double> >* segment, biosig_data_type* data )
void WReaderBiosig::fillSegmentColumnBased( std::vector<std::vector<double> >* segment, biosig_data_type* data )
{
for( unsigned int i = 0; i < m_columns; ++i )
{
......@@ -57,7 +57,7 @@ void WLoaderBiosig::fillSegmentColumnBased( std::vector<std::vector<double> >* s
}
}
void WLoaderBiosig::fillSegmentRowBased( std::vector<std::vector<double> >* segment, biosig_data_type* data )
void WReaderBiosig::fillSegmentRowBased( std::vector<std::vector<double> >* segment, biosig_data_type* data )
{
for( unsigned int j = 0; j < m_rows; ++j )
{
......@@ -70,7 +70,7 @@ void WLoaderBiosig::fillSegmentRowBased( std::vector<std::vector<double> >* segm
}
}
boost::shared_ptr< WDataSet > WLoaderBiosig::load()
boost::shared_ptr< WDataSet > WReaderBiosig::load()
{
WAssert( m_fname.substr( m_fname.size() - 4 ) == ".edf", "We expect only EDF for the biosig loader so far." );
......
......@@ -30,7 +30,7 @@
#include <boost/shared_ptr.hpp>
#include "WLoaderEEG.h"
#include "WReaderEEG.h"
#ifdef _MSC_VER
#include "biosigWin/biosig.h"
#else
......@@ -39,11 +39,11 @@
/**
* Loader for several formats for biological signal.
* Reader for several formats for biological signal.
* Uses BiosigC++ 4.
* \ingroup dataHandler
*/
class WLoaderBiosig : public WLoaderEEG
class WReaderBiosig : public WReaderEEG
{
public:
/**
......@@ -51,7 +51,7 @@ public:
* for the loader when executed in its own thread.
* \param fileName this file will be loaded
*/
explicit WLoaderBiosig( std::string fileName );
explicit WReaderBiosig( std::string fileName );
/**
* Loads the dataset.
......
......@@ -30,15 +30,15 @@
#include "../../common/WAssert.h"
#include "../../common/WLogger.h"
#include "WLoaderEEG.h"
#include "WReaderEEG.h"
WLoaderEEG::WLoaderEEG( std::string fileName ) throw( WDHIOFailure )
WReaderEEG::WReaderEEG( std::string fileName ) throw( WDHIOFailure )
: WReader( fileName )
{
}
WEEGElectrodeLibrary WLoaderEEG::extractElectrodePositions()
WEEGElectrodeLibrary WReaderEEG::extractElectrodePositions()
{
namespace su = string_utils;
......@@ -50,7 +50,7 @@ WEEGElectrodeLibrary WLoaderEEG::extractElectrodePositions()
ifs.open( elcFileName.c_str(), std::ifstream::in );
if( !ifs || ifs.bad() )
{
WLogger::getLogger()->addLogMessage( "Try load broken file '" + elcFileName + "'", "EEG Loader", LL_ERROR );
WLogger::getLogger()->addLogMessage( "Try load broken file '" + elcFileName + "'", "EEG Reader", LL_ERROR );
throw std::runtime_error( "Problem during reading file. Probably file not found." );
}
......@@ -61,7 +61,7 @@ WEEGElectrodeLibrary WLoaderEEG::extractElectrodePositions()
std::getline( ifs, line );
if( !ifs.good() )
{
WLogger::getLogger()->addLogMessage( "Unexpected end of file: " + elcFileName, "EEG Loader", LL_ERROR );
WLogger::getLogger()->addLogMessage( "Unexpected end of file: " + elcFileName, "EEG Reader", LL_ERROR );
}
}
std::vector< std::string > tokens = su::tokenize( line );
......@@ -72,7 +72,7 @@ WEEGElectrodeLibrary WLoaderEEG::extractElectrodePositions()
std::getline( ifs, line );
if( !ifs.good() )
{
WLogger::getLogger()->addLogMessage( "Unexpected end of file: " + elcFileName, "EEG Loader", LL_ERROR );
WLogger::getLogger()->addLogMessage( "Unexpected end of file: " + elcFileName, "EEG Reader", LL_ERROR );
}
}
......@@ -83,7 +83,7 @@ WEEGElectrodeLibrary WLoaderEEG::extractElectrodePositions()
std::getline( ifs, line );
if( !ifs.good() )
{
WLogger::getLogger()->addLogMessage( "Unexpected end of file: " + elcFileName, "EEG Loader", LL_ERROR );
WLogger::getLogger()->addLogMessage( "Unexpected end of file: " + elcFileName, "EEG Reader", LL_ERROR );
}
else
{
......
......@@ -33,20 +33,20 @@
/**
* Abstract base class for all Loaders who handle with EEG data
* Abstract base class for all Readers who handle with EEG data
* \ingroup dataHandler
*/
class WLoaderEEG : public WReader
class WReaderEEG : public WReader
{
public:
protected:
/**
* Constructs basic eeg Loader with a file name.
* Constructs basic eeg Reader with a file name.
*
* \param fileName Path to be loaded
* \throw WDHIOFailure in case of an error
*/
explicit WLoaderEEG( std::string fileName ) throw( WDHIOFailure );
explicit WReaderEEG( std::string fileName ) throw( WDHIOFailure );
/**
* Load electrode positions from ELC file with same name
......
......@@ -34,15 +34,15 @@
#include "../../common/WStringUtils.h"
#include "../WEEG.h"
#include "../WSubject.h"
#include "WLoaderEEGASCII.h"
#include "WReaderEEGASCII.h"
WLoaderEEGASCII::WLoaderEEGASCII( std::string fileName )
: WLoaderEEG( fileName )
WReaderEEGASCII::WReaderEEGASCII( std::string fileName )
: WReaderEEG( fileName )
{
}
boost::shared_ptr< WDataSet > WLoaderEEGASCII::load()
boost::shared_ptr< WDataSet > WReaderEEGASCII::load()
{
std::ifstream in( m_fname.c_str() );
if( in.fail() )
......
......@@ -29,14 +29,14 @@
#include <boost/shared_ptr.hpp>
#include "WLoaderEEG.h"
#include "WReaderEEG.h"
/**
* Loader for EEG data in ASCII fromat.
* Reader for EEG data in ASCII fromat.
* \ingroup dataHandler
*/
class WLoaderEEGASCII : public WLoaderEEG
class WReaderEEGASCII : public WReaderEEG
{
public:
/**
......@@ -44,7 +44,7 @@ public:
* for the loader when executed in its own thread.
* \param fileName this file will be loaded
*/
explicit WLoaderEEGASCII( std::string fileName );
explicit WReaderEEGASCII( std::string fileName );
/**
* Loads the dataset.
......
......@@ -34,17 +34,17 @@ extern "C"
#include "../../common/WLogger.h"
#include "../WEEG.h"
#include "../exceptions/WDHNoSuchFile.h"
#include "WLoaderLibeep.h"
#include "WReaderLibeep.h"
WLoaderLibeep::WLoaderLibeep( std::string fileName )
: WLoaderEEG( fileName )
WReaderLibeep::WReaderLibeep( std::string fileName )
: WReaderEEG( fileName )
{
}
boost::shared_ptr< WDataSet > WLoaderLibeep::load()
boost::shared_ptr< WDataSet > WReaderLibeep::load()
{
wlog::debug( "Libeep Loader" ) << "Opening " << m_fname;
wlog::debug( "Libeep Reader" ) << "Opening " << m_fname;
// libeep needs the standard C locale to load float values from ASCII
setlocale( LC_NUMERIC, "C" );
......
......@@ -27,14 +27,14 @@
#include <string>
#include "WLoaderEEG.h"
#include "WReaderEEG.h"
/**
* Loader for the CNT format supported by the libeep library.
* Reader for the CNT format supported by the libeep library.
* \ingroup dataHandler
*/
class WLoaderLibeep : public WLoaderEEG
class WReaderLibeep : public WReaderEEG
{
public:
/**
......@@ -43,7 +43,7 @@ public:
*
* \param fileName this file will be loaded
*/
explicit WLoaderLibeep( std::string fileName );
explicit WReaderLibeep( std::string fileName );
virtual boost::shared_ptr< WDataSet > load();
protected:
......
......@@ -30,7 +30,7 @@
#include <vector>
#include <boost/shared_ptr.hpp>
#include "WLoaderNIfTI.h"
#include "WReaderNIfTI.h"
#include "../../common/WIOTools.h"
#include "../WDataSet.h"
#include "../WSubject.h"
......@@ -49,13 +49,13 @@
#include "../../common/WLogger.h"
WLoaderNIfTI::WLoaderNIfTI( std::string fileName )
WReaderNIfTI::WReaderNIfTI( std::string fileName )
: WReader( fileName )
{
}
template< typename T > std::vector< T > WLoaderNIfTI::copyArray( const T* dataArray, const size_t countVoxels,
template< typename T > std::vector< T > WReaderNIfTI::copyArray( const T* dataArray, const size_t countVoxels,
const size_t vDim )
{
std::vector< T > data( countVoxels * vDim );
......@@ -70,7 +70,7 @@ template< typename T > std::vector< T > WLoaderNIfTI::copyArray( const T* dataAr
}
wmath::WMatrix< double > WLoaderNIfTI::convertMatrix( const mat44& in )
wmath::WMatrix< double > WReaderNIfTI::convertMatrix( const mat44& in )
{
wmath::WMatrix< double > out( 4, 4 );
for( size_t i = 0; i < 4; ++i )
......@@ -83,7 +83,7 @@ wmath::WMatrix< double > WLoaderNIfTI::convertMatrix( const mat44& in )
return out;
}
boost::shared_ptr< WDataSet > WLoaderNIfTI::load()
boost::shared_ptr< WDataSet > WReaderNIfTI::load()
{
nifti_image* header = nifti_image_read( m_fname.c_str(), 0 );
......@@ -153,7 +153,7 @@ boost::shared_ptr< WDataSet > WLoaderNIfTI::load()
}
default:
wlog::error( "WLoaderNIfTI" ) << "unknown data type " << header->datatype << std::endl;
wlog::error( "WReaderNIfTI" ) << "unknown data type " << header->datatype << std::endl;
newValueSet = boost::shared_ptr< WValueSetBase >();
}
......@@ -169,13 +169,13 @@ boost::shared_ptr< WDataSet > WLoaderNIfTI::load()
// TODO(philips): polish WDataSetSegmentation for check in
// if ( !description.compare( "WDataSetSegmentation" ) )
// {
// wlog::debug( "WLoaderNIfTI" ) << "Load as segmentation" << std::endl;
// wlog::debug( "WReaderNIfTI" ) << "Load as segmentation" << std::endl;
// newDataSet = boost::shared_ptr< WDataSet >( new WDataSetSegmentation( newValueSet, newGrid ) );
// }
// else
if ( !description.compare( "WDataSetSphericalHarmonics" ) )
{
wlog::debug( "WLoaderNIfTI" ) << "Load as spherical harmonics" << std::endl;
wlog::debug( "WReaderNIfTI" ) << "Load as spherical harmonics" << std::endl;
newDataSet = boost::shared_ptr< WDataSet >( new WDataSetSphericalHarmonics( newValueSet, newGrid ) );
}
// unknown description
......
......@@ -36,15 +36,15 @@
#include "nifti/nifti1_io.h"
/**
* Loader for the NIfTI file format. For NIfTI just see http://nifti.nimh.nih.gov/.
* Reader for the NIfTI file format. For NIfTI just see http://nifti.nimh.nih.gov/.
* \ingroup dataHandler
*/
class WLoaderNIfTI : public WReader
class WReaderNIfTI : public WReader
{
/**
* Only UnitTests may be friends.
*/
friend class WLoaderNIfTITest;
friend class WReaderNIfTITest;
public:
/**
......@@ -52,7 +52,7 @@ public:
* for the loader when executed in its own thread.
* \param fileName this file will be loaded
*/
explicit WLoaderNIfTI( std::string fileName );
explicit WReaderNIfTI( std::string fileName );
/**
* Loads the dataset.
......
......@@ -36,10 +36,10 @@
#include "../../../dataHandler/WDataTexture3D.h"
#include "../../../dataHandler/WEEG2.h"
#include "../../../dataHandler/exceptions/WDHException.h"
#include "../../../dataHandler/io/WLoaderBiosig.h"
#include "../../../dataHandler/io/WLoaderEEGASCII.h"
#include "../../../dataHandler/io/WLoaderLibeep.h"
#include "../../../dataHandler/io/WLoaderNIfTI.h"
#include "../../../dataHandler/io/WReaderBiosig.h"
#include "../../../dataHandler/io/WReaderEEGASCII.h"
#include "../../../dataHandler/io/WReaderLibeep.h"
#include "../../../dataHandler/io/WReaderNIfTI.h"
#include "../../../dataHandler/io/WPagerEEGLibeep.h"
#include "../../../dataHandler/io/WReaderELC.h"
#include "../../../dataHandler/io/WReaderFiberVTK.h"
......@@ -328,7 +328,7 @@ void WMData::moduleMain()
m_isTexture = true;
WLoaderNIfTI niiLoader( fileName );
WReaderNIfTI niiLoader( fileName );
m_dataSet = niiLoader.load();
if( boost::shared_dynamic_cast< WDataSetScalar >( m_dataSet ) )
......@@ -366,12 +366,12 @@ void WMData::moduleMain()
}
else if( suffix == ".edf" )
{
WLoaderBiosig biosigLoader( fileName );
WReaderBiosig biosigLoader( fileName );
m_dataSet = biosigLoader.load();
}
else if( suffix == ".asc" )
{
WLoaderEEGASCII eegAsciiLoader( fileName );
WReaderEEGASCII eegAsciiLoader( fileName );
m_dataSet = eegAsciiLoader.load();
}
else if( suffix == ".cnt" )
......
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