Commit 13c15080 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[CHANGE] Loaders automatically load their fields into the first subject now.

This will be the case until we have correct support for detecting the
corrsponding subject for the loaded data.
parent 369de43a
......@@ -34,14 +34,14 @@ 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< const WSubject > WDataHandler::operator[]( size_t subjectId ) const
boost::shared_ptr< WSubject > WDataHandler::operator[]( size_t subjectId ) const
{
return getSubject( subjectId );
}
......
......@@ -55,13 +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< const WSubject > operator[]( size_t subjectId ) const;
boost::shared_ptr< WSubject > operator[]( size_t subjectId ) const;
/**
* Insert a new WSubject referenced by a pointer.
......
......@@ -126,11 +126,20 @@ void WLoaderBiosig::biosigLoader()
}
boost::shared_ptr< WEEG > eeg = boost::shared_ptr< WEEG >( new WEEG( segments, lib, labels ) );
boost::shared_ptr< WSubject > subject; // TODO( wiebel ): this is a dummy
// TODO( wiebel ): this is a dummy implementation. We need to fix
// this as soon as we can distinguish which data belongs to which subject.
boost::shared_ptr< WSubject > subject;
if( m_dataHandler->getNumberOfSubjects() == 0 )
{
subject = boost::shared_ptr< WSubject >( new WSubject );
m_dataHandler->addSubject( subject );
}
else
{
subject = m_dataHandler->getSubject( 0 );
}
subject->addDataSet( eeg );
m_dataHandler->addSubject( subject );
std::cout << "BIOSIG loading done." << std::endl;
std::cout << "===================================" << std::endl;
}
......
......@@ -83,9 +83,17 @@ void WLoaderEEGASCII::operator()()
boost::shared_ptr< WEEG > eeg = boost::shared_ptr< WEEG >( new WEEG( segments, lib, labels ) );
// TODO( wiebel ): this is a dummy
boost::shared_ptr< WSubject > subject = boost::shared_ptr< WSubject >( new WSubject );
// TODO( wiebel ): this is a dummy implementation. We need to fix
// this as soon as we can distinguish which data belongs to which subject.
boost::shared_ptr< WSubject > subject;
if( m_dataHandler->getNumberOfSubjects() == 0 )
{
subject = boost::shared_ptr< WSubject >( new WSubject );
m_dataHandler->addSubject( subject );
}
else
{
subject = m_dataHandler->getSubject( 0 );
}
subject->addDataSet( eeg );
m_dataHandler->addSubject( subject );
}
......@@ -133,11 +133,19 @@ void WLoaderNIfTI::operator()()
boost::shared_ptr< WDataSet > newDataSet = boost::shared_ptr< WDataSet >(
new WDataSetSingle( newValueSet, newGrid ) );
// TODO( wiebel ): this is a dummy
boost::shared_ptr< WSubject > subject = boost::shared_ptr< WSubject >( new WSubject );
// TODO( wiebel ): this is a dummy implementation. We need to fix
// this as soon as we can distinguish which data belongs to which subject.
boost::shared_ptr< WSubject > subject;
if( m_dataHandler->getNumberOfSubjects() == 0 )
{
subject = boost::shared_ptr< WSubject >( new WSubject );
m_dataHandler->addSubject( subject );
}
else
{
subject = m_dataHandler->getSubject( 0 );
}
subject->addDataSet( newDataSet );
m_dataHandler->addSubject( subject );
}
......
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