Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
bf76b613
Commit
bf76b613
authored
Sep 03, 2010
by
schurade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] abillity to transfer a cluster into a roi
parent
86ff39dc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
155 additions
and
2 deletions
+155
-2
src/graphicsEngine/WROIBitfield.cpp
src/graphicsEngine/WROIBitfield.cpp
+41
-0
src/graphicsEngine/WROIBitfield.h
src/graphicsEngine/WROIBitfield.h
+72
-0
src/kernel/modules/fiberDisplay/WRMROIRepresentation.cpp
src/kernel/modules/fiberDisplay/WRMROIRepresentation.cpp
+8
-0
src/modules/clusterDisplay/WMClusterDisplay.cpp
src/modules/clusterDisplay/WMClusterDisplay.cpp
+27
-2
src/modules/clusterDisplay/WMClusterDisplay.h
src/modules/clusterDisplay/WMClusterDisplay.h
+7
-0
No files found.
src/graphicsEngine/WROIBitfield.cpp
0 → 100644
View file @
bf76b613
//---------------------------------------------------------------------------
//
// 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 <vector>
#include "WROIBitfield.h"
WROIBitfield
::
WROIBitfield
(
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
bitfield
)
:
WROI
(),
m_bitfield
(
bitfield
)
{
}
WROIBitfield
::~
WROIBitfield
()
{
}
void
WROIBitfield
::
updateGFX
()
{
}
src/graphicsEngine/WROIBitfield.h
0 → 100644
View file @
bf76b613
//---------------------------------------------------------------------------
//
// 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 WROIBITFIELD_H
#define WROIBITFIELD_H
#include <vector>
#include "WROI.h"
/**
* defines a roi by a simple bitfield that never changes
* while a normal roi computes it's bitfield from it's location in space and the fibers passing through,
* this roi simply stores a bitfield of previously selected fibers
*/
class
WROIBitfield
:
public
WROI
{
public:
/**
* constructor
* \param bitfield pointer to a bitfield
*/
explicit
WROIBitfield
(
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
bitfield
);
/**
* destructor
*/
virtual
~
WROIBitfield
();
/**
* getter
* \return the bitfield of selected fibers
*/
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
getBitfield
();
protected:
private:
/**
* does nothing but had to be implemented beccause it's pure virtual in WROI
*/
void
updateGFX
();
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
m_bitfield
;
//!< stores pointer to the bitfield
};
inline
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
WROIBitfield
::
getBitfield
()
{
return
m_bitfield
;
}
#endif // WROIBITFIELD_H
src/kernel/modules/fiberDisplay/WRMROIRepresentation.cpp
View file @
bf76b613
...
...
@@ -31,6 +31,7 @@
#include "../../../graphicsEngine/WGraphicsEngine.h"
#include "../../../graphicsEngine/WROIBox.h"
#include "../../../graphicsEngine/WROIArbitrary.h"
#include "../../../graphicsEngine/WROIBitfield.h"
#include "WRMBranch.h"
#include "WROIManagerFibers.h"
...
...
@@ -164,6 +165,13 @@ void WRMROIRepresentation::recalculate()
}
}
}
if
(
osg
::
dynamic_pointer_cast
<
WROIBitfield
>
(
m_roi
).
get
()
)
{
osg
::
ref_ptr
<
WROIBitfield
>
roi
=
osg
::
dynamic_pointer_cast
<
WROIBitfield
>
(
m_roi
);
m_workerBitfield
=
roi
->
getBitfield
();
}
m_dirty
=
false
;
m_outputBitfield
=
m_workerBitfield
;
}
...
...
src/modules/clusterDisplay/WMClusterDisplay.cpp
View file @
bf76b613
...
...
@@ -38,7 +38,7 @@
#include "../../common/WPathHelper.h"
#include "../../common/WPropertyHelper.h"
#include "../../graphicsEngine/WROI
Sphere
.h"
#include "../../graphicsEngine/WROI
Bitfield
.h"
#include "../../graphicsEngine/WGEUtils.h"
#include "../../kernel/WKernel.h"
...
...
@@ -344,6 +344,8 @@ void WMClusterDisplay::properties()
m_propTreeFile
=
m_properties
->
addProperty
(
"Tree file"
,
""
,
WPathHelper
::
getAppPath
()
);
m_readTriggerProp
=
m_properties
->
addProperty
(
"Do read"
,
"Press!"
,
WPVBaseTypes
::
PV_TRIGGER_READY
,
m_propCondition
);
WPropertyHelper
::
PC_PATHEXISTS
::
addTo
(
m_propTreeFile
);
m_createRoiTrigger
=
m_properties
->
addProperty
(
"Create Roi"
,
"Press!"
,
WPVBaseTypes
::
PV_TRIGGER_READY
,
m_propCondition
);
}
void
WMClusterDisplay
::
moduleMain
()
...
...
@@ -482,6 +484,12 @@ void WMClusterDisplay::moduleMain()
{
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
setUseExternalBitfield
(
m_active
->
get
(
true
)
);
}
if
(
m_createRoiTrigger
->
get
(
true
)
==
WPVBaseTypes
::
PV_TRIGGER_TRIGGERED
)
{
handleCreateRoi
();
m_createRoiTrigger
->
set
(
WPVBaseTypes
::
PV_TRIGGER_READY
,
true
);
}
}
con
.
disconnect
();
...
...
@@ -495,10 +503,12 @@ void WMClusterDisplay::handleSelectedClusterChanged()
m_propSelectedClusterOffset
->
setMin
(
0
-
m_tree
.
getLevel
(
m_propSelectedCluster
->
get
()
)
);
m_propSelectedClusterOffset
->
set
(
0
);
m_propSelectedClusterOffset
->
get
(
true
);
m_propMinSizeToColor
->
setMax
(
m_tree
.
size
(
m_biggestClusters
.
back
()
)
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
setExternalBitfield
(
m_tree
.
getOutputBitfield
(
m_rootCluster
)
);
m_propSubLevelsToColor
->
setMax
(
m_tree
.
getLevel
(
m_rootCluster
)
);
//colorClusters( m_propSelectedCluster->get( true ) );
m_dendrogramDirty
=
true
;
}
...
...
@@ -555,9 +565,12 @@ void WMClusterDisplay::handleBiggestClustersChanged()
{
m_biggestClusters
=
m_tree
.
findXBiggestClusters
(
m_propSelectedCluster
->
get
(),
m_propSubClusters
->
get
(
true
)
);
m_propMinSizeToColor
->
setMax
(
m_tree
.
size
(
m_biggestClusters
.
back
()
)
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
setExternalBitfield
(
m_tree
.
getOutputBitfield
(
m_biggestClusters
)
);
m_tree
.
colorCluster
(
m_tree
.
getClusterCount
()
-
1
,
WColor
(
0.3
,
0.3
,
0.3
,
1.0
)
);
setColor
(
m_tree
.
getLeafesForCluster
(
m_rootCluster
),
WColor
(
0.3
,
0.3
,
0.3
,
1.0
)
);
for
(
size_t
k
=
0
;
k
<
m_biggestClusters
.
size
();
++
k
)
{
...
...
@@ -606,9 +619,21 @@ void WMClusterDisplay::handleRoiChanged()
if
(
(
m_propMaxSubClusters
->
get
(
true
)
==
1
)
&&
(
m_biggestClusters
.
size
()
>
0
)
)
{
m_propSelectedCluster
->
set
(
m_biggestClusters
[
0
]
);
m_tree
.
colorCluster
(
m_tree
.
getClusterCount
()
-
1
,
WColor
(
0.3
,
0.3
,
0.3
,
1.0
)
);
setColor
(
m_tree
.
getLeafesForCluster
(
m_rootCluster
),
WColor
(
0.3
,
0.3
,
0.3
,
1.0
)
);
m_tree
.
colorCluster
(
m_propSelectedCluster
->
get
(),
WColor
(
1.0
,
0.3
,
0.3
,
1.0
)
);
setColor
(
m_tree
.
getLeafesForCluster
(
m_propSelectedCluster
->
get
()
),
WColor
(
1.0
,
0.3
,
0.3
,
1.0
)
);
}
}
void
WMClusterDisplay
::
handleCreateRoi
()
{
osg
::
ref_ptr
<
WROI
>
newRoi
=
osg
::
ref_ptr
<
WROI
>
(
new
WROIBitfield
(
m_tree
.
getOutputBitfield
(
m_propSelectedCluster
->
get
()
)
)
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
addRoi
(
newRoi
);
}
void
WMClusterDisplay
::
updateWidgets
()
{
...
...
@@ -736,7 +761,7 @@ void WMClusterDisplay::updateWidgets()
if
(
m_propShowDendrogram
->
get
(
true
)
)
{
m_dendrogramGeode
=
new
WDendrogram
(
&
m_tree
,
m_
roo
tCluster
,
m_propMinSizeToColor
->
get
(),
width
-
120
,
height
/
2
,
100
);
m_dendrogramGeode
=
new
WDendrogram
(
&
m_tree
,
m_
tree
.
ge
tCluster
Count
()
-
1
,
m_propMinSizeToColor
->
get
(),
width
-
120
,
height
/
2
,
100
);
m_camera
->
addChild
(
m_dendrogramGeode
);
}
m_dendrogramDirty
=
false
;
...
...
src/modules/clusterDisplay/WMClusterDisplay.h
View file @
bf76b613
...
...
@@ -185,6 +185,11 @@ private:
*/
void
handleRoiChanged
();
/**
* function to handle user input
*/
void
handleCreateRoi
();
/**
* creates a label depending ont he current labeling setting
*
...
...
@@ -195,6 +200,7 @@ private:
/**
* listenes to the pickhandler and determines if a click into the dendrogram happened
* \param pickInfo the pickInfo object as sent out by the pickhandler
*/
void
dendrogramClick
(
WPickInfo
pickInfo
);
...
...
@@ -259,6 +265,7 @@ private:
WPropTrigger
m_readTriggerProp
;
//!< This property triggers the actual reading,
WPropFilename
m_propTreeFile
;
//!< The tree will be read from this file, i hope we will get a real load button some time
WPropTrigger
m_createRoiTrigger
;
//!< when triggered the selected cluster will be transfered into a WRoiBitfield
/**
* stores the tree object
...
...
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