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
874e625f
Commit
874e625f
authored
Apr 14, 2011
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Plain Diff
[MERGE]
parents
8281c831
e1645ebf
Changes
74
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
74 changed files
with
2631 additions
and
533 deletions
+2631
-533
src/common/WPropertyTypes.h
src/common/WPropertyTypes.h
+82
-5
src/common/WSharedObject.h
src/common/WSharedObject.h
+2
-2
src/common/math/WLinearAlgebraFunctions.cpp
src/common/math/WLinearAlgebraFunctions.cpp
+22
-23
src/common/math/WLinearAlgebraFunctions.h
src/common/math/WLinearAlgebraFunctions.h
+3
-3
src/common/math/WMatrix.h
src/common/math/WMatrix.h
+72
-1
src/common/math/WMatrix4x4.h
src/common/math/WMatrix4x4.h
+7
-5
src/common/math/WSymmetricSphericalHarmonic.cpp
src/common/math/WSymmetricSphericalHarmonic.cpp
+78
-65
src/common/math/WSymmetricSphericalHarmonic.h
src/common/math/WSymmetricSphericalHarmonic.h
+19
-18
src/common/math/WValue.h
src/common/math/WValue.h
+27
-0
src/common/math/WVector3D.cpp
src/common/math/WVector3D.cpp
+124
-0
src/common/math/WVector3D.h
src/common/math/WVector3D.h
+116
-112
src/common/math/test/WLinearAlgebraFunctions_test.h
src/common/math/test/WLinearAlgebraFunctions_test.h
+47
-8
src/common/math/test/WSymmetricSphericalHarmonic_test.h
src/common/math/test/WSymmetricSphericalHarmonic_test.h
+24
-12
src/dataHandler/WDataSetSphericalHarmonics.cpp
src/dataHandler/WDataSetSphericalHarmonics.cpp
+14
-12
src/dataHandler/WDataSetSphericalHarmonics.h
src/dataHandler/WDataSetSphericalHarmonics.h
+1
-0
src/dataHandler/WDataTexture3D_2.cpp
src/dataHandler/WDataTexture3D_2.cpp
+11
-5
src/dataHandler/WDataTexture3D_2.h
src/dataHandler/WDataTexture3D_2.h
+13
-0
src/dataHandler/WGridRegular3D.cpp
src/dataHandler/WGridRegular3D.cpp
+1
-1
src/dataHandler/WGridRegular3D.h
src/dataHandler/WGridRegular3D.h
+1
-15
src/dataHandler/WGridTransformOrtho.cpp
src/dataHandler/WGridTransformOrtho.cpp
+2
-4
src/dataHandler/WGridTransformOrtho.h
src/dataHandler/WGridTransformOrtho.h
+2
-2
src/dataHandler/WValueSet.h
src/dataHandler/WValueSet.h
+9
-0
src/dataHandler/WValueSetBase.h
src/dataHandler/WValueSetBase.h
+6
-0
src/dataHandler/test/WValueSetBase_test.h
src/dataHandler/test/WValueSetBase_test.h
+8
-0
src/graphicsEngine/WGEColormapping.cpp
src/graphicsEngine/WGEColormapping.cpp
+45
-5
src/graphicsEngine/WGEColormapping.h
src/graphicsEngine/WGEColormapping.h
+40
-6
src/graphicsEngine/WGETexture.h
src/graphicsEngine/WGETexture.h
+18
-2
src/graphicsEngine/WGETextureUtils.h
src/graphicsEngine/WGETextureUtils.h
+2
-1
src/graphicsEngine/WPickInfo.h
src/graphicsEngine/WPickInfo.h
+14
-1
src/graphicsEngine/callbacks/WGELinearTranslationCallback.h
src/graphicsEngine/callbacks/WGELinearTranslationCallback.h
+51
-1
src/graphicsEngine/callbacks/WGEPropertyTransformationCallback.h
...phicsEngine/callbacks/WGEPropertyTransformationCallback.h
+2
-1
src/graphicsEngine/geodes/WGEGridNode.cpp
src/graphicsEngine/geodes/WGEGridNode.cpp
+2
-1
src/gui/qt4/CMakeLists.txt
src/gui/qt4/CMakeLists.txt
+5
-3
src/gui/qt4/controlPanel/WPropertyMatrix4X4Widget.cpp
src/gui/qt4/controlPanel/WPropertyMatrix4X4Widget.cpp
+1
-1
src/gui/qt4/networkEditor/WQtNetworkArrow.cpp
src/gui/qt4/networkEditor/WQtNetworkArrow.cpp
+1
-0
src/gui/qt4/networkEditor/WQtNetworkArrow.h
src/gui/qt4/networkEditor/WQtNetworkArrow.h
+1
-0
src/gui/qt4/networkEditor/WQtNetworkEditor.cpp
src/gui/qt4/networkEditor/WQtNetworkEditor.cpp
+52
-42
src/gui/qt4/networkEditor/WQtNetworkEditor.h
src/gui/qt4/networkEditor/WQtNetworkEditor.h
+8
-4
src/gui/qt4/networkEditor/WQtNetworkItem.cpp
src/gui/qt4/networkEditor/WQtNetworkItem.cpp
+6
-0
src/gui/qt4/networkEditor/WQtNetworkItem.h
src/gui/qt4/networkEditor/WQtNetworkItem.h
+12
-2
src/gui/qt4/networkEditor/layout/WNetworkLayout.cpp
src/gui/qt4/networkEditor/layout/WNetworkLayout.cpp
+117
-0
src/gui/qt4/networkEditor/layout/WNetworkLayout.h
src/gui/qt4/networkEditor/layout/WNetworkLayout.h
+83
-0
src/gui/qt4/networkEditor/layout/WNetworkLayoutGlobals.h
src/gui/qt4/networkEditor/layout/WNetworkLayoutGlobals.h
+33
-0
src/gui/qt4/networkEditor/layout/WNetworkLayoutItem.cpp
src/gui/qt4/networkEditor/layout/WNetworkLayoutItem.cpp
+211
-0
src/gui/qt4/networkEditor/layout/WNetworkLayoutItem.h
src/gui/qt4/networkEditor/layout/WNetworkLayoutItem.h
+155
-0
src/kernel/WModuleInputForwardData.h
src/kernel/WModuleInputForwardData.h
+14
-0
src/modules/HARDIToSphericalHarmonics/WMHARDIToSphericalHarmonics.cpp
...HARDIToSphericalHarmonics/WMHARDIToSphericalHarmonics.cpp
+6
-6
src/modules/HARDIToSphericalHarmonics/WSphericalHarmonicsCoefficientsThread.cpp
...ericalHarmonics/WSphericalHarmonicsCoefficientsThread.cpp
+14
-9
src/modules/HARDIToSphericalHarmonics/WSphericalHarmonicsCoefficientsThread.h
...phericalHarmonics/WSphericalHarmonicsCoefficientsThread.h
+1
-1
src/modules/bermanTracking/WMBermanTracking.cpp
src/modules/bermanTracking/WMBermanTracking.cpp
+17
-16
src/modules/bermanTracking/WMBermanTracking.h
src/modules/bermanTracking/WMBermanTracking.h
+4
-4
src/modules/calculateGFA/WMCalculateGFA.cpp
src/modules/calculateGFA/WMCalculateGFA.cpp
+1
-1
src/modules/calculateGFA/WMCalculateGFA.h
src/modules/calculateGFA/WMCalculateGFA.h
+1
-1
src/modules/calculateTensors/WMCalculateTensors.cpp
src/modules/calculateTensors/WMCalculateTensors.cpp
+3
-1
src/modules/calculateTensors/WMCalculateTensors.h
src/modules/calculateTensors/WMCalculateTensors.h
+1
-1
src/modules/eigenSystem/WMEigenSystem.cpp
src/modules/eigenSystem/WMEigenSystem.cpp
+72
-4
src/modules/eigenSystem/WMEigenSystem.h
src/modules/eigenSystem/WMEigenSystem.h
+36
-2
src/modules/imageSpaceLIC/WMImageSpaceLIC.cpp
src/modules/imageSpaceLIC/WMImageSpaceLIC.cpp
+0
-3
src/modules/imageSpaceLIC/shaders/WMImageSpaceLIC-ClipBlend-fragment.glsl
...eSpaceLIC/shaders/WMImageSpaceLIC-ClipBlend-fragment.glsl
+4
-4
src/modules/imageSpaceLIC/shaders/WMImageSpaceLIC-Transformation-fragment.glsl
...eLIC/shaders/WMImageSpaceLIC-Transformation-fragment.glsl
+12
-12
src/modules/modules-base.toolbox
src/modules/modules-base.toolbox
+22
-21
src/modules/modules-eeg.toolbox
src/modules/modules-eeg.toolbox
+1
-1
src/modules/modules-imageprocessing.toolbox
src/modules/modules-imageprocessing.toolbox
+3
-3
src/modules/modules-io.toolbox
src/modules/modules-io.toolbox
+7
-7
src/modules/modules-others.toolbox
src/modules/modules-others.toolbox
+41
-41
src/modules/navigationSlices/CMakeLists.txt
src/modules/navigationSlices/CMakeLists.txt
+73
-0
src/modules/navigationSlices/WMNavigationSlices.cpp
src/modules/navigationSlices/WMNavigationSlices.cpp
+311
-0
src/modules/navigationSlices/WMNavigationSlices.h
src/modules/navigationSlices/WMNavigationSlices.h
+214
-0
src/modules/navigationSlices/WMNavigationSlices.png
src/modules/navigationSlices/WMNavigationSlices.png
+0
-0
src/modules/navigationSlices/WMNavigationSlices.xpm
src/modules/navigationSlices/WMNavigationSlices.xpm
+78
-0
src/modules/navigationSlices/shaders/WMNavigationSlices-fragment.glsl
...navigationSlices/shaders/WMNavigationSlices-fragment.glsl
+37
-0
src/modules/navigationSlices/shaders/WMNavigationSlices-vertex.glsl
...s/navigationSlices/shaders/WMNavigationSlices-vertex.glsl
+45
-0
src/modules/teemGlyphs/WMTeemGlyphs.cpp
src/modules/teemGlyphs/WMTeemGlyphs.cpp
+52
-32
src/modules/teemGlyphs/WMTeemGlyphs.h
src/modules/teemGlyphs/WMTeemGlyphs.h
+11
-0
No files found.
src/common/WPropertyTypes.h
View file @
874e625f
...
...
@@ -27,6 +27,11 @@
#include <stdint.h>
#include <string>
#include <vector>
#include <boost/lexical_cast.hpp>
#include <string>
#include <list>
#include <utility>
...
...
@@ -35,7 +40,7 @@
#include <boost/lexical_cast.hpp>
#include "math/WPosition.h"
#include "math/WMatrix
4x4
.h"
#include "math/WMatrix.h"
#include "WItemSelector.h"
#include "WColor.h"
...
...
@@ -98,9 +103,9 @@ namespace WPVBaseTypes
typedef
std
::
string
PV_STRING
;
//!< base type used for every WPVString
typedef
boost
::
filesystem
::
path
PV_PATH
;
//!< base type used for every WPVFilename
typedef
WItemSelector
PV_SELECTION
;
//!< base type used for every WPVSelection
typedef
WPosition
PV_POSITION
;
//!< base type used for every WPVPosition
typedef
WPosition
PV_POSITION
;
//!< base type used for every WPVPosition
typedef
WColor
PV_COLOR
;
//!< base type used for every WPVColor
typedef
WMatrix4x4
PV_MATRIX4X4
;
//!< base type used for every WPVMatrix4X4
typedef
WMatrix4x4
_2
PV_MATRIX4X4
;
//!< base type used for every WPVMatrix4X4
/**
* Enum denoting the possible trigger states. It is used for trigger properties.
...
...
@@ -543,7 +548,22 @@ namespace PROPERTY_TYPE_HELPER
*/
WPVBaseTypes
::
PV_MATRIX4X4
create
(
const
WPVBaseTypes
::
PV_MATRIX4X4
&
/*old*/
,
const
std
::
string
str
)
{
return
fromString
(
str
);
WMatrix4x4_2
c
;
std
::
vector
<
std
::
string
>
tokens
;
tokens
=
string_utils
::
tokenize
(
str
,
";"
);
WAssert
(
tokens
.
size
()
>=
16
,
"There weren't 16 values for a 4x4 Matrix"
);
size_t
idx
=
0
;
for
(
size_t
row
=
0
;
row
<
4
;
++
row
)
{
for
(
size_t
col
=
0
;
col
<
4
;
++
col
)
{
c
(
row
,
col
)
=
boost
::
lexical_cast
<
double
>
(
tokens
[
idx
]
);
idx
++
;
}
}
return
c
;
}
/**
...
...
@@ -555,7 +575,64 @@ namespace PROPERTY_TYPE_HELPER
*/
std
::
string
asString
(
const
WPVBaseTypes
::
PV_MATRIX4X4
&
v
)
{
return
toString
(
v
);
std
::
ostringstream
out
;
for
(
size_t
row
=
0
;
row
<
4
;
++
row
)
{
for
(
size_t
col
=
0
;
col
<
4
;
++
col
)
{
out
<<
v
(
row
,
col
)
<<
";"
;
}
}
return
out
.
str
();
}
};
/**
* Class helping to create a new instance of the property content from an old one. Selections need this special care since they contain not
* serializable content which needs to be acquired from its predecessor instance.
*/
template
<
>
class
WStringConversion
<
WPVBaseTypes
::
PV_POSITION
>
{
public:
/**
* Creates a new instance of the type from a given string. Some classes need a predecessor which is also specified here.
*
* \param str the new value as string
*
* \return the new instance
*/
WPVBaseTypes
::
PV_POSITION
create
(
const
WPVBaseTypes
::
PV_POSITION
&
/*old*/
,
const
std
::
string
str
)
{
WPVBaseTypes
::
PV_POSITION
c
;
std
::
vector
<
std
::
string
>
tokens
;
tokens
=
string_utils
::
tokenize
(
str
,
";"
);
WAssert
(
tokens
.
size
()
>=
3
,
"There weren't 3 values for a 3D vector"
);
size_t
idx
=
0
;
for
(
size_t
col
=
0
;
col
<
3
;
++
col
)
{
c
[
col
]
=
boost
::
lexical_cast
<
double
>
(
tokens
[
idx
]
);
idx
++
;
}
return
c
;
}
/**
* Creates a string from the specified value.
*
* \param v the value to convert
*
* \return the string representation
*/
std
::
string
asString
(
const
WPVBaseTypes
::
PV_POSITION
&
v
)
{
std
::
ostringstream
out
;
for
(
size_t
col
=
0
;
col
<
3
;
++
col
)
{
out
<<
v
[
col
]
<<
";"
;
}
return
out
.
str
();
}
};
}
...
...
src/common/WSharedObject.h
View file @
874e625f
...
...
@@ -83,7 +83,7 @@ public:
*
* \return the condition
*/
boost
::
shared_ptr
<
WCondition
>
getChangeCondition
();
boost
::
shared_ptr
<
WCondition
>
getChangeCondition
()
const
;
protected:
...
...
@@ -122,7 +122,7 @@ WSharedObject< T >::~WSharedObject()
}
template
<
typename
T
>
boost
::
shared_ptr
<
WCondition
>
WSharedObject
<
T
>::
getChangeCondition
()
boost
::
shared_ptr
<
WCondition
>
WSharedObject
<
T
>::
getChangeCondition
()
const
{
return
m_changeCondition
;
}
...
...
src/common/math/WLinearAlgebraFunctions.cpp
View file @
874e625f
...
...
@@ -24,17 +24,16 @@
#include <vector>
#include "../../ext/Eigen/SVD"
#include "../WAssert.h"
#include "WLinearAlgebraFunctions.h"
#include "WMatrix.h"
#include "WMatrix4x4.h"
#include "WValue.h"
#include "WVector3D.h"
#ifdef OW_USE_OSSIM
#include "WOSSIMHelper.h"
#endif
WVector3D
multMatrixWithVector3D
(
WMatrix
<
double
>
mat
,
WVector3D
vec
)
{
WVector3D
result
;
...
...
@@ -301,32 +300,32 @@ bool linearIndependent( const WVector3D& u, const WVector3D& v )
return
true
;
}
void
computeSVD
(
const
WMatrix
<
double
>
&
A
,
WMatrix
<
double
>
&
U
,
WMatrix
<
double
>
&
V
,
WV
alue
<
double
>
&
S
)
void
computeSVD
(
const
WMatrix
_2
&
A
,
WMatrix
_2
&
U
,
WMatrix
_2
&
V
,
WV
ector_2
&
S
)
{
#ifdef OW_USE_OSSIM
WOSSIMHelper
::
computeSVD
(
A
,
U
,
V
,
S
);
#else
(
void
)
A
;
(
void
)
U
;
(
void
)
V
;
(
void
)
S
;
// NOLINT to prevent "unused variable" warnings
WAssert
(
false
,
"OpenWalnut must be compiled with OSSIM to support SVD."
);
#endif
Eigen
::
JacobiSVD
<
WMatrix_2
>
svd
(
A
,
Eigen
::
ComputeFullU
|
Eigen
::
ComputeFullV
);
U
=
svd
.
matrixU
();
V
=
svd
.
matrixV
();
S
=
svd
.
singularValues
();
}
WMatrix
<
double
>
pseudoInverse
(
const
WMatrix
<
double
>
&
input
)
WMatrix
_2
pseudoInverse
(
const
WMatrix_2
&
input
)
{
// calc pseudo inverse
WMatrix
<
double
>
U
(
input
.
getNbRows
(),
input
.
getNbC
ols
()
);
WMatrix
<
double
>
V
(
input
.
getNbCols
(),
input
.
getNbC
ols
()
);
WV
alue
<
double
>
Svec
(
input
.
getNbC
ols
()
);
WMatrix
_2
U
(
input
.
rows
(),
input
.
c
ols
()
);
WMatrix
_2
V
(
input
.
cols
(),
input
.
c
ols
()
);
WV
ector_2
Svec
(
input
.
c
ols
()
);
computeSVD
(
input
,
U
,
V
,
Svec
);
// create diagonal matrix S
WMatrix
<
double
>
S
(
input
.
getNbCols
(),
input
.
getNbCols
()
);
for
(
size_t
i
=
0
;
i
<
Svec
.
size
()
&&
i
<
S
.
getNbRows
()
&&
i
<
S
.
getNbCols
();
i
++
)
S
(
i
,
i
)
=
(
Svec
[
i
]
==
0.0
)
?
0.0
:
1.0
/
Svec
[
i
];
WMatrix_2
S
(
input
.
cols
(),
input
.
cols
()
);
S
.
setZero
();
for
(
int
i
=
0
;
i
<
Svec
.
size
()
&&
i
<
S
.
rows
()
&&
i
<
S
.
cols
();
i
++
)
{
S
(
i
,
i
)
=
(
Svec
[
i
]
==
0.0
)
?
0.0
:
1.0
/
Svec
[
i
];
}
return
WMatrix
<
double
>
(
V
*
S
*
U
.
transposed
()
);
return
WMatrix
_2
(
V
*
S
*
U
.
transpose
()
);
}
src/common/math/WLinearAlgebraFunctions.h
View file @
874e625f
...
...
@@ -26,6 +26,7 @@
#define WLINEARALGEBRAFUNCTIONS_H
#include "../WExportCommon.h"
#include "WMatrix.h"
namespace
osg
{
...
...
@@ -115,8 +116,7 @@ bool OWCOMMON_EXPORT linearIndependent( const WVector3D& u, const WVector3D& v )
*
* \note This function needs the OSSIM library.
*/
void
OWCOMMON_EXPORT
computeSVD
(
const
WMatrix
<
double
>&
A
,
WMatrix
<
double
>&
U
,
WMatrix
<
double
>&
V
,
WValue
<
double
>&
S
);
void
OWCOMMON_EXPORT
computeSVD
(
const
WMatrix_2
&
A
,
WMatrix_2
&
U
,
WMatrix_2
&
V
,
WVector_2
&
S
);
/**
* Calculates for a matrix the pseudo inverse.
...
...
@@ -126,6 +126,6 @@ void OWCOMMON_EXPORT computeSVD( const WMatrix< double >& A, WMatrix< double >&
* \return Inverted Matrix
*
*/
WMatrix
<
double
>
OWCOMMON_EXPORT
pseudoInverse
(
const
WMatrix
<
double
>
&
input
);
WMatrix
_2
OWCOMMON_EXPORT
pseudoInverse
(
const
WMatrix_2
&
input
);
#endif // WLINEARALGEBRAFUNCTIONS_H
src/common/math/WMatrix.h
View file @
874e625f
...
...
@@ -31,12 +31,83 @@
#include "WValue.h"
#include "WVector3D.h"
#include "../WDefines.h"
#include "../../ext/Eigen/Core"
#include "../../ext/Eigen/LU"
/**
* A double 3 times 3 matrix. Stack-allocated. Column Major!
*
* Column Major indexes:
* [0 3 6
* 1 4 7
* 2 5 8]
* If you want to access coefficients using the operator( size_t, size_t ), the first parameter is still the row index, starting with 0.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef
Eigen
::
Matrix
<
double
,
3
,
3
>
WMatrix3x3_2
;
/**
* A double 4 times 4 matrix. Stack-allocated. Column Major!
*
* Column Major indexes:
* [0 4 8 12
* 1 5 9 13
* 2 6 10 14
* 3 7 11 15]
* If you want to access coefficients using the operator( size_t, size_t ), the first parameter is still the row index, starting with 0.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef
Eigen
::
Matrix
<
double
,
4
,
4
>
WMatrix4x4_2
;
/**
* A double matrix of dynamic size. Heap-allocated. Column Major!
* If you want to access coefficients using the operator( size_t, size_t ), the first parameter is still the row index, starting with 0.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef
Eigen
::
MatrixXd
WMatrix_2
;
/**
* A complex double matrix of dynamic size. Heap-allocated.
* If you want to access coefficients using the operator( size_t, size_t ), the first parameter is still the row index, starting with 0.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef
Eigen
::
MatrixXcd
WMatrixComplex_2
;
/**
* Converts a given WMatrix4x4_2 to an osg matrix.
*
* \param m the matrix to convert
*
* \return the converted matrix
*/
inline
osg
::
Matrixd
toOsgMatrixd
(
WMatrix4x4_2
m
)
{
osg
::
Matrixd
m2
;
for
(
size_t
row
=
0
;
row
<
4
;
++
row
)
{
for
(
size_t
col
=
0
;
col
<
4
;
++
col
)
{
m2
(
row
,
col
)
=
m
(
row
,
col
);
}
}
return
m2
;
}
/**
* Matrix template class with variable number of rows and columns.
* The access function are row-major, which means that the rows
* are the first parameter or index.
*/
template
<
typename
T
>
class
WMatrix
:
public
WValue
<
T
>
template
<
typename
T
>
class
OW_API_DEPRECATED
WMatrix
:
public
WValue
<
T
>
{
public:
/**
...
...
src/common/math/WMatrix4x4.h
View file @
874e625f
...
...
@@ -36,10 +36,12 @@
#include "../WAssert.h"
#include "../WStringUtils.h"
#include "../WDefines.h"
/**
* Use osg 4x4 matrices as WMatrix4x4
*/
typedef
osg
::
Matrixd
WMatrix4x4
;
OW_API_DEPRECATED
typedef
osg
::
Matrixd
WMatrix4x4
;
/**
* Write a 4x4 matrix in string representation.
...
...
@@ -48,7 +50,7 @@ typedef osg::Matrixd WMatrix4x4;
*
* \return the matrix as string
*/
inline
std
::
string
toString
(
const
WMatrix4x4
&
c
)
/*
inline std::string toString( const WMatrix4x4& c )
{
std::ostringstream out;
for ( size_t row = 0; row < 4; ++row )
...
...
@@ -60,7 +62,7 @@ inline std::string toString( const WMatrix4x4& c )
}
return out.str();
}
*/
/**
* Read a 4x4 matrix in string representation from the given string.
*
...
...
@@ -68,7 +70,7 @@ inline std::string toString( const WMatrix4x4& c )
*
* \return the matrix
*/
inline
WMatrix4x4
fromString
(
std
::
string
str
)
/*
inline WMatrix4x4 fromString( std::string str )
{
WMatrix4x4 c;
std::vector< std::string > tokens;
...
...
@@ -86,6 +88,6 @@ inline WMatrix4x4 fromString( std::string str )
}
return c;
}
}
*/
#endif // WMATRIX4X4_H
src/common/math/WSymmetricSphericalHarmonic.cpp
View file @
874e625f
This diff is collapsed.
Click to expand it.
src/common/math/WSymmetricSphericalHarmonic.h
View file @
874e625f
...
...
@@ -31,7 +31,7 @@
#include "WMath.h"
#include "WMatrix.h"
#include "WUnitSphereCoordinates.h"
#include "WV
alue
.h"
#include "WV
ector3D
.h"
/**
* Class for symmetric spherical harmonics
...
...
@@ -50,7 +50,7 @@ public:
* Constructor.
* \param SHCoefficients the initial coefficients (stored like in the mentioned Descoteaux paper).
*/
explicit
WSymmetricSphericalHarmonic
(
const
WV
alue
<
double
>
&
SHCoefficients
);
explicit
WSymmetricSphericalHarmonic
(
const
WV
ector_2
&
SHCoefficients
);
/**
* Destructor.
...
...
@@ -73,17 +73,17 @@ public:
/**
* Returns the used coefficients (stored like in the mentioned 2007 Descoteaux paper).
*/
const
WV
alue
<
double
>
&
getCoefficients
()
const
;
const
WV
ector_2
&
getCoefficients
()
const
;
/**
* Returns the coefficients for Schultz' SH base.
*/
WV
alue
<
double
>
getCoefficientsSchultz
()
const
;
WV
ector_2
getCoefficientsSchultz
()
const
;
/**
* Returns the coefficients for the complex base.
*/
WV
alue
<
std
::
complex
<
double
>
>
getCoefficientsComplex
()
const
;
WV
ectorComplex_2
getCoefficientsComplex
()
const
;
/**
* Applies the Funk-Radon-Transformation. This is faster than matrix multiplication.
...
...
@@ -91,7 +91,7 @@ public:
*
* \param frtMat the frt matrix as calculated by calcFRTMatrix()
*/
void
applyFunkRadonTransformation
(
WMatrix
<
double
>
const
&
frtMat
);
void
applyFunkRadonTransformation
(
const
WMatrix_2
&
frtMat
);
/**
* Return the order of the spherical harmonic.
...
...
@@ -125,7 +125,7 @@ public:
*
* \return The generalized fractional anisotropy.
*/
double
calcGFA
(
WMatrix
<
double
>
const
&
B
)
const
;
double
calcGFA
(
const
WMatrix_2
&
B
)
const
;
/**
* This calculates the transformation/fitting matrix T like in the 2007 Descoteaux paper. The orientations are given as WVector3D.
...
...
@@ -135,10 +135,10 @@ public:
* \param withFRT include the Funk-Radon-Transformation?
* \return Transformation matrix
*/
static
WMatrix
<
double
>
getSHFittingMatrix
(
const
std
::
vector
<
WVector3D
>&
orientations
,
int
order
,
double
lambda
,
bool
withFRT
);
static
WMatrix
_2
getSHFittingMatrix
(
const
std
::
vector
<
WVector3D
>&
orientations
,
int
order
,
double
lambda
,
bool
withFRT
);
/**
* This calculates the transformation/fitting matrix T like in the 2007 Descoteaux paper. The orientations are given as WUnitSphereCoordinates .
...
...
@@ -148,7 +148,7 @@ public:
* \param withFRT include the Funk-Radon-Transformation?
* \return Transformation matrix
*/
static
WMatrix
<
double
>
getSHFittingMatrix
(
const
std
::
vector
<
WUnitSphereCoordinates
>&
orientations
,
static
WMatrix
_2
getSHFittingMatrix
(
const
std
::
vector
<
WUnitSphereCoordinates
>&
orientations
,
int
order
,
double
lambda
,
bool
withFRT
);
...
...
@@ -159,7 +159,7 @@ public:
* \param order The order of the spherical harmonics intended to create
* \return The base Matrix B
*/
static
WMatrix
<
double
>
calcBaseMatrix
(
const
std
::
vector
<
WUnitSphereCoordinates
>&
orientations
,
int
order
);
static
WMatrix
_2
calcBaseMatrix
(
const
std
::
vector
<
WUnitSphereCoordinates
>&
orientations
,
int
order
);
/**
* Calculates the base matrix B for the complex spherical harmonics.
...
...
@@ -167,7 +167,7 @@ public:
* \param order The order of the spherical harmonics intended to create
* \return The base Matrix B
*/
static
WMatrix
<
std
::
complex
<
double
>
>
calcComplexBaseMatrix
(
std
::
vector
<
WUnitSphereCoordinates
>
const
&
orientations
,
static
WMatrix
Complex_2
calcComplexBaseMatrix
(
std
::
vector
<
WUnitSphereCoordinates
>
const
&
orientations
,
int
order
);
/**
...
...
@@ -175,14 +175,14 @@ public:
* \param order The order of the spherical harmonic
* \return The smoothing matrix L
*/
static
WMatrix
<
double
>
calcSmoothingMatrix
(
size_t
order
);
static
WMatrix
_2
calcSmoothingMatrix
(
size_t
order
);
/**
* Calculates the Funk-Radon-Transformation-Matrix P from the 2007 Descoteaux Paper "Regularized, Fast, and Robust Analytical Q-Ball Imaging"
* \param order The order of the spherical harmonic
* \return The Funk-Radon-Matrix P
*/
static
WMatrix
<
double
>
calcFRTMatrix
(
size_t
order
);
static
WMatrix
_2
calcFRTMatrix
(
size_t
order
);
#ifdef OW_USE_OSSIM
/**
...
...
@@ -191,8 +191,9 @@ public:
* \param order The order of the symmetric tensor.
* \param orientations A vector of at least (orderTensor+1) * (orderTensor+2) / 2 orientations.
*/
static
WMatrix
<
double
>
calcSHToTensorSymMatrix
(
std
::
size_t
order
,
const
std
::
vector
<
WUnitSphereCoordinates
>&
orientations
);
static
WMatrix
_2
calcSHToTensorSymMatrix
(
std
::
size_t
order
,
const
std
::
vector
<
WUnitSphereCoordinates
>&
orientations
);
#endif // OW_USE_OSSIM
void
normalize
();
protected:
...
...
@@ -201,7 +202,7 @@ private:
size_t
m_order
;
/** coefficients of the spherical harmonic */
WV
alue
<
double
>
m_SHCoefficients
;
WV
ector_2
m_SHCoefficients
;
};
#endif // WSYMMETRICSPHERICALHARMONIC_H
src/common/math/WValue.h
View file @
874e625f
...
...
@@ -31,6 +31,7 @@
#include "../WAssert.h"
#include "../WStringUtils.h"
#include "WVector3D.h"
/**
* Base class for all higher level values like tensors, vectors, matrices and so on.
...
...
@@ -77,6 +78,19 @@ public:
}
}
/**
* Create a WValue from the given WVector_2.
* \param newValues The WVector_2 with the values..
*/
explicit
WValue
(
const
WVector_2
&
newValues
)
:
m_components
(
static_cast
<
std
::
size_t
>
(
newValues
.
size
()
)
)
{
for
(
std
::
size_t
i
=
0
;
i
<
m_components
.
size
();
++
i
)
{
m_components
[
i
]
=
static_cast
<
T
>
(
newValues
(
i
)
);
}
}
/**
* Get number of components the value consists of.
*/
...
...
@@ -320,6 +334,19 @@ public:
m_components
.
resize
(
size
);
}
/**
* Returns this WValue as WVector_2.
*/
WVector_2
toWVector
()
{
WVector_2
result
(
m_components
.
size
()
);
for
(
size_t
i
=
0
;
i
<
m_components
.
size
();
++
i
)
{
result
(
i
)
=
static_cast
<
double
>
(
m_components
[
i
]
);
}
return
result
;
}
protected:
private:
/**
...
...
src/common/math/WVector3D.cpp
View file @
874e625f
...
...
@@ -23,3 +23,127 @@
//---------------------------------------------------------------------------
#include "WVector3D.h"
osg
::
Vec3f
toOsgVec3f
(
const
WVector3D_2
&
v
)
{
return
osg
::
Vec3f
(
v
(
0
),
v
(
1
),
v
(
2
)
);
}
WVector3D
toWVector3D
(
const
WVector3D_2
&
v
)
{
return
WVector3D
(
v
(
0
),
v
(
1
),
v
(
2
)
);
}
WVector3D_2
toWVector3D_2
(
const
WVector3D
&
v
)
{
return
WVector3D_2
(
v
[
0
],
v
[
1
],
v
[
2
]
);
}
WVector3D_2
toWVector3D_2
(
const
osg
::
Vec3f
&
v
)
{
return
WVector3D_2
(
v
[
0
],
v
[
1
],
v
[
2
]
);
}
WVector3D
::
WVector3D
(
osg
::
Vec3d
vec
)
:
osg
::
Vec3d
(
vec
)
{
}
WVector3D
::
WVector3D
()
:
osg
::
Vec3d
()
{
}
WVector3D
::
WVector3D
(
osg
::
Vec3d
::
value_type
x
,
osg
::
Vec3d
::
value_type
y
,
osg
::
Vec3d
::
value_type
z
)
:
osg
::
Vec3d
(
x
,
y
,
z
)
{
}
const
WVector3D
WVector3D
::
operator
+
(
const
WVector3D
&
addend
)
const
{
WVector3D
result
(
*
this
);
result
+=
addend
;
return
result
;
}
const
WVector3D
WVector3D
::
operator
-
(
const
WVector3D
&
subtrahend
)
const
{
WVector3D
result
(
*
this
);
result
-=
subtrahend
;
return
result
;
}
size_t
WVector3D
::
size
()
const
{
return
num_components
;
}
osg
::
Vec3d
::
value_type
WVector3D
::
normSquare
()
const
{
return
this
->
length2
();
}
osg
::
Vec3d
::
value_type
WVector3D
::
dotProduct
(
const
WVector3D
&
factor2
)
const
{
return
*
this
*
factor2
;
}<