Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
a3666615
Commit
a3666615
authored
Nov 10, 2009
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CHANGE] - updated module communication and infrastructure
parent
b7b2264f
Changes
42
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
366 additions
and
722 deletions
+366
-722
src/OpenWalnut.cpp
src/OpenWalnut.cpp
+1
-0
src/common/WProperties.h
src/common/WProperties.h
+6
-0
src/common/WThreadedRunner.cpp
src/common/WThreadedRunner.cpp
+10
-1
src/common/WThreadedRunner.h
src/common/WThreadedRunner.h
+16
-0
src/dataHandler/WDataHandler.cpp
src/dataHandler/WDataHandler.cpp
+0
-27
src/dataHandler/WDataHandler.h
src/dataHandler/WDataHandler.h
+0
-20
src/dataHandler/WLoader.cpp
src/dataHandler/WLoader.cpp
+0
-2
src/dataHandler/WLoader.h
src/dataHandler/WLoader.h
+4
-4
src/dataHandler/WLoaderManager.cpp
src/dataHandler/WLoaderManager.cpp
+0
-89
src/dataHandler/WLoaderManager.h
src/dataHandler/WLoaderManager.h
+0
-51
src/dataHandler/io/WLoaderBiosig.cpp
src/dataHandler/io/WLoaderBiosig.cpp
+2
-5
src/dataHandler/io/WLoaderBiosig.h
src/dataHandler/io/WLoaderBiosig.h
+5
-4
src/dataHandler/io/WLoaderEEGASCII.cpp
src/dataHandler/io/WLoaderEEGASCII.cpp
+3
-1
src/dataHandler/io/WLoaderEEGASCII.h
src/dataHandler/io/WLoaderEEGASCII.h
+6
-3
src/dataHandler/io/WLoaderFibers.cpp
src/dataHandler/io/WLoaderFibers.cpp
+2
-1
src/dataHandler/io/WLoaderFibers.h
src/dataHandler/io/WLoaderFibers.h
+4
-3
src/dataHandler/io/WLoaderNIfTI.cpp
src/dataHandler/io/WLoaderNIfTI.cpp
+3
-2
src/dataHandler/io/WLoaderNIfTI.h
src/dataHandler/io/WLoaderNIfTI.h
+4
-3
src/dataHandler/io/test/WLoaderEEGASCII_test.h
src/dataHandler/io/test/WLoaderEEGASCII_test.h
+1
-1
src/dataHandler/io/test/WLoaderFibers_test.h
src/dataHandler/io/test/WLoaderFibers_test.h
+1
-1
src/dataHandler/test/WLoaderManager_test.h
src/dataHandler/test/WLoaderManager_test.h
+0
-75
src/dataHandler/test/WLoader_test.h
src/dataHandler/test/WLoader_test.h
+2
-1
src/gui/WGUI.cpp
src/gui/WGUI.cpp
+6
-0
src/gui/WGUI.h
src/gui/WGUI.h
+7
-0
src/kernel/WKernel.cpp
src/kernel/WKernel.cpp
+18
-66
src/kernel/WKernel.h
src/kernel/WKernel.h
+0
-5
src/kernel/WModule.cpp
src/kernel/WModule.cpp
+12
-3
src/kernel/WModule.h
src/kernel/WModule.h
+18
-0
src/kernel/WModuleContainer.cpp
src/kernel/WModuleContainer.cpp
+21
-7
src/kernel/WModuleContainer.h
src/kernel/WModuleContainer.h
+19
-0
src/kernel/WModuleFactory.cpp
src/kernel/WModuleFactory.cpp
+6
-5
src/modules/coordinateSystem/WMCoordinateSystem.cpp
src/modules/coordinateSystem/WMCoordinateSystem.cpp
+2
-1
src/modules/coordinateSystem/WMCoordinateSystem.h
src/modules/coordinateSystem/WMCoordinateSystem.h
+0
-1
src/modules/data/WMData.cpp
src/modules/data/WMData.cpp
+113
-191
src/modules/data/WMData.h
src/modules/data/WMData.h
+44
-7
src/modules/data/WMData2.cpp
src/modules/data/WMData2.cpp
+0
-96
src/modules/eegTest/WMEEGTest.cpp
src/modules/eegTest/WMEEGTest.cpp
+24
-29
src/modules/eegTest/WMEEGTest.h
src/modules/eegTest/WMEEGTest.h
+0
-6
src/modules/fiberClustering/WMFiberClustering.cpp
src/modules/fiberClustering/WMFiberClustering.cpp
+0
-1
src/modules/fiberCulling/WMFiberCulling.cpp
src/modules/fiberCulling/WMFiberCulling.cpp
+0
-1
src/modules/fiberDisplay/WMFiberDisplay.cpp
src/modules/fiberDisplay/WMFiberDisplay.cpp
+0
-1
src/modules/navSlices/WMNavSlices.cpp
src/modules/navSlices/WMNavSlices.cpp
+6
-8
No files found.
src/OpenWalnut.cpp
View file @
a3666615
...
...
@@ -64,6 +64,7 @@ int main( int argc, char* argv[] )
// init the kernel
WKernel
kernel
=
WKernel
(
argc
,
argv
,
gui
);
kernel
.
getRootContainer
()
->
getModuleReadySignal
()
->
connect
(
boost
::
bind
(
&
WGUI
::
slotAddDatasetToBrowser
,
gui
,
_1
)
);
return
kernel
.
run
();
}
src/common/WProperties.h
View file @
a3666615
...
...
@@ -112,6 +112,8 @@ public:
{
return
findProp
(
prop
)
->
getValue
<
T
>
();
}
// TODO(schurade): do not use NULL as return value in this case. Throw exception instead.
return
0
;
}
...
...
@@ -121,6 +123,8 @@ public:
{
return
findProp
(
prop
)
->
getMin
<
T
>
();
}
// TODO(schurade): do not use NULL as return value in this case. Throw exception instead.
return
0
;
}
...
...
@@ -130,6 +134,8 @@ public:
{
return
findProp
(
prop
)
->
getMax
<
T
>
();
}
// TODO(schurade): do not use NULL as return value in this case. Throw exception instead.
return
0
;
}
...
...
src/common/WThreadedRunner.cpp
View file @
a3666615
...
...
@@ -49,12 +49,21 @@ void WThreadedRunner::wait( bool requestFinish )
{
if
(
requestFinish
)
{
m_FinishRequested
=
requestFinish
;
// first notify
notifyStop
();
// then signal it
m_FinishRequested
=
requestFinish
;
m_stopCondition
.
notify_all
();
}
m_Thread
->
join
();
}
void
WThreadedRunner
::
waitForStop
()
{
m_stopCondition
.
wait
(
m_stopConditionMutex
);
}
void
WThreadedRunner
::
threadMain
()
{
}
...
...
src/common/WThreadedRunner.h
View file @
a3666615
...
...
@@ -25,6 +25,7 @@
#ifndef WTHREADEDRUNNER_H
#define WTHREADEDRUNNER_H
#include <boost/thread.hpp>
#include <boost/thread/thread.hpp>
/**
...
...
@@ -91,6 +92,21 @@ protected:
*/
void
sleep
(
const
int
t
)
const
;
/**
* Let the thread sleep until a stop request was given.
*/
void
waitForStop
();
/**
* Condition mutex used by m_stopCondition.
*/
boost
::
mutex
m_stopConditionMutex
;
/**
* Condition getting fired whenever the thread should quit. This is useful for waiting for stop requests.
*/
boost
::
condition_variable_any
m_stopCondition
;
private:
};
...
...
src/dataHandler/WDataHandler.cpp
View file @
a3666615
...
...
@@ -29,7 +29,6 @@
#include "WDataHandler.h"
#include "WSubject.h"
#include "exceptions/WDHNoSuchDataSet.h"
#include "WLoaderManager.h"
WDataHandler
::
WDataHandler
()
{
...
...
@@ -58,29 +57,3 @@ unsigned int WDataHandler::getNumberOfSubjects() const
return
m_subjects
.
size
();
}
void
WDataHandler
::
loadDataSets
(
std
::
vector
<
std
::
string
>
fileNames
)
{
WLoaderManager
lm
;
for
(
size_t
i
=
0
;
i
<
fileNames
.
size
()
;
++
i
)
{
try
{
lm
.
load
(
fileNames
[
i
],
shared_from_this
()
);
}
catch
(
WDHException
e
)
{
std
::
cerr
<<
"Error :: DataHandler :: "
<<
e
.
what
()
<<
std
::
endl
;
}
}
}
void
WDataHandler
::
signalLoadFinished
(
boost
::
shared_ptr
<
WDataSet
>
data
)
{
m_signalAddDataset
(
data
);
}
boost
::
signal1
<
void
,
boost
::
shared_ptr
<
WDataSet
>
>*
WDataHandler
::
getSignalAddDataset
()
{
return
&
m_signalAddDataset
;
}
src/dataHandler/WDataHandler.h
View file @
a3666615
...
...
@@ -77,21 +77,6 @@ public:
*/
unsigned
int
getNumberOfSubjects
()
const
;
/**
* Calls WLoaderManager to load the given input file.
*/
void
loadDataSets
(
std
::
vector
<
std
::
string
>
fileNames
);
/**
* is called from a loader object and signals a pointer to the loaded object
*/
void
signalLoadFinished
(
boost
::
shared_ptr
<
WDataSet
>
data
);
/**
*
*/
boost
::
signal1
<
void
,
boost
::
shared_ptr
<
WDataSet
>
>*
getSignalAddDataset
();
protected:
private:
...
...
@@ -99,11 +84,6 @@ private:
* A container for all WSubjects.
*/
std
::
vector
<
boost
::
shared_ptr
<
WSubject
>
>
m_subjects
;
/**
* boost signal object for signaling the addition of a dataset to the datahandler
*/
boost
::
signal1
<
void
,
boost
::
shared_ptr
<
WDataSet
>
>
m_signalAddDataset
;
};
/**
...
...
src/dataHandler/WLoader.cpp
View file @
a3666615
...
...
@@ -56,6 +56,4 @@ void WLoader::commitDataSet( boost::shared_ptr< WDataSet > data )
subject
=
m_dataHandler
->
getSubject
(
0
);
}
subject
->
addDataSet
(
data
);
m_dataHandler
->
signalLoadFinished
(
data
);
}
src/dataHandler/WLoader.h
View file @
a3666615
...
...
@@ -53,11 +53,11 @@ public:
};
/**
*
This function is automatically called when creating a new thread for the
*
loader with boost::thread. The method is pure virtual here to ensure
*
that subclasses implement it
.
*
Loads the dataset.
*
*
\return the dataset loaded
.
*/
virtual
void
operator
()
()
=
0
;
virtual
boost
::
shared_ptr
<
WDataSet
>
load
()
=
0
;
protected:
/**
...
...
src/dataHandler/WLoaderManager.cpp
deleted
100644 → 0
View file @
b7b2264f
//---------------------------------------------------------------------------
//
// 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 <iostream>
#include <string>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#include "WLoaderManager.h"
#include "exceptions/WDHException.h"
#include "io/WLoaderNIfTI.h"
#include "io/WLoaderBiosig.h"
#include "io/WLoaderEEGASCII.h"
#include "io/WLoaderFibers.h"
std
::
string
getSuffix
(
std
::
string
name
)
{
boost
::
filesystem
::
path
p
(
name
);
return
p
.
extension
();
}
void
WLoaderManager
::
load
(
std
::
string
fileName
,
boost
::
shared_ptr
<
WDataHandler
>
dataHandler
)
throw
(
WDHException
)
{
std
::
string
suffix
=
getSuffix
(
fileName
);
if
(
suffix
==
".nii"
||
suffix
==
".gz"
)
{
if
(
suffix
==
".gz"
)
// it may be a NIfTI file too
{
boost
::
filesystem
::
path
p
(
fileName
);
p
.
replace_extension
(
""
);
suffix
=
getSuffix
(
p
.
string
()
);
assert
(
suffix
==
".nii"
&&
"currently only nii files may be gzipped"
);
}
WLoaderNIfTI
niiLoader
(
fileName
,
dataHandler
);
boost
::
thread
loaderThread
(
niiLoader
);
}
else
if
(
suffix
==
".edf"
)
{
WLoaderBiosig
biosigLoader
(
fileName
,
dataHandler
);
boost
::
thread
loaderThread
(
biosigLoader
);
}
else
if
(
suffix
==
".asc"
)
{
WLoaderEEGASCII
eegAsciiLoader
(
fileName
,
dataHandler
);
boost
::
thread
loaderThread
(
eegAsciiLoader
);
}
else
if
(
suffix
==
".vtk"
)
{
// This is a dummy implementation.
// You need to provide a real implementation here if you want to load vtk.
std
::
cout
<<
"VTK not implemented yet"
<<
std
::
endl
;
assert
(
0
);
}
else
if
(
suffix
==
".fib"
)
{
WLoaderFibers
fibLoader
(
fileName
,
dataHandler
);
boost
::
thread
loaderThread
(
fibLoader
);
}
else
{
throw
WDHException
(
"Unknown file type: '"
+
suffix
+
"'"
);
}
}
src/dataHandler/WLoaderManager.h
deleted
100644 → 0
View file @
b7b2264f
//---------------------------------------------------------------------------
//
// 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 WLOADERMANAGER_H
#define WLOADERMANAGER_H
#include <string>
#include <boost/shared_ptr.hpp>
#include "exceptions/WDHException.h"
class
WDataHandler
;
/**
* Decouples file loading from the rest of OpenWalnut into a single thread.
* \ingroup dataHandler
*/
class
WLoaderManager
{
public:
/**
* Selects correct loader for fileName and creates loader thread.
*/
void
load
(
std
::
string
fileName
,
boost
::
shared_ptr
<
WDataHandler
>
dataHandler
)
throw
(
WDHException
);
protected:
private:
};
#endif // WLOADERMANAGER_H
src/dataHandler/io/WLoaderBiosig.cpp
View file @
a3666615
...
...
@@ -56,7 +56,7 @@ void WLoaderBiosig::fillSegment( std::vector<std::vector<double> >* segment, bio
}
}
void
WLoaderBiosig
::
biosigLoader
()
boost
::
shared_ptr
<
WDataSet
>
WLoaderBiosig
::
load
()
{
std
::
cout
<<
"BIOSIGLOADER"
<<
std
::
endl
;
hd
=
sopen
(
m_fileName
.
c_str
(),
"r"
,
0
);
...
...
@@ -131,9 +131,6 @@ void WLoaderBiosig::biosigLoader()
std
::
cout
<<
"BIOSIG loading done."
<<
std
::
endl
;
std
::
cout
<<
"==================================="
<<
std
::
endl
;
return
eeg
;
}
void
WLoaderBiosig
::
operator
()()
{
biosigLoader
();
}
src/dataHandler/io/WLoaderBiosig.h
View file @
a3666615
...
...
@@ -49,13 +49,14 @@ public:
WLoaderBiosig
(
std
::
string
fileName
,
boost
::
shared_ptr
<
WDataHandler
>
dataHandler
);
/**
* This function is automatically called when creating a new thread for the
* loader with boost::thread.
* Loads the dataset.
*
* \return the dataset loaded.
*/
virtual
void
operator
()();
virtual
boost
::
shared_ptr
<
WDataSet
>
load
();
protected:
private:
void
biosigLoader
();
void
fillSegment
(
std
::
vector
<
std
::
vector
<
double
>
>*
segment
,
biosig_data_type
*
data
);
/**
...
...
src/dataHandler/io/WLoaderEEGASCII.cpp
View file @
a3666615
...
...
@@ -39,7 +39,7 @@ WLoaderEEGASCII::WLoaderEEGASCII( std::string fileName, boost::shared_ptr< WData
{
}
void
WLoaderEEGASCII
::
operator
()
()
boost
::
shared_ptr
<
WDataSet
>
WLoaderEEGASCII
::
load
()
{
std
::
ifstream
in
(
m_fileName
.
c_str
()
);
if
(
in
.
fail
()
)
...
...
@@ -84,4 +84,6 @@ void WLoaderEEGASCII::operator()()
boost
::
shared_ptr
<
WEEG
>
eeg
=
boost
::
shared_ptr
<
WEEG
>
(
new
WEEG
(
segments
,
lib
,
labels
)
);
eeg
->
setFileName
(
m_fileName
);
commitDataSet
(
eeg
);
return
eeg
;
}
src/dataHandler/io/WLoaderEEGASCII.h
View file @
a3666615
...
...
@@ -45,10 +45,13 @@ public:
WLoaderEEGASCII
(
std
::
string
fileName
,
boost
::
shared_ptr
<
WDataHandler
>
dataHandler
);
/**
* This function is automatically called when creating a new thread for the
* loader with boost::thread.
* Loads the dataset.
*
* \return the dataset loaded.
*/
virtual
void
operator
()();
virtual
boost
::
shared_ptr
<
WDataSet
>
load
();
void
operator
()();
protected:
private:
...
...
src/dataHandler/io/WLoaderFibers.cpp
View file @
a3666615
...
...
@@ -54,7 +54,7 @@ WLoaderFibers::~WLoaderFibers() throw()
{
}
void
WLoaderFibers
::
operator
()()
throw
()
boost
::
shared_ptr
<
WDataSet
>
WLoaderFibers
::
load
()
{
using
boost
::
shared_ptr
;
using
std
::
vector
;
...
...
@@ -81,6 +81,7 @@ void WLoaderFibers::operator()() throw()
commitDataSet
(
fibers
);
assert
(
!
m_ifs
->
is_open
()
);
return
fibers
;
}
void
WLoaderFibers
::
readHeader
()
throw
(
WDHIOFailure
,
WDHException
)
...
...
src/dataHandler/io/WLoaderFibers.h
View file @
a3666615
...
...
@@ -61,10 +61,11 @@ public:
virtual
~
WLoaderFibers
()
throw
();
/**
* This function is automatically called when creating a new thread for the
* loader with boost::thread. It calls the methods of the NIfTI I/O library.
* Loads the dataset.
*
* \return the dataset loaded.
*/
virtual
void
operator
()()
throw
();
virtual
boost
::
shared_ptr
<
WDataSet
>
load
();
protected:
/**
...
...
src/dataHandler/io/WLoaderNIfTI.cpp
View file @
a3666615
...
...
@@ -73,8 +73,7 @@ wmath::WMatrix< double > WLoaderNIfTI::convertMatrix( const mat44& in )
return
out
;
}
void
WLoaderNIfTI
::
operator
()()
boost
::
shared_ptr
<
WDataSet
>
WLoaderNIfTI
::
load
()
{
nifti_image
*
header
=
nifti_image_read
(
m_fileName
.
c_str
(),
0
);
int
columns
=
header
->
dim
[
1
];
...
...
@@ -142,6 +141,8 @@ void WLoaderNIfTI::operator()()
boost
::
shared_ptr
<
WDataSet
>
newDataSet
=
boost
::
shared_ptr
<
WDataSet
>
(
new
WDataSetSingle
(
newValueSet
,
newGrid
)
);
newDataSet
->
setFileName
(
m_fileName
);
commitDataSet
(
newDataSet
);
return
newDataSet
;
}
...
...
src/dataHandler/io/WLoaderNIfTI.h
View file @
a3666615
...
...
@@ -50,10 +50,11 @@ public:
WLoaderNIfTI
(
std
::
string
fileName
,
boost
::
shared_ptr
<
WDataHandler
>
dataHandler
);
/**
* This function is automatically called when creating a new thread for the
* loader with boost::thread. It calls the methods of the NIfTI I/O library.
* Loads the dataset.
*
* \return the dataset loaded.
*/
virtual
void
operator
()
();
virtual
boost
::
shared_ptr
<
WDataSet
>
load
();
protected:
private:
...
...
src/dataHandler/io/test/WLoaderEEGASCII_test.h
View file @
a3666615
...
...
@@ -51,7 +51,7 @@ public:
TS_ASSERT_EQUALS
(
dataHandler
->
getNumberOfSubjects
(),
0
);
WLoaderEEGASCII
eegASCIILoader
(
fileName
,
dataHandler
);
boost
::
thread
loaderThread
(
eegASCIILoader
);
eegASCIILoader
.
load
(
);
std
::
clock_t
startTime
;
startTime
=
std
::
clock
();
...
...
src/dataHandler/io/test/WLoaderFibers_test.h
View file @
a3666615
...
...
@@ -276,7 +276,7 @@ public:
{
TS_ASSERT_EQUALS
(
m_dataHandler
->
getNumberOfSubjects
(),
0
);
WLoaderFibers
loader
(
"fixtures/Fibers/valid_small_example.fib"
,
m_dataHandler
);
loader
();
loader
.
load
();
TS_ASSERT_EQUALS
(
m_dataHandler
->
getNumberOfSubjects
(),
1
);
}
...
...
src/dataHandler/test/WLoaderManager_test.h
deleted
100644 → 0
View file @
b7b2264f
//---------------------------------------------------------------------------
//
// 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 WLOADERMANAGER_TEST_H
#define WLOADERMANAGER_TEST_H
#include <ctime>
#include <string>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <boost/timer.hpp>
#include <cxxtest/TestSuite.h>
#include "../WDataHandler.h"
#include "../WLoaderManager.h"
#include "../WDataSet.h"
/**
* Testsuite for WLoaderManager.
*/
class
WLoaderManagerTest
:
public
CxxTest
::
TestSuite
{
public:
/**
* The load routine should manage to select the appropriate WLoader class
* for a file type.
*/
void
testLoad
(
void
)
{
std
::
string
fileName
=
"fixtures/scalar_signed_short.nii.gz"
;
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
->
getNumberOfSubjects
(),
0
);
WLoaderManager
testLoaderManager
;
testLoaderManager
.
load
(
fileName
,
dataHandler
);
std
::
clock_t
startTime
;
startTime
=
std
::
clock
();
std
::
clock_t
elapsedTime
=
0
;
while
(
dataHandler
->
getNumberOfSubjects
()
==
0
&&
(
elapsedTime
/
static_cast
<
double
>
(
CLOCKS_PER_SEC
)
)
<
4
)
{
elapsedTime
=
std
::
clock
()
-
startTime
;
}
// 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
);
}
};
#endif // WLOADERMANAGER_TEST_H
src/dataHandler/test/WLoader_test.h
View file @
a3666615
...
...
@@ -30,6 +30,7 @@
#include <cxxtest/TestSuite.h>
#include "../WLoader.h"
#include "../WDataSet.h"
/**
* Just a dummy for testing the base class
...
...
@@ -42,7 +43,7 @@ public:
{
}
virtual
void
operator
()
()
virtual
boost
::
shared_ptr
<
WDataSet
>
load
()
{
}
};
...
...
src/gui/WGUI.cpp
View file @
a3666615
...
...
@@ -27,3 +27,9 @@
WGUI
::~
WGUI
()
{
}
void
WGUI
::
slotAddDatasetToBrowser
(
boost
::
shared_ptr
<
WModule
>
module
)
{
addDatasetToBrowser
(
module
,
0
);
}
src/gui/WGUI.h
View file @
a3666615
...
...
@@ -52,6 +52,13 @@ public:
*/
virtual
void
createMainWindow
()
=
0
;
/**
* Slot gets called whenever a new module is added.
*
* \param module
*/
virtual
void
slotAddDatasetToBrowser
(
boost
::
shared_ptr
<
WModule
>
module
);
/**
* adds a dataset to the dataset browser for a give subject
*/
...
...
src/kernel/WKernel.cpp
View file @
a3666615
...
...
@@ -35,12 +35,6 @@
#include "WModule.h"
#include "WModuleFactory.h"
#include "../modules/data/WMData.hpp"
#include "../modules/navSlices/WMNavSlices.h"
#include "../modules/coordinateSystem/WMCoordinateSystem.h"
#include "../modules/fiberDisplay/WMFiberDisplay.h"
#include "../modules/fiberCulling/WMFiberCulling.h"
#include "../modules/fiberClustering/WMFiberClustering.h"
#include "../common/WException.h"
#include "../graphicsEngine/WGraphicsEngine.h"
...
...
@@ -66,8 +60,7 @@ WKernel::WKernel( int argc, char* argv[], boost::shared_ptr< WGUI > gui )
// get module factory
m_moduleFactory
=
WModuleFactory
::
getModuleFactory
();
m_moduleContainer
=
boost
::
shared_ptr
<
WModuleContainer
>
(
new
WModuleContainer
(
"KernelRootContainer"
,
"Root module container in Kernel."
)
);
m_moduleContainer
=
boost
::
shared_ptr
<
WModuleContainer
>
();
// init GE, DataHandler, ...
init
();
...
...
@@ -145,56 +138,19 @@ int WKernel::run()
// run? data handler stuff?
// **************************************************************************************************************************
// This part will be exchanged by some kind of ModuleContainer managing module execution.
// TODO(ebaum): replace by ModuleContainer
// **************************************************************************************************************************
// run module execution threads
// TODO(ebaum): after having modules loaded they should be started here.
// currently this is just the test module
/*
WLogger::getLogger()->addLogMessage( "*** Starting modules:", "Kernel", LL_DEBUG );
for( std::list< boost::shared_ptr< WModule > >::iterator list_iter = m_modules.begin(); list_iter != m_modules.end();