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
778afee4
Commit
778afee4
authored
Feb 28, 2011
by
Mathias Goldau
Browse files
[CHANGE] Removed std::pair of WVector3D as bounding box replacement. Now WBoundingBox is used...
parent
7ccd5d2d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
83 deletions
+66
-83
src/common/WBoundingBox.h
src/common/WBoundingBox.h
+5
-5
src/dataHandler/WDataSetFibers.cpp
src/dataHandler/WDataSetFibers.cpp
+42
-25
src/dataHandler/WDataSetFibers.h
src/dataHandler/WDataSetFibers.h
+12
-25
src/graphicsEngine/WFiberDrawable.h
src/graphicsEngine/WFiberDrawable.h
+1
-10
src/modules/clusterDisplay/WMClusterDisplay.cpp
src/modules/clusterDisplay/WMClusterDisplay.cpp
+1
-7
src/modules/fiberDisplay/WMFiberDisplay.cpp
src/modules/fiberDisplay/WMFiberDisplay.cpp
+3
-10
src/modules/probTractDisplaySP/WSPSliceGeodeBuilder.cpp
src/modules/probTractDisplaySP/WSPSliceGeodeBuilder.cpp
+2
-1
No files found.
src/common/WBoundingBox.h
View file @
778afee4
...
...
@@ -113,11 +113,11 @@ public:
using
osg
::
BoundingBoxImpl
<
VT
>::
corner
;
/**
*
Converts this b
ounding
b
ox
to the
osg::BoundingBox
Impl< VT >
.
*
Explicit type conversion function to use a WB
ounding
B
ox
as
osg::BoundingBox.
*
* \return
C
opy of this
casted to the
osg::BoundingBox
Impl< VT > type
* \return
A c
opy of this
bounding box as
osg::BoundingBox
.
*/
osg
::
BoundingBox
Impl
<
VT
>
toOSGBB
()
const
;
osg
::
BoundingBox
toOSGBB
()
const
;
using
osg
::
BoundingBoxImpl
<
VT
>::
expandBy
;
...
...
@@ -202,9 +202,9 @@ inline typename WBoundingBoxImpl< VT >::value_type WBoundingBoxImpl< VT >::radiu
}
template
<
class
VT
>
inline
osg
::
BoundingBox
Impl
<
VT
>
WBoundingBoxImpl
<
VT
>::
toOSGBB
()
const
inline
osg
::
BoundingBox
WBoundingBoxImpl
<
VT
>::
toOSGBB
()
const
{
return
*
this
;
return
osg
::
BoundingBox
(
osg
::
BoundingBoxImpl
<
VT
>::
_min
,
osg
::
BoundingBoxImpl
<
VT
>::
_max
)
;
}
template
<
class
VT
>
...
...
src/dataHandler/WDataSetFibers.cpp
View file @
778afee4
...
...
@@ -22,14 +22,16 @@
//
//---------------------------------------------------------------------------
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <iostream>
#include <boost/filesystem/fstream.hpp>
#include <boost/lexical_cast.hpp>
#include "../common/datastructures/WFiber.h"
#include "../common/WBoundingBox.h"
#include "../common/WColor.h"
#include "../common/WLogger.h"
...
...
@@ -37,9 +39,9 @@
#include "../common/WPropertyHelper.h"
#include "../graphicsEngine/WGEUtils.h"
#include "exceptions/WDHNoSuchDataSet.h"
#include "WCreateColorArraysThread.h"
#include "WDataSet.h"
#include "WDataSetFibers.h"
#include "WCreateColorArraysThread.h"
// prototype instance as singleton
boost
::
shared_ptr
<
WPrototyped
>
WDataSetFibers
::
m_prototype
=
boost
::
shared_ptr
<
WPrototyped
>
();
...
...
@@ -54,15 +56,13 @@ WDataSetFibers::WDataSetFibers( WDataSetFibers::VertexArray vertices,
WDataSetFibers
::
IndexArray
lineStartIndexes
,
WDataSetFibers
::
LengthArray
lineLengths
,
WDataSetFibers
::
IndexArray
verticesReverse
,
std
::
pair
<
wmath
::
WPosition
,
wmath
::
WPosition
>
boundingBox
)
WBoundingBox
boundingBox
)
:
WDataSet
(),
m_vertices
(
vertices
),
m_lineStartIndexes
(
lineStartIndexes
),
m_lineLengths
(
lineLengths
),
m_verticesReverse
(
verticesReverse
),
m_bbMin
(
boundingBox
.
first
),
m_bbMax
(
boundingBox
.
second
)
m_vertices
(
vertices
),
m_lineStartIndexes
(
lineStartIndexes
),
m_lineLengths
(
lineLengths
),
m_verticesReverse
(
verticesReverse
),
m_bb
(
boundingBox
)
{
WAssert
(
m_vertices
->
size
()
%
3
==
0
,
"Invalid vertex array."
);
init
();
...
...
@@ -73,23 +73,16 @@ WDataSetFibers::WDataSetFibers( WDataSetFibers::VertexArray vertices,
WDataSetFibers
::
LengthArray
lineLengths
,
WDataSetFibers
::
IndexArray
verticesReverse
)
:
WDataSet
(),
m_vertices
(
vertices
),
m_lineStartIndexes
(
lineStartIndexes
),
m_lineLengths
(
lineLengths
),
m_verticesReverse
(
verticesReverse
)
m_vertices
(
vertices
),
m_lineStartIndexes
(
lineStartIndexes
),
m_lineLengths
(
lineLengths
),
m_verticesReverse
(
verticesReverse
)
{
WAssert
(
m_vertices
->
size
()
%
3
==
0
,
"Invalid vertex array."
);
// determine bounding box
m_bbMin
=
wmath
::
WPosition
(
wlimits
::
MAX_DOUBLE
,
wlimits
::
MAX_DOUBLE
,
wlimits
::
MAX_DOUBLE
);
m_bbMax
=
wmath
::
WPosition
(
-
wlimits
::
MAX_DOUBLE
,
-
wlimits
::
MAX_DOUBLE
,
-
wlimits
::
MAX_DOUBLE
);
for
(
size_t
i
=
0
;
i
<
vertices
->
size
()
/
3
;
++
i
)
{
if
(
(
*
vertices
)[
3
*
i
+
0
]
>
m_bbMax
[
0
]
)
m_bbMax
[
0
]
=
(
*
vertices
)[
3
*
i
+
0
];
if
(
(
*
vertices
)[
3
*
i
+
1
]
>
m_bbMax
[
1
]
)
m_bbMax
[
1
]
=
(
*
vertices
)[
3
*
i
+
1
];
if
(
(
*
vertices
)[
3
*
i
+
2
]
>
m_bbMax
[
2
]
)
m_bbMax
[
2
]
=
(
*
vertices
)[
3
*
i
+
2
];
if
(
(
*
vertices
)[
3
*
i
+
0
]
<
m_bbMin
[
0
]
)
m_bbMin
[
0
]
=
(
*
vertices
)[
3
*
i
+
0
];
if
(
(
*
vertices
)[
3
*
i
+
1
]
<
m_bbMin
[
1
]
)
m_bbMin
[
1
]
=
(
*
vertices
)[
3
*
i
+
1
];
if
(
(
*
vertices
)[
3
*
i
+
2
]
<
m_bbMin
[
2
]
)
m_bbMin
[
2
]
=
(
*
vertices
)[
3
*
i
+
2
];
m_bb
.
expandBy
(
(
*
vertices
)[
3
*
i
+
0
],
(
*
vertices
)[
3
*
i
+
1
],
(
*
vertices
)[
3
*
i
+
2
]
);
}
// remaining initilisation
init
();
...
...
@@ -339,6 +332,30 @@ wmath::WPosition WDataSetFibers::getTangent( size_t fiber, size_t vertex ) const
return
tangent
;
}
/**
* Special helper functions for the saveSelected member function.
*/
namespace
{
/**
* converts an integer into a byte array and back
*/
union
converterByteINT32
{
unsigned
char
b
[
4
];
//!< the bytes
int
i
;
//!< the int
};
/**
* converts a float into a byte array and back
*/
union
converterByteFloat
{
unsigned
char
b
[
4
];
//!< the bytes
float
f
;
//!< the float
};
}
void
WDataSetFibers
::
saveSelected
(
std
::
string
filename
,
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
active
)
const
{
std
::
vector
<
float
>
pointsToSave
;
...
...
@@ -450,9 +467,9 @@ void WDataSetFibers::saveSelected( std::string filename, boost::shared_ptr< std:
}
}
std
::
pair
<
wmath
::
WPosition
,
wmath
::
WPosition
>
WDataSetFibers
::
getBoundingBox
()
const
WBoundingBox
WDataSetFibers
::
getBoundingBox
()
const
{
return
std
::
make_pair
(
m_bbMin
,
m_bbMax
)
;
return
m_bb
;
}
WFiber
WDataSetFibers
::
operator
[](
size_t
numTract
)
const
...
...
src/dataHandler/WDataSetFibers.h
View file @
778afee4
...
...
@@ -32,29 +32,14 @@
#include <boost/shared_ptr.hpp>
#include <boost/tuple/tuple.hpp>
#include "../common/datastructures/WFiber.h"
#include "../common/math/WPosition.h"
#include "../common/WBoundingBox.h"
#include "../common/WProperties.h"
#include "WDataSet.h"
#include "WExportDataHandler.h"
/**
* converts an integer into a byte array and back
*/
union
converterByteINT32
{
unsigned
char
b
[
4
];
//!< the bytes
int
i
;
//!< the int
};
/**
* converts a float into a byte array and back
*/
union
converterByteFloat
{
unsigned
char
b
[
4
];
//!< the bytes
float
f
;
//!< the float
};
// forward declarations
class
WFiber
;
/**
* Represents a simple set of WFibers.
...
...
@@ -184,7 +169,7 @@ public:
boost
::
shared_ptr
<
std
::
vector
<
size_t
>
>
lineStartIndexes
,
boost
::
shared_ptr
<
std
::
vector
<
size_t
>
>
lineLengths
,
boost
::
shared_ptr
<
std
::
vector
<
size_t
>
>
verticesReverse
,
std
::
pair
<
wmath
::
WPosition
,
wmath
::
WPosition
>
boundingBox
);
WBoundingBox
boundingBox
);
/**
* Constructs a new set of fibers. This constructor determines the bounding box by using the coordinates of the vertices.
...
...
@@ -200,12 +185,12 @@ public:
boost
::
shared_ptr
<
std
::
vector
<
size_t
>
>
verticesReverse
);
/**
* Constructs a new set of
WFiber
s. The constructed instance is not usable.
* Constructs a new set of
tract
s. The constructed instance is not usable
but needed for prototype mechanism
.
*/
WDataSetFibers
();
/**
* Get number of
fiber
s in this data set.
* Get number of
tract
s in this data set.
*/
size_t
size
()
const
;
...
...
@@ -361,9 +346,9 @@ public:
void
saveSelected
(
std
::
string
filename
,
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
active
)
const
;
/**
* Get the bounding box
as pair of WPositions
.
* Get the bounding box.
*/
std
::
pair
<
wmath
::
WPosition
,
wmath
::
WPosition
>
getBoundingBox
()
const
;
WBoundingBox
getBoundingBox
()
const
;
/**
* Constructs a WFiber out of the given tract number.
...
...
@@ -426,8 +411,10 @@ private:
*/
IndexArray
m_verticesReverse
;
wmath
::
WPosition
m_bbMin
;
//!< Minimum position of bounding box of all fibers.
wmath
::
WPosition
m_bbMax
;
//!< Maximum position of bounding box of all fibers.
/**
* Axis aligned bounding box for all tract-vertices of this dataset.
*/
WBoundingBox
m_bb
;
};
#endif // WDATASETFIBERS_H
src/graphicsEngine/WFiberDrawable.h
View file @
778afee4
...
...
@@ -98,11 +98,7 @@ public:
*/
void
setUseTubes
(
bool
flag
);
/**
* Set the bounding box of all fibers.
* \param bb The new bounding box.
*/
void
setBoundingBox
(
const
osg
::
BoundingBox
&
bb
);
using
osg
::
Drawable
::
setBound
;
/**
* setter
...
...
@@ -172,11 +168,6 @@ inline void WFiberDrawable::setUseTubes( bool flag )
m_useTubes
=
flag
;
}
inline
void
WFiberDrawable
::
setBoundingBox
(
const
osg
::
BoundingBox
&
bb
)
{
setBound
(
bb
);
}
inline
void
WFiberDrawable
::
setBitfield
(
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
bitField
)
{
m_active
=
bitField
;
...
...
src/modules/clusterDisplay/WMClusterDisplay.cpp
View file @
778afee4
...
...
@@ -981,13 +981,7 @@ void WMClusterDisplay::dendrogramClick( WPickInfo pickInfo )
void
WMClusterDisplay
::
createFiberGeode
()
{
m_fiberDrawable
=
osg
::
ref_ptr
<
WFiberDrawable
>
(
new
WFiberDrawable
);
m_fiberDrawable
->
setBoundingBox
(
osg
::
BoundingBox
(
m_dataSet
->
getBoundingBox
().
first
[
0
],
m_dataSet
->
getBoundingBox
().
first
[
1
],
m_dataSet
->
getBoundingBox
().
first
[
2
],
m_dataSet
->
getBoundingBox
().
second
[
0
],
m_dataSet
->
getBoundingBox
().
second
[
1
],
m_dataSet
->
getBoundingBox
().
second
[
2
]
)
);
m_fiberDrawable
->
setBound
(
m_dataSet
->
getBoundingBox
().
toOSGBB
()
);
m_fiberDrawable
->
setStartIndexes
(
m_dataSet
->
getLineStartIndexes
()
);
m_fiberDrawable
->
setPointsPerLine
(
m_dataSet
->
getLineLengths
()
);
m_fiberDrawable
->
setVerts
(
m_dataSet
->
getVertices
()
);
...
...
src/modules/fiberDisplay/WMFiberDisplay.cpp
View file @
778afee4
...
...
@@ -285,13 +285,7 @@ void WMFiberDisplay::create()
osg
::
ref_ptr
<
osg
::
Group
>
osgNodeNew
=
osg
::
ref_ptr
<
osg
::
Group
>
(
new
osg
::
Group
);
m_fiberDrawable
=
osg
::
ref_ptr
<
WFiberDrawable
>
(
new
WFiberDrawable
);
m_fiberDrawable
->
setBoundingBox
(
osg
::
BoundingBox
(
m_dataset
->
getBoundingBox
().
first
[
0
],
m_dataset
->
getBoundingBox
().
first
[
1
],
m_dataset
->
getBoundingBox
().
first
[
2
],
m_dataset
->
getBoundingBox
().
second
[
0
],
m_dataset
->
getBoundingBox
().
second
[
1
],
m_dataset
->
getBoundingBox
().
second
[
2
]
)
);
m_fiberDrawable
->
setBound
(
m_dataset
->
getBoundingBox
().
toOSGBB
()
);
m_fiberDrawable
->
setStartIndexes
(
m_dataset
->
getLineStartIndexes
()
);
m_fiberDrawable
->
setPointsPerLine
(
m_dataset
->
getLineLengths
()
);
m_fiberDrawable
->
setVerts
(
m_dataset
->
getVertices
()
);
...
...
@@ -463,7 +457,6 @@ void WMFiberDisplay::updateOutput()
boost
::
shared_ptr
<
std
::
vector
<
size_t
>
>
lineStartIndexes
=
boost
::
shared_ptr
<
std
::
vector
<
size_t
>
>
(
new
std
::
vector
<
size_t
>
()
);
boost
::
shared_ptr
<
std
::
vector
<
size_t
>
>
lineLengths
=
boost
::
shared_ptr
<
std
::
vector
<
size_t
>
>
(
new
std
::
vector
<
size_t
>
()
);
boost
::
shared_ptr
<
std
::
vector
<
size_t
>
>
verticesReverse
=
boost
::
shared_ptr
<
std
::
vector
<
size_t
>
>
(
new
std
::
vector
<
size_t
>
()
);
std
::
pair
<
wmath
::
WPosition
,
wmath
::
WPosition
>
boundingBox
=
m_dataset
->
getBoundingBox
();
size_t
countLines
=
0
;
...
...
@@ -489,7 +482,7 @@ void WMFiberDisplay::updateOutput()
++
countLines
;
}
}
boost
::
shared_ptr
<
WDataSetFibers
>
newOutput
=
boost
::
shared_ptr
<
WDataSetFibers
>
(
new
WDataSetFibers
(
vertices
,
lineStartIndexes
,
lineLengths
,
verticesReverse
,
b
oundingBox
)
);
boost
::
shared_ptr
<
WDataSetFibers
>
newOutput
(
new
WDataSetFibers
(
vertices
,
lineStartIndexes
,
lineLengths
,
verticesReverse
,
m_dataset
->
getB
oundingBox
()
)
);
m_fiberOutput
->
updateData
(
newOutput
);
}
src/modules/probTractDisplaySP/WSPSliceGeodeBuilder.cpp
View file @
778afee4
...
...
@@ -25,9 +25,10 @@
#include <osg/Geometry>
#include "../../common/datastructures/WFiber.h"
#include "../../common/exceptions/WTypeMismatch.h"
#include "../../common/WLogger.h"
#include "../../common/math/WPosition.h"
#include "../../common/WLogger.h"
#include "../../graphicsEngine/WGEGeodeUtils.h"
#include "WSPSliceGeodeBuilder.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment