Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
07c10bdd
Commit
07c10bdd
authored
Mar 11, 2010
by
schurade
Browse files
[Merge] with 66c32e9067fec18acd2d090d516596afc0ef0cfc
parents
f66c3df5
3d8b9410
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
687 additions
and
86 deletions
+687
-86
src/CMakeLists.txt
src/CMakeLists.txt
+43
-17
src/common/WThreadedRunner.cpp
src/common/WThreadedRunner.cpp
+0
-42
src/common/WThreadedRunner.h
src/common/WThreadedRunner.h
+0
-21
src/common/datastructures/WTriangleMesh.cpp
src/common/datastructures/WTriangleMesh.cpp
+11
-0
src/common/datastructures/WTriangleMesh.h
src/common/datastructures/WTriangleMesh.h
+37
-1
src/common/math/WMatrix.h
src/common/math/WMatrix.h
+23
-0
src/dataHandler/WDataSetSingle.cpp
src/dataHandler/WDataSetSingle.cpp
+55
-0
src/dataHandler/WDataSetSingle.h
src/dataHandler/WDataSetSingle.h
+9
-0
src/dataHandler/WEEGValueMatrix.h
src/dataHandler/WEEGValueMatrix.h
+37
-0
src/dataHandler/WGridRegular3D.cpp
src/dataHandler/WGridRegular3D.cpp
+38
-0
src/dataHandler/WGridRegular3D.h
src/dataHandler/WGridRegular3D.h
+27
-0
src/dataHandler/WValueSet.h
src/dataHandler/WValueSet.h
+2
-3
src/dataHandler/WValueSetBase.h
src/dataHandler/WValueSetBase.h
+11
-0
src/dataHandler/io/WPagerEEG.cpp
src/dataHandler/io/WPagerEEG.cpp
+43
-0
src/dataHandler/io/WPagerEEG.h
src/dataHandler/io/WPagerEEG.h
+72
-0
src/dataHandler/io/WPagerEEGLibeep.cpp
src/dataHandler/io/WPagerEEGLibeep.cpp
+136
-0
src/dataHandler/io/WPagerEEGLibeep.h
src/dataHandler/io/WPagerEEGLibeep.h
+73
-0
src/dataHandler/io/nifti/CMakeLists.txt
src/dataHandler/io/nifti/CMakeLists.txt
+10
-2
src/dataHandler/test/WDataSetSingle_test.h
src/dataHandler/test/WDataSetSingle_test.h
+28
-0
src/dataHandler/test/WGridRegular3D_test.h
src/dataHandler/test/WGridRegular3D_test.h
+32
-0
No files found.
src/CMakeLists.txt
View file @
07c10bdd
...
...
@@ -25,12 +25,22 @@ ENDIF()
#--------------------------
IF
(
CMAKE_GENERATOR MATCHES
"Visual Studio"
)
INCLUDE_DIRECTORIES
(
"
${
PROJECT_SOURCE_DIR
}
/common/platformDependent/visualStudio/"
)
OPTION
(
OW_USE_ZLIB
"Use zlib"
ON
)
IF
(
OW_USE_ZLIB
)
FIND_PACKAGE
(
ZLIB
)
ENDIF
(
OW_USE_ZLIB
)
ENDIF
()
# Package dependencies:
#----------------------
### BOOST ###
IF
(
CMAKE_GENERATOR MATCHES
"Visual Studio"
)
SET
(
Boost_USE_STATIC_LIBS ON
)
ENDIF
()
SET
(
Boost_USE_MULTITHREAD ON
)
# To see which boost libs we currently use, you may run the following command
...
...
@@ -64,19 +74,27 @@ ENDIF()
### OpenSceneGraph ###
SET
(
MIN_OSG_VERSION 2.8.0
)
FIND_PACKAGE
(
osg
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgUtil
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgDB
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgViewer
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgText
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgGA
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgSim
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
OpenThreads
${
MIN_OSG_VERSION
}
REQUIRED
)
SET
(
OPENSCENEGRAPH_LIBRARIES
${
OSGDB_LIBRARY
}
${
OSGTEXT_LIBRARY
}
${
OSGGA_LIBRARY
}
${
OSGUTIL_LIBRARY
}
${
OSGVIEWER_LIBRARY
}
${
OSG_LIBRARY
}
${
OSGSIM_LIBRARY
}
${
OPENTHREADS_LIBRARY
}
)
SET
(
OPENSCENEGRAPH_INCLUDE_DIRS
${
OSG_INCLUDE_DIR
}
${
OSGDB_INCLUDE_DIR
}
${
OSGTEXT_INCLUDE_DIR
}
${
OSGGA_INCLUDE_DIR
}
${
OSGVIEWER_INCLUDE_DIR
}
${
OSGUTIL_INCLUDE_DIR
}
${
OSGSIM_INCLUDE_DIR
}
${
OPENTHREADS_INCLUDE_DIR
}
)
# When new cmake version available >=2.6.4 we may use this the line below instead the stuff above
# FIND_PACKAGE( OpenSceneGraph 2.8.0 REQUIRED osgDB osgUtil osgGA osgViewer osgSim OpenThreads )
INCLUDE_DIRECTORIES
(
${
OPENSCENEGRAPH_INCLUDE_DIRS
}
)
IF
(
NOT CMAKE_GENERATOR MATCHES
"Visual Studio"
)
FIND_PACKAGE
(
osg
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgUtil
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgDB
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgViewer
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgText
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgGA
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
osgSim
${
MIN_OSG_VERSION
}
REQUIRED
)
FIND_PACKAGE
(
OpenThreads
${
MIN_OSG_VERSION
}
REQUIRED
)
SET
(
OPENSCENEGRAPH_LIBRARIES
${
OSGDB_LIBRARY
}
${
OSGTEXT_LIBRARY
}
${
OSGGA_LIBRARY
}
${
OSGUTIL_LIBRARY
}
${
OSGVIEWER_LIBRARY
}
${
OSG_LIBRARY
}
${
OSGSIM_LIBRARY
}
${
OPENTHREADS_LIBRARY
}
)
SET
(
OPENSCENEGRAPH_INCLUDE_DIRS
${
OSG_INCLUDE_DIR
}
${
OSGDB_INCLUDE_DIR
}
${
OSGTEXT_INCLUDE_DIR
}
${
OSGGA_INCLUDE_DIR
}
${
OSGVIEWER_INCLUDE_DIR
}
${
OSGUTIL_INCLUDE_DIR
}
${
OSGSIM_INCLUDE_DIR
}
${
OPENTHREADS_INCLUDE_DIR
}
)
# When new cmake version available >=2.6.4 we may use this the line below instead the stuff above
# FIND_PACKAGE( OpenSceneGraph 2.8.0 REQUIRED osgDB osgUtil osgGA osgViewer osgSim OpenThreads )
INCLUDE_DIRECTORIES
(
${
OPENSCENEGRAPH_INCLUDE_DIRS
}
)
ELSE
()
IF
(
NOT VERSION LESS 2.6.3
)
SET
(
CMAKE_PREFIX_PATH
"$ENV{ProgramFiles}/OpenSceneGraph"
)
ENDIF
()
FIND_PACKAGE
(
OpenSceneGraph
${
MIN_OSG_VERSION
}
REQUIRED osgUtil osgDB osgViewer osgText osgGA osgSim
)
INCLUDE_DIRECTORIES
(
${
OPENSCENEGRAPH_INCLUDE_DIRS
}
)
ENDIF
()
# other options:
#---------------
...
...
@@ -140,11 +158,19 @@ add_custom_target( fontsDirectoryConfiguration
)
#---------- shell scripts -------------
add_custom_target
(
binDirectoryConfiguration
ALL
COMMAND
${
CMAKE_COMMAND
}
-D OW_SOURCE_DIR:STRING=
${
PROJECT_SOURCE_DIR
}
-P
${
PROJECT_SOURCE_DIR
}
/../tools/CMakeModules/CopyShellScripts.cmake
COMMENT
"Put all shell scripts to the right place."
IF
(
CMAKE_GENERATOR MATCHES
"Visual Studio"
)
add_custom_target
(
binDirectoryConfiguration
ALL
COMMAND
${
CMAKE_COMMAND
}
-D OW_SOURCE_DIR:STRING=
${
PROJECT_SOURCE_DIR
}
-P
${
PROJECT_SOURCE_DIR
}
/../tools/CMakeModules/CopyShellScriptsWin.cmake
COMMENT
"Put all shell scripts to the right place."
)
ELSE
()
add_custom_target
(
binDirectoryConfiguration
ALL
COMMAND
${
CMAKE_COMMAND
}
-D OW_SOURCE_DIR:STRING=
${
PROJECT_SOURCE_DIR
}
-P
${
PROJECT_SOURCE_DIR
}
/../tools/CMakeModules/CopyShellScripts.cmake
COMMENT
"Put all shell scripts to the right place."
)
ENDIF
()
# Special targets:
#-------------------------------------------------------------------------------------------------------------
...
...
src/common/WThreadedRunner.cpp
View file @
07c10bdd
...
...
@@ -30,17 +30,11 @@
#include "WThreadedRunner.h"
WThreadedRunner
::
WThreadedRunner
()
:
#if !USE_BOOST_THREADS
OpenThreads
::
Thread
(),
#endif
m_shutdownFlag
(
new
WConditionOneShot
,
false
)
{
// initialize members
m_FinishRequested
=
false
;
m_Thread
=
NULL
;
#if !USE_BOOST_THREADS
m_firstRun
=
true
;
#endif
}
WThreadedRunner
::~
WThreadedRunner
()
...
...
@@ -48,44 +42,20 @@ WThreadedRunner::~WThreadedRunner()
// cleanup
// XXX is this working if thread already has finished?
// wait( true ); <-- no
#if USE_BOOST_THREADS
if
(
m_Thread
)
{
delete
m_Thread
;
}
#endif
}
void
WThreadedRunner
::
run
()
{
#if USE_BOOST_THREADS
m_Thread
=
new
boost
::
thread
(
boost
::
bind
(
&
WThreadedRunner
::
threadMain
,
this
)
);
#else
if
(
m_firstRun
)
{
m_firstRun
=
false
;
m_Thread
=
this
;
Init
();
start
();
}
else
{
threadMain
();
}
#endif
}
void
WThreadedRunner
::
run
(
THREADFUNCTION
f
)
{
#if USE_BOOST_THREADS
m_Thread
=
new
boost
::
thread
(
f
);
#else
m_firstRun
=
false
;
m_Thread
=
this
;
Init
();
start
();
f
();
#endif
}
void
WThreadedRunner
::
wait
(
bool
requestFinish
)
...
...
@@ -118,28 +88,16 @@ void WThreadedRunner::notifyStop()
void
WThreadedRunner
::
yield
()
const
{
#if USE_BOOST_THREADS
m_Thread
->
yield
();
#else
m_Thread
->
YieldCurrentThread
();
#endif
}
void
WThreadedRunner
::
sleep
(
const
int32_t
t
)
const
{
#if USE_BOOST_THREADS
boost
::
this_thread
::
sleep
(
boost
::
posix_time
::
seconds
(
t
)
);
#else
m_Thread
->
microSleep
(
1000000
*
t
);
#endif
}
void
WThreadedRunner
::
msleep
(
const
int32_t
t
)
const
{
#if USE_BOOST_THREADS
boost
::
this_thread
::
sleep
(
boost
::
posix_time
::
microseconds
(
t
)
);
#else
m_Thread
->
microSleep
(
t
);
#endif
}
src/common/WThreadedRunner.h
View file @
07c10bdd
...
...
@@ -27,22 +27,10 @@
#include <stdint.h>
#ifdef _MSC_VER
#define USE_BOOST_THREADS 0
#else
#define USE_BOOST_THREADS 1
#endif
#if !USE_BOOST_THREADS
#include <OpenThreads/Thread>
#endif
#include <boost/function.hpp>
#if USE_BOOST_THREADS
#include <boost/thread.hpp>
#include <boost/thread/thread.hpp>
#endif
#include "WFlag.h"
...
...
@@ -50,9 +38,6 @@
* Base class for all classes needing to be executed in a separate thread.
*/
class
WThreadedRunner
#if !USE_BOOST_THREADS
:
public
OpenThreads
::
Thread
#endif
{
public:
...
...
@@ -106,13 +91,7 @@ protected:
/**
* Thread instance.
*/
#if USE_BOOST_THREADS
boost
::
thread
*
m_Thread
;
#else
OpenThreads
::
Thread
*
m_Thread
;
bool
m_firstRun
;
#endif
/**
* True if thread should end execution. NOTE: do not use this. Use m_shutdownFlag instead.
...
...
src/common/datastructures/WTriangleMesh.cpp
View file @
07c10bdd
...
...
@@ -26,6 +26,17 @@
#include "WTriangleMesh.h"
// init _static_ member variable and provide a linker reference to it
boost
::
shared_ptr
<
WPrototyped
>
WTriangleMesh
::
m_prototype
=
boost
::
shared_ptr
<
WPrototyped
>
();
boost
::
shared_ptr
<
WPrototyped
>
WTriangleMesh
::
getPrototype
()
{
if
(
!
m_prototype
)
{
m_prototype
=
boost
::
shared_ptr
<
WPrototyped
>
(
new
WTriangleMesh
()
);
}
return
m_prototype
;
}
WTriangleMesh
::
WTriangleMesh
()
:
m_fastAddVertId
(
0
),
...
...
src/common/datastructures/WTriangleMesh.h
View file @
07c10bdd
...
...
@@ -25,10 +25,13 @@
#ifndef WTRIANGLEMESH_H
#define WTRIANGLEMESH_H
#include <string>
#include <vector>
#include "../math/WPosition.h"
#include "../math/WVector3D.h"
#include "../WTransferable.h"
/**
...
...
@@ -42,7 +45,7 @@ struct Triangle
/**
* Triangle mesh data structure allowing for convenient access of the elements.
*/
class
WTriangleMesh
class
WTriangleMesh
:
public
WTransferable
{
/**
* Only UnitTests may be friends.
...
...
@@ -60,6 +63,27 @@ public:
*/
~
WTriangleMesh
();
/**
* Gets the name of this prototype.
*
* \return the name.
*/
virtual
const
std
::
string
getName
()
const
;
/**
* Gets the description for this prototype.
*
* \return the description
*/
virtual
const
std
::
string
getDescription
()
const
;
/**
* Returns a prototype instantiated with the true type of the deriving class.
*
* \return the prototype.
*/
static
boost
::
shared_ptr
<
WPrototyped
>
getPrototype
();
/**
* \return Size of the vertex container.
*/
...
...
@@ -199,6 +223,8 @@ public:
void
computeVertNormals
();
protected:
static
boost
::
shared_ptr
<
WPrototyped
>
m_prototype
;
//!< The prototype as singleton.
private:
std
::
vector
<
wmath
::
WPosition
>
m_vertices
;
//!< All vertices of the mesh.
std
::
vector
<
Triangle
>
m_triangles
;
//!< All triangles of the mesh, given as groups of vertex indices.
...
...
@@ -231,4 +257,14 @@ inline size_t WTriangleMesh::getTriangleVertexId( size_t triId, size_t vertId )
{
return
m_triangles
[
triId
].
pointID
[
vertId
];
}
inline
const
std
::
string
WTriangleMesh
::
getName
()
const
{
return
"WTriangleMesh"
;
}
inline
const
std
::
string
WTriangleMesh
::
getDescription
()
const
{
return
"Triangle mesh data structure allowing for convenient access of the elements."
;
}
#endif // WTRIANGLEMESH_H
src/common/math/WMatrix.h
View file @
07c10bdd
...
...
@@ -57,6 +57,29 @@ public:
m_nbCols
=
newMatrix
.
m_nbCols
;
}
/**
* Makes the matix contain the identity matrix, i.e. 1 on the diagonal.
*/
WMatrix
&
makeIdentity
()
{
size_t
nbRows
=
this
->
size
()
/
m_nbCols
;
for
(
size_t
i
=
0
;
i
<
nbRows
;
++
i
)
{
for
(
size_t
j
=
0
;
j
<
m_nbCols
;
++
j
)
{
if
(
i
==
j
)
{
(
*
this
)(
i
,
j
)
=
1
;
}
else
{
(
*
this
)(
i
,
j
)
=
0
;
}
}
}
return
*
this
;
}
/**
* Get number of rows.
*/
...
...
src/dataHandler/WDataSetSingle.cpp
View file @
07c10bdd
...
...
@@ -23,11 +23,13 @@
//---------------------------------------------------------------------------
#include <string>
#include <vector>
#include "WDataTexture3D.h"
#include "WValueSet.h"
#include "WGrid.h"
#include "../common/WPrototyped.h"
#include "../common/WException.h"
#include "WDataSetSingle.h"
...
...
@@ -141,3 +143,56 @@ double WDataSetSingle::getValueAt( int x, int y, int z )
return
getValueAt
(
id
);
}
double
WDataSetSingle
::
interpolate
(
wmath
::
WPosition
pos
)
{
boost
::
shared_ptr
<
WGridRegular3D
>
grid
=
boost
::
shared_dynamic_cast
<
WGridRegular3D
>
(
m_grid
);
// TODO(wiebel): change this to eassert.
if
(
!
grid
)
{
throw
WException
(
"This data set has a grid whose type is not yet supported for interpolation."
);
}
// TODO(wiebel): change this to eassert.
if
(
grid
->
getTransformationMatrix
()
!=
wmath
::
WMatrix
<
double
>
(
4
,
4
).
makeIdentity
()
)
{
throw
WException
(
"Only feasible for untranslated grid so far."
);
}
// TODO(wiebel): change this to eassert.
if
(
!
(
m_valueSet
->
order
()
==
0
&&
m_valueSet
->
dimension
()
==
1
)
)
{
throw
WException
(
"Only implemented for scalar values so far."
);
}
std
::
vector
<
size_t
>
vertexIds
=
grid
->
getCellVertexIds
(
grid
->
getCellId
(
pos
)
);
wmath
::
WPosition
localPos
=
pos
-
grid
->
getPosition
(
vertexIds
[
0
]
);
double
lambdaX
=
localPos
[
0
]
/
grid
->
getOffsetX
();
double
lambdaY
=
localPos
[
1
]
/
grid
->
getOffsetY
();
double
lambdaZ
=
localPos
[
2
]
/
grid
->
getOffsetZ
();
std
::
vector
<
double
>
h
(
8
);
// lZ lY
// | /
// | 6___/_7
// |/: /|
// 4_:___5 |
// | :...|.|
// |.2 | 3
// |_____|/ ____lX
// 0 1
h
[
0
]
=
(
1
-
lambdaX
)
*
(
1
-
lambdaY
)
*
(
1
-
lambdaZ
);
h
[
1
]
=
(
lambdaX
)
*
(
1
-
lambdaY
)
*
(
1
-
lambdaZ
);
h
[
2
]
=
(
1
-
lambdaX
)
*
(
lambdaY
)
*
(
1
-
lambdaZ
);
h
[
3
]
=
(
lambdaX
)
*
(
lambdaY
)
*
(
1
-
lambdaZ
);
h
[
4
]
=
(
1
-
lambdaX
)
*
(
1
-
lambdaY
)
*
(
lambdaZ
);
h
[
5
]
=
(
lambdaX
)
*
(
1
-
lambdaY
)
*
(
lambdaZ
);
h
[
6
]
=
(
1
-
lambdaX
)
*
(
lambdaY
)
*
(
lambdaZ
);
h
[
7
]
=
(
lambdaX
)
*
(
lambdaY
)
*
(
lambdaZ
);
double
result
=
0
;
for
(
size_t
i
=
0
;
i
<
8
;
++
i
)
{
result
+=
h
[
i
]
*
getValueAt
(
vertexIds
[
i
]
);
}
return
result
;
}
src/dataHandler/WDataSetSingle.h
View file @
07c10bdd
...
...
@@ -101,6 +101,15 @@ public:
*/
template
<
typename
T
>
T
getValueAt
(
size_t
id
);
/**
* Interpolate the value fo the valueset at the given position
*
* \param pos The position for wich we would like to get a value.
*
* \return Scalar value for that given position
*/
double
interpolate
(
wmath
::
WPosition
pos
);
/**
* Get the value stored at a certain grid position of the data set in type double.
*
...
...
src/dataHandler/WEEGValueMatrix.h
0 → 100644
View file @
07c10bdd
//---------------------------------------------------------------------------
//
// 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 WEEGVALUEMATRIX_H
#define WEEGVALUEMATRIX_H
#include <vector>
/**
* Values of an EEG.
* Saved as vector of channels, and each channel is a vector of samples.
*/
typedef
std
::
vector
<
std
::
vector
<
double
>
>
WEEGValueMatrix
;
#endif // WEEGVALUEMATRIX_H
src/dataHandler/WGridRegular3D.cpp
View file @
07c10bdd
...
...
@@ -288,6 +288,44 @@ wmath::WValue< int > WGridRegular3D::getVoxelCoord( const wmath::WPosition& pos
return
result
;
}
size_t
WGridRegular3D
::
getCellId
(
const
wmath
::
WPosition
&
pos
)
const
{
// TODO(wiebel): change this to eassert.
if
(
m_matrix
!=
wmath
::
WMatrix
<
double
>
(
4
,
4
).
makeIdentity
()
)
{
throw
WException
(
"Only feasible for untranslated grid so far."
);
}
wmath
::
WPosition
posRelativeToOrigin
=
pos
-
m_origin
;
size_t
xCellId
=
floor
(
posRelativeToOrigin
[
0
]
/
m_offsetX
);
size_t
yCellId
=
floor
(
posRelativeToOrigin
[
1
]
/
m_offsetY
);
size_t
zCellId
=
floor
(
posRelativeToOrigin
[
2
]
/
m_offsetZ
);
return
xCellId
+
yCellId
*
(
m_nbPosX
-
1
)
+
zCellId
*
(
m_nbPosX
-
1
)
*
(
m_nbPosY
-
1
);
}
std
::
vector
<
size_t
>
WGridRegular3D
::
getCellVertexIds
(
size_t
cellId
)
const
{
std
::
vector
<
size_t
>
vertices
(
8
);
size_t
minVertexIdZ
=
cellId
/
(
(
m_nbPosX
-
1
)
*
(
m_nbPosY
-
1
)
);
size_t
remainderXY
=
cellId
-
minVertexIdZ
*
(
(
m_nbPosX
-
1
)
*
(
m_nbPosY
-
1
)
);
size_t
minVertexIdY
=
remainderXY
/
(
m_nbPosX
-
1
);
size_t
minVertexIdX
=
minVertexIdY
%
(
m_nbPosX
-
1
);
size_t
minVertexId
=
minVertexIdX
+
minVertexIdY
*
m_nbPosX
+
minVertexIdZ
*
m_nbPosX
*
m_nbPosY
;
vertices
[
0
]
=
minVertexId
;
vertices
[
1
]
=
minVertexId
+
1
;
vertices
[
2
]
=
minVertexId
+
m_nbPosX
;
vertices
[
3
]
=
minVertexId
+
m_nbPosX
+
1
;
vertices
[
4
]
=
minVertexId
+
m_nbPosX
*
m_nbPosY
;
vertices
[
5
]
=
minVertexId
+
m_nbPosX
*
m_nbPosY
+
1
;
vertices
[
6
]
=
minVertexId
+
m_nbPosX
*
m_nbPosY
+
m_nbPosX
;
vertices
[
7
]
=
minVertexId
+
m_nbPosX
*
m_nbPosY
+
m_nbPosX
+
1
;
return
vertices
;
}
boost
::
shared_ptr
<
std
::
vector
<
wmath
::
WPosition
>
>
WGridRegular3D
::
getVoxelVertices
(
const
wmath
::
WPosition
&
point
,
const
double
margin
)
const
{
typedef
boost
::
shared_ptr
<
std
::
vector
<
wmath
::
WPosition
>
>
ReturnType
;
...
...
src/dataHandler/WGridRegular3D.h
View file @
07c10bdd
...
...
@@ -312,6 +312,33 @@ public:
*/
wmath
::
WValue
<
int
>
getVoxelCoord
(
const
wmath
::
WPosition
&
pos
)
const
;
/**
* Computes the id of the cell containing the position pos.
*
* \param pos The position selecting the cell.
*/
size_t
getCellId
(
const
wmath
::
WPosition
&
pos
)
const
;
/**
* Computes the ids of the vertices of a cell given by its id.
*
* \param cellId The id of the cell we want to know ther vertices of.
* \verbatim
z-axis y-axis
| /
| 6___/_7
|/: /|
4_:___5 |
| :...|.|
|.2 | 3
|_____|/ ____x-axis
0 1
\endverbatim
*
*/
std
::
vector
<
size_t
>
getCellVertexIds
(
const
size_t
cellId
)
const
;
/**
* Computes the vertices for a voxel cuboid around the given point:
*
...
...
src/dataHandler/WValueSet.h
View file @
07c10bdd
...
...
@@ -82,7 +82,7 @@ public:
}
/**
* \return The number of integrals stored in this set.
* \return The number of integral
type
s stored in this set.
*/
virtual
size_t
rawSize
()
const
{
...
...
@@ -91,11 +91,10 @@ public:
/**
* \param i id of the scalar to retrieve
* \return The i-th
value
i
f
th
e
value set
is of
scalar
type
.
* \return The i-th
scalar stored
i
n
th
is
value set
. There are rawSize() such
scalar
s
.
*/
virtual
T
getScalar
(
size_t
i
)
const
{
assert
(
m_order
==
0
&&
m_dimension
==
1
);
return
m_data
[
i
];
}
...
...
src/dataHandler/WValueSetBase.h
View file @
07c10bdd
...
...
@@ -26,6 +26,7 @@
#define WVALUESETBASE_H
#include <cstddef>
#include <cmath>
#include "WDataHandlerEnums.h"
/**
...
...
@@ -75,6 +76,16 @@ public:
return
m_order
;
}
/**
* Returns the number of elements of type T per value.
* \note this is dimension to the power of order.
* \return number of elements per value
*/
virtual
size_t
elementsPerValue
()
const
{
return
static_cast
<
size_t
>
(
std
::
pow
(
static_cast
<
double
>
(
m_dimension
),
static_cast
<
int
>
(
m_order
)
)
);
}
/**
* \return Dimension of the values in this ValueSet
*/
...
...
src/dataHandler/io/WPagerEEG.cpp
0 → 100644
View file @
07c10bdd
//---------------------------------------------------------------------------
//
// 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