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
384e4ce5
Commit
384e4ce5
authored
Feb 16, 2011
by
schurade
Browse files
[CHANGE] reverted the find biggest clusters function back to the original one
parent
0b172dca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
103 deletions
+35
-103
src/common/WHierarchicalTree.cpp
src/common/WHierarchicalTree.cpp
+0
-90
src/common/WHierarchicalTree.h
src/common/WHierarchicalTree.h
+0
-8
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.cpp
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.cpp
+28
-5
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.h
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.h
+7
-0
No files found.
src/common/WHierarchicalTree.cpp
View file @
384e4ce5
...
...
@@ -119,96 +119,6 @@ std::vector< size_t > WHierarchicalTree::findXBiggestClusters( size_t cluster, s
return
returnVector
;
}
std
::
vector
<
size_t
>
WHierarchicalTree
::
findXBiggestClusters2
(
size_t
cluster
,
size_t
number
)
{
//std::cout << number << " largest clusters for cluster: " << cluster << std::endl;
if
(
number
>
m_containsLeafes
[
cluster
].
size
()
)
{
number
=
m_containsLeafes
[
cluster
].
size
();
}
// init
std
::
list
<
size_t
>
worklist
;
worklist
.
push_back
(
cluster
);
while
(
worklist
.
size
()
<
number
)
{
size_t
current
=
worklist
.
front
();
worklist
.
pop_front
();
if
(
m_containsLeafes
[
current
].
size
()
>
1
)
{
size_t
left
=
m_children
[
current
].
first
;
size_t
right
=
m_children
[
current
].
second
;
worklist
.
push_back
(
left
);
worklist
.
push_back
(
right
);
}
else
{
worklist
.
push_back
(
current
);
}
}
worklist
.
sort
(
compSize
(
this
)
);
bool
newSplit
=
true
;
while
(
newSplit
)
{
newSplit
=
false
;
size_t
current
=
worklist
.
front
();
if
(
m_containsLeafes
[
current
].
size
()
>
1
)
{
size_t
left
=
m_children
[
current
].
first
;
size_t
right
=
m_children
[
current
].
second
;
size_t
last
=
worklist
.
back
();
if
(
(
m_containsLeafes
[
left
].
size
()
>
m_containsLeafes
[
last
].
size
()
)
&&
(
m_containsLeafes
[
right
].
size
()
>
m_containsLeafes
[
last
].
size
()
)
)
{
if
(
m_containsLeafes
[
left
].
size
()
>
m_containsLeafes
[
last
].
size
()
)
{
worklist
.
pop_front
();
worklist
.
push_back
(
left
);
worklist
.
sort
(
compSize
(
this
)
);
newSplit
=
true
;
}
last
=
worklist
.
back
();
if
(
m_containsLeafes
[
right
].
size
()
>
m_containsLeafes
[
last
].
size
()
)
{
if
(
!
newSplit
)
{
worklist
.
pop_front
();
}
if
(
worklist
.
size
()
==
number
)
{
worklist
.
pop_back
();
}
worklist
.
push_back
(
right
);
worklist
.
sort
(
compSize
(
this
)
);
newSplit
=
true
;
}
}
}
}
std
::
vector
<
size_t
>
returnVector
;
std
::
list
<
size_t
>::
iterator
it
;
for
(
it
=
worklist
.
begin
();
it
!=
worklist
.
end
();
++
it
)
{
size_t
current
=
*
it
;
//std::cout << "cluster:" << current << " size:" << m_containsLeafes[current].size() << std::endl;
returnVector
.
push_back
(
current
);
}
return
returnVector
;
}
std
::
vector
<
size_t
>
WHierarchicalTree
::
downXLevelsFromTop
(
size_t
level
,
bool
hideOutliers
)
{
if
(
level
>
m_maxLevel
)
...
...
src/common/WHierarchicalTree.h
View file @
384e4ce5
...
...
@@ -153,14 +153,6 @@ public:
*/
std
::
vector
<
size_t
>
findXBiggestClusters
(
size_t
cluster
,
size_t
number
=
10
);
// TODO(schurade): merge these two function
/**
* finds the X biggest clusters for a given cluster
* \param cluster
* \param number of sub clusters
*/
std
::
vector
<
size_t
>
findXBiggestClusters2
(
size_t
cluster
,
size_t
number
=
10
);
/**
* sets the color for a selected cluster and all sub clusters
* \param cluster
...
...
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.cpp
View file @
384e4ce5
...
...
@@ -37,6 +37,7 @@
#include "../../common/WPathHelper.h"
#include "../../common/WPropertyHelper.h"
#include "../../graphicsEngine/algorithms/WMarchingLegoAlgorithm.h"
#include "../../graphicsEngine/WGEColormapping.h"
#include "../../graphicsEngine/WGEUtils.h"
#include "../../kernel/WKernel.h"
#include "../../kernel/WSelectionManager.h"
...
...
@@ -127,19 +128,19 @@ void WMClusterDisplayVoxels::properties()
m_propSelectedCluster
=
m_groupSelection
->
addProperty
(
"Selected Cluster"
,
""
,
0
,
m_propCondition
);
m_propSelectedCluster
=
m_groupSelection
->
addProperty
(
"Selected Cluster"
,
"
Selects a single cluster by number.
"
,
0
,
m_propCondition
);
m_propSelectedCluster
->
setMin
(
0
);
m_propSelectedCluster
->
setMax
(
0
);
m_propXBiggestClusters
=
m_groupSelection
->
addProperty
(
"Biggest Clusters"
,
""
,
5
,
m_propCondition
);
m_propXBiggestClusters
=
m_groupSelection
->
addProperty
(
"Biggest Clusters"
,
"
Selects a number of biggest clusters.
"
,
5
,
m_propCondition
);
m_propXBiggestClusters
->
setMin
(
1
);
m_propXBiggestClusters
->
setMax
(
1000
);
m_propXClusters
=
m_groupSelection
->
addProperty
(
"X Clusters"
,
""
,
5
,
m_propCondition
);
m_propXClusters
=
m_groupSelection
->
addProperty
(
"X Clusters"
,
"
Selects a number of clusters by dividing clusters.
"
,
5
,
m_propCondition
);
m_propXClusters
->
setMin
(
1
);
m_propXClusters
->
setMax
(
1000
);
m_propValue
=
m_groupSelection
->
addProperty
(
"Similarity Value"
,
""
,
1.0
,
m_propCondition
);
m_propValue
=
m_groupSelection
->
addProperty
(
"Similarity Value"
,
"
Selects clusters below a given similarity value
"
,
1.0
,
m_propCondition
);
m_propValue
->
setMin
(
0.0
);
m_propValue
->
setMax
(
1.0
);
...
...
@@ -365,9 +366,11 @@ void WMClusterDisplayVoxels::moduleMain()
m_propSelectedCluster
->
setHidden
(
false
);
break
;
case
1
:
m_propSelectedCluster
->
setHidden
(
false
);
m_propXBiggestClusters
->
setHidden
(
false
);
break
;
case
2
:
m_propSelectedCluster
->
setHidden
(
false
);
m_propXClusters
->
setHidden
(
false
);
break
;
case
3
:
...
...
@@ -473,7 +476,7 @@ void WMClusterDisplayVoxels::updateAll()
m_currentDisplayModeString
=
std
::
string
(
"Single selection"
);
break
;
case
CDV_BIGGEST
:
m_activatedClusters
=
m_tree
.
findXBiggestClusters
2
(
m_propSelectedCluster
->
get
(),
m_propXBiggestClusters
->
get
(
true
)
);
m_activatedClusters
=
m_tree
.
findXBiggestClusters
(
m_propSelectedCluster
->
get
(),
m_propXBiggestClusters
->
get
(
true
)
);
m_currentDisplayModeString
=
std
::
string
(
"Biggest clusters"
);
break
;
case
CDV_X
:
...
...
@@ -650,6 +653,26 @@ void WMClusterDisplayVoxels::createTexture()
WKernel
::
getRunningKernel
()
->
getSelectionManager
()
->
setUseTexture
(
true
);
WDataHandler
::
getDefaultSubject
()
->
getChangeCondition
()
->
notify
();
// osg::ref_ptr< osg::Image > ima = new osg::Image;
// ima->allocateImage( m_grid->getNbCoordsX(), m_grid->getNbCoordsY(), m_grid->getNbCoordsZ(), GL_RGB, GL_UNSIGNED_BYTE );
//
// unsigned char* data = ima->data();
// m_data.resize( m_grid->getNbCoordsX() * m_grid->getNbCoordsY() * m_grid->getNbCoordsZ(), 0 );
//
// for ( unsigned int i = 0; i < m_grid->size() * 3; ++i )
// {
// data[i] = 0.0;
// }
//
// m_texture = osg::ref_ptr< WGETexture3D >( new WGETexture3D( ima ) );
// m_texture->setFilterMinMag( osg::Texture3D::LINEAR );
// m_texture->setWrapSTR( osg::Texture::CLAMP_TO_BORDER );
// m_texture->colormap()->set( m_texture->colormap()->get().newSelector( WItemSelector::IndexList( 1, 4 ) ) );
// m_properties->addProperty( m_texture->alpha() );
//
// WGEColormapping::registerTexture( m_texture, "Cluster Texture" );
}
void
WMClusterDisplayVoxels
::
createMesh
()
...
...
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.h
View file @
384e4ce5
...
...
@@ -35,6 +35,7 @@
#include "../../dataHandler/WDataHandler.h"
#include "../../dataHandler/WDataSetScalar.h"
#include "../../dataHandler/WDataTexture3D.h"
#include "../../graphicsEngine/WGETexture.h"
#include "../../dataHandler/WSubject.h"
#include "../../dataHandler/WValueSet.h"
#include "../../graphicsEngine/geodes/WDendrogramGeode.h"
...
...
@@ -228,6 +229,12 @@ private:
*/
osg
::
ref_ptr
<
osg
::
Texture3D
>
m_texture
;
/**
* stores a pointer to the texture we paint in
*/
// osg::ref_ptr< WGETexture3D > m_texture;
/**
* label vector for texture creation
*/
...
...
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