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
d29d5594
Commit
d29d5594
authored
Oct 07, 2010
by
schurade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CHANGE] moved the fiber selector stuff to kernel to make it available for other modules
parent
2e5f226a
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
12 additions
and
349 deletions
+12
-349
src/kernel/WFiberSelector.cpp
src/kernel/WFiberSelector.cpp
+1
-1
src/kernel/WFiberSelector.h
src/kernel/WFiberSelector.h
+1
-1
src/kernel/WKdTree.cpp
src/kernel/WKdTree.cpp
+2
-2
src/kernel/WKdTree.h
src/kernel/WKdTree.h
+1
-1
src/kernel/WSelectorBranch.cpp
src/kernel/WSelectorBranch.cpp
+0
-0
src/kernel/WSelectorBranch.h
src/kernel/WSelectorBranch.h
+1
-1
src/kernel/WSelectorRoi.cpp
src/kernel/WSelectorRoi.cpp
+2
-2
src/kernel/WSelectorRoi.h
src/kernel/WSelectorRoi.h
+2
-2
src/modules/clusterDisplay/WDendrogram.cpp
src/modules/clusterDisplay/WDendrogram.cpp
+0
-218
src/modules/clusterDisplay/WDendrogram.h
src/modules/clusterDisplay/WDendrogram.h
+0
-119
src/modules/fiberDisplay/WFiberDrawable.h
src/modules/fiberDisplay/WFiberDrawable.h
+1
-1
src/modules/fiberDisplay/WMFiberDisplay.h
src/modules/fiberDisplay/WMFiberDisplay.h
+1
-1
No files found.
src/
modules/fiberDisplay
/WFiberSelector.cpp
→
src/
kernel
/WFiberSelector.cpp
View file @
d29d5594
...
...
@@ -24,7 +24,7 @@
#include <iostream>
#include "../
../
kernel/WKernel.h"
#include "../kernel/WKernel.h"
#include "WFiberSelector.h"
...
...
src/
modules/fiberDisplay
/WFiberSelector.h
→
src/
kernel
/WFiberSelector.h
View file @
d29d5594
...
...
@@ -28,7 +28,7 @@
#include <list>
#include <vector>
#include "../
../
dataHandler/WDataSetFibers.h"
#include "../dataHandler/WDataSetFibers.h"
#include "WSelectorRoi.h"
#include "WSelectorBranch.h"
...
...
src/
modules/fiberDisplay
/WKdTree.cpp
→
src/
kernel
/WKdTree.cpp
View file @
d29d5594
...
...
@@ -25,8 +25,8 @@
#include <algorithm>
#include <vector>
#include "../
../
common/WAssert.h"
#include "../
../
common/WLogger.h"
#include "../common/WAssert.h"
#include "../common/WLogger.h"
#include "WKdTree.h"
...
...
src/
modules/fiberDisplay
/WKdTree.h
→
src/
kernel
/WKdTree.h
View file @
d29d5594
...
...
@@ -28,7 +28,7 @@
#include <algorithm>
#include <vector>
#include "../
../
common/WThreadedRunner.h"
#include "../common/WThreadedRunner.h"
/**
* implements the compare function for std::nth_element on a point array
...
...
src/
modules/fiberDisplay
/WSelectorBranch.cpp
→
src/
kernel
/WSelectorBranch.cpp
View file @
d29d5594
File moved
src/
modules/fiberDisplay
/WSelectorBranch.h
→
src/
kernel
/WSelectorBranch.h
View file @
d29d5594
...
...
@@ -29,7 +29,7 @@
#include <vector>
#include "WSelectorRoi.h"
#include "../
../
kernel/WRMBranch.h"
#include "../kernel/WRMBranch.h"
/**
* TODO(schurade): Document this!
...
...
src/
modules/fiberDisplay
/WSelectorRoi.cpp
→
src/
kernel
/WSelectorRoi.cpp
View file @
d29d5594
...
...
@@ -23,8 +23,8 @@
//---------------------------------------------------------------------------
//#include "../../../graphicsEngine/WGraphicsEngine.h"
#include "../
../
graphicsEngine/WROIBox.h"
#include "../
../
graphicsEngine/WROIArbitrary.h"
#include "../graphicsEngine/WROIBox.h"
#include "../graphicsEngine/WROIArbitrary.h"
#include "WSelectorRoi.h"
...
...
src/
modules/fiberDisplay
/WSelectorRoi.h
→
src/
kernel
/WSelectorRoi.h
View file @
d29d5594
...
...
@@ -27,9 +27,9 @@
#include <vector>
#include "../
../
dataHandler/WDataSetFibers.h"
#include "../dataHandler/WDataSetFibers.h"
#include "../
../
graphicsEngine/WROI.h"
#include "../graphicsEngine/WROI.h"
#include "WKdTree.h"
/**
...
...
src/modules/clusterDisplay/WDendrogram.cpp
deleted
100644 → 0
View file @
2e5f226a
//---------------------------------------------------------------------------
//
// 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 "../../graphicsEngine/WGEUtils.h"
#include "WDendrogram.h"
/**
* Class implements a dendrogram as an osg geode
*/
WDendrogram
::
WDendrogram
(
WHierarchicalTree
*
tree
,
size_t
cluster
,
size_t
minClusterSize
,
float
xSize
,
float
ySize
,
float
xOffset
,
float
yOffset
)
:
osg
::
Geode
(),
m_tree
(
tree
),
m_rootCluster
(
cluster
),
m_minClusterSize
(
minClusterSize
),
m_xSize
(
xSize
),
m_ySize
(
ySize
),
m_xOff
(
xOffset
),
m_yOff
(
yOffset
)
{
create
();
}
WDendrogram
::~
WDendrogram
()
{
}
void
WDendrogram
::
create
()
{
m_colors
=
osg
::
ref_ptr
<
osg
::
Vec4Array
>
(
new
osg
::
Vec4Array
);
m_vertexArray
=
new
osg
::
Vec3Array
;
m_lineArray
=
new
osg
::
DrawElementsUInt
(
osg
::
PrimitiveSet
::
LINES
,
0
);
float
xMax
=
static_cast
<
float
>
(
m_tree
->
size
(
m_rootCluster
)
-
1
);
float
yMax
=
m_tree
->
getLevel
(
m_rootCluster
);
m_xMult
=
m_xSize
/
xMax
;
m_yMult
=
m_ySize
/
yMax
;
layout
(
m_rootCluster
,
0.0
f
,
static_cast
<
float
>
(
m_tree
->
size
(
m_rootCluster
)
-
1
)
);
for
(
size_t
i
=
0
;
i
<
m_vertexArray
->
size
();
++
i
)
{
(
*
m_vertexArray
)[
i
].
x
()
=
(
*
m_vertexArray
)[
i
].
x
()
*
m_xMult
+
m_xOff
;
(
*
m_vertexArray
)[
i
].
y
()
=
(
*
m_vertexArray
)[
i
].
y
()
*
m_yMult
+
m_yOff
;
}
osg
::
ref_ptr
<
osg
::
Geometry
>
geometry
=
osg
::
ref_ptr
<
osg
::
Geometry
>
(
new
osg
::
Geometry
()
);
geometry
->
setVertexArray
(
m_vertexArray
);
geometry
->
addPrimitiveSet
(
m_lineArray
);
geometry
->
setColorArray
(
m_colors
);
geometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_PER_VERTEX
);
osg
::
StateSet
*
state
=
geometry
->
getOrCreateStateSet
();
state
->
setMode
(
GL_LIGHTING
,
osg
::
StateAttribute
::
OFF
|
osg
::
StateAttribute
::
PROTECTED
);
addDrawable
(
geometry
);
}
void
WDendrogram
::
layout
(
size_t
cluster
,
float
left
,
float
right
)
{
float
height
=
m_tree
->
getLevel
(
cluster
);
float
size
=
right
-
left
;
if
(
m_tree
->
getLevel
(
cluster
)
>
0
)
{
size_t
leftCluster
=
m_tree
->
getChildren
(
cluster
).
first
;
size_t
rightCluster
=
m_tree
->
getChildren
(
cluster
).
second
;
float
leftHeight
=
m_tree
->
getLevel
(
leftCluster
);
float
leftSize
=
static_cast
<
float
>
(
m_tree
->
size
(
leftCluster
)
);
float
rightHeight
=
m_tree
->
getLevel
(
rightCluster
);
float
rightSize
=
static_cast
<
float
>
(
m_tree
->
size
(
rightCluster
)
);
if
(
(
leftSize
>=
m_minClusterSize
)
&&
(
rightSize
<
m_minClusterSize
)
)
//if ( rightSize < 2 )
{
// left cluster is much bigger, draw only left
m_vertexArray
->
push_back
(
osg
::
Vec3
(
(
left
+
size
/
2.0
),
height
,
0
)
);
m_vertexArray
->
push_back
(
osg
::
Vec3
(
(
left
+
size
/
2.0
),
leftHeight
,
0
)
);
m_lineArray
->
push_back
(
m_vertexArray
->
size
()
-
2
);
m_lineArray
->
push_back
(
m_vertexArray
->
size
()
-
1
);
m_colors
->
push_back
(
wge
::
osgColor
(
m_tree
->
getColor
(
cluster
)
)
);
m_colors
->
push_back
(
wge
::
osgColor
(
m_tree
->
getColor
(
cluster
)
)
);
layout
(
leftCluster
,
left
,
right
);
}
else
if
(
(
rightSize
>=
m_minClusterSize
)
&&
(
leftSize
<
m_minClusterSize
)
)
//else if ( leftSize < 2 )
{
// right cluster is much bigger, draw only right
m_vertexArray
->
push_back
(
osg
::
Vec3
(
(
left
+
size
/
2.0
),
height
,
0
)
);
m_vertexArray
->
push_back
(
osg
::
Vec3
(
(
left
+
size
/
2.0
),
rightHeight
,
0
)
);
m_lineArray
->
push_back
(
m_vertexArray
->
size
()
-
2
);
m_lineArray
->
push_back
(
m_vertexArray
->
size
()
-
1
);
m_colors
->
push_back
(
wge
::
osgColor
(
m_tree
->
getColor
(
cluster
)
)
);
m_colors
->
push_back
(
wge
::
osgColor
(
m_tree
->
getColor
(
cluster
)
)
);
layout
(
rightCluster
,
left
,
right
);
}
else
{
float
mult
=
size
/
(
leftSize
+
rightSize
);
m_vertexArray
->
push_back
(
osg
::
Vec3
(
(
left
+
leftSize
*
mult
/
2.0
),
height
,
0
)
);
m_vertexArray
->
push_back
(
osg
::
Vec3
(
(
right
-
rightSize
*
mult
/
2.0
),
height
,
0
)
);
m_lineArray
->
push_back
(
m_vertexArray
->
size
()
-
2
);
m_lineArray
->
push_back
(
m_vertexArray
->
size
()
-
1
);
m_vertexArray
->
push_back
(
osg
::
Vec3
(
(
left
+
leftSize
*
mult
/
2.0
),
leftHeight
,
0
)
);
m_vertexArray
->
push_back
(
osg
::
Vec3
(
(
right
-
rightSize
*
mult
/
2.0
),
rightHeight
,
0
)
);
m_colors
->
push_back
(
wge
::
osgColor
(
m_tree
->
getColor
(
cluster
)
)
);
m_colors
->
push_back
(
wge
::
osgColor
(
m_tree
->
getColor
(
cluster
)
)
);
m_colors
->
push_back
(
wge
::
osgColor
(
m_tree
->
getColor
(
cluster
)
)
);
m_colors
->
push_back
(
wge
::
osgColor
(
m_tree
->
getColor
(
cluster
)
)
);
m_lineArray
->
push_back
(
m_vertexArray
->
size
()
-
4
);
m_lineArray
->
push_back
(
m_vertexArray
->
size
()
-
2
);
m_lineArray
->
push_back
(
m_vertexArray
->
size
()
-
3
);
m_lineArray
->
push_back
(
m_vertexArray
->
size
()
-
1
);
layout
(
leftCluster
,
left
,
left
+
leftSize
*
mult
);
layout
(
rightCluster
,
right
-
rightSize
*
mult
,
right
);
}
}
}
size_t
WDendrogram
::
getClickedCluster
(
int
xClick
,
int
yClick
)
{
m_xClicked
=
(
xClick
-
m_xOff
)
/
m_xSize
*
(
m_tree
->
size
(
m_rootCluster
)
-
1
);
m_yClicked
=
(
yClick
-
m_yOff
)
/
m_ySize
*
(
m_tree
->
getLevel
(
m_rootCluster
)
-
1
);
getClickClusterRecursive
(
m_rootCluster
,
0.0
f
,
static_cast
<
float
>
(
m_tree
->
size
(
m_rootCluster
)
-
1
)
);
//std::cout << xClick << "," << yClick << " : " << m_xClicked << "," << m_yClicked << std::endl;
return
m_clickedCluster
;
}
void
WDendrogram
::
getClickClusterRecursive
(
size_t
cluster
,
float
left
,
float
right
)
{
int
height
=
m_tree
->
getLevel
(
cluster
);
if
(
height
==
m_yClicked
)
{
m_clickedCluster
=
cluster
;
return
;
}
int
size
=
right
-
left
;
if
(
m_tree
->
getLevel
(
cluster
)
>
0
)
{
size_t
leftCluster
=
m_tree
->
getChildren
(
cluster
).
first
;
size_t
rightCluster
=
m_tree
->
getChildren
(
cluster
).
second
;
float
leftSize
=
static_cast
<
float
>
(
m_tree
->
size
(
leftCluster
)
);
float
rightSize
=
static_cast
<
float
>
(
m_tree
->
size
(
rightCluster
)
);
if
(
(
leftSize
>=
m_minClusterSize
)
&&
(
rightSize
<
m_minClusterSize
)
)
{
// left cluster is much bigger, draw only left
getClickClusterRecursive
(
leftCluster
,
left
,
right
);
}
else
if
(
(
rightSize
>=
m_minClusterSize
)
&&
(
leftSize
<
m_minClusterSize
)
)
{
// right cluster is much bigger, draw only right
getClickClusterRecursive
(
rightCluster
,
left
,
right
);
}
else
{
float
mult
=
size
/
(
leftSize
+
rightSize
);
if
(
m_xClicked
<
left
+
leftSize
*
mult
)
{
getClickClusterRecursive
(
leftCluster
,
left
,
left
+
leftSize
*
mult
);
}
else
{
getClickClusterRecursive
(
rightCluster
,
right
-
rightSize
*
mult
,
right
);
}
}
}
}
src/modules/clusterDisplay/WDendrogram.h
deleted
100644 → 0
View file @
2e5f226a
//---------------------------------------------------------------------------
//
// 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 WDENDROGRAM_H
#define WDENDROGRAM_H
#include <osg/Geode>
#include <osg/Vec3>
#include <osg/Geometry>
#include <osg/MatrixTransform>
#include <osg/PositionAttitudeTransform>
#include "WHierarchicalTree.h"
/**
* Class creates a dendrogram from a hierarchical clustering
*/
class
WDendrogram
:
public
osg
::
Geode
{
public:
/**
* constructor
*
* \param tree reference to the tree object to work on
* \param cluster root cluster for the dendrogram
* \param minClusterSize minimum for cluster to be drawn, when i the whole tree is drawn
* \param xSize number of pixel to scale the tree on along the x axis
* \param ySize number of pixel to scale the tree on along the y axis
* \param xOffset translation alogn the x axis
* \param yOffset translation alogn the y axis
*
*/
WDendrogram
(
WHierarchicalTree
*
tree
,
size_t
cluster
,
size_t
minClusterSize
=
1
,
float
xSize
=
1000.
f
,
float
ySize
=
500.
f
,
float
xOffset
=
0.0
f
,
float
yOffset
=
0.0
f
);
/**
* destructor
*/
~
WDendrogram
();
/**
* calculate which cluster was clicked from given pixel coordinates
* \param xClick the x coordinate
* \param yClick the y coordinate
* \return the cluster id, will return the root cluster if no cluster can be determinded
*/
size_t
getClickedCluster
(
int
xClick
,
int
yClick
);
protected:
private:
/**
* helper function the starts the layout process from the input data in the constructor
*/
void
create
();
/**
* recursive funtion that lays out the tree from top to bottom
* \param cluster the current cluster to work on
* \param left left border of the current subcluster
* \param right right border of the current subcluster
*/
void
layout
(
size_t
cluster
,
float
left
,
float
right
);
/**
* recurse function that follows the layout to determine the cluster from pixel coordinates
*
* \param cluster cluster to check against coordinates
* \param left left boundary of cluster
* \param right right boundary of cluster
*/
void
getClickClusterRecursive
(
size_t
cluster
,
float
left
,
float
right
);
WHierarchicalTree
*
m_tree
;
//!< the tree to work on
size_t
m_rootCluster
;
//!< top cluster to draw the tree from
osg
::
ref_ptr
<
osg
::
Vec4Array
>
m_colors
;
//!< color array
osg
::
Vec3Array
*
m_vertexArray
;
//!< vertex array
osg
::
DrawElementsUInt
*
m_lineArray
;
//!< line array
size_t
m_minClusterSize
;
//!< minimum cluster size to be considered while laying out the dendrogram
float
m_xSize
;
//!< x size in pixel of the final dendrogram
float
m_ySize
;
//!< y size in pixel of the final dendrogram
float
m_xOff
;
//!< x offset
float
m_yOff
;
//!< y offset
float
m_xMult
;
//!< helper variable for the recursive function
float
m_yMult
;
//!< helper variable for the recursive function
int
m_xClicked
;
//!< stores the click position for use int he recursive function
int
m_yClicked
;
//!< stores the click position for use int he recursive function
size_t
m_clickedCluster
;
//!< the clicked cluster
};
#endif // WDENDROGRAM_H
src/modules/fiberDisplay/WFiberDrawable.h
View file @
d29d5594
...
...
@@ -35,7 +35,7 @@
#include <osg/ShapeDrawable>
#include <osg/Group>
#include "WFiberSelector.h"
#include "
../../kernel/
WFiberSelector.h"
class
WDataSetFibers
;
...
...
src/modules/fiberDisplay/WMFiberDisplay.h
View file @
d29d5594
...
...
@@ -34,10 +34,10 @@
#include "../../graphicsEngine/WROIBox.h"
#include "../../graphicsEngine/WShader.h"
#include "../../kernel/WFiberSelector.h"
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleInputData.h"
#include "WFiberSelector.h"
#include "WFiberDrawable.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