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
318244a6
Commit
318244a6
authored
Dec 07, 2010
by
Alexander Wiebel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX #455] some of the crashes fixed by removing the notifiers that are not
used anymore. Needed to change them to shared_ptr for this
parent
5ecf920e
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
222 additions
and
76 deletions
+222
-76
src/graphicsEngine/WROI.cpp
src/graphicsEngine/WROI.cpp
+13
-3
src/kernel/WFiberSelector.cpp
src/kernel/WFiberSelector.cpp
+22
-12
src/kernel/WFiberSelector.h
src/kernel/WFiberSelector.h
+5
-0
src/kernel/WRMBranch.cpp
src/kernel/WRMBranch.cpp
+16
-5
src/kernel/WRMBranch.h
src/kernel/WRMBranch.h
+12
-2
src/kernel/WROIManager.cpp
src/kernel/WROIManager.cpp
+54
-18
src/kernel/WROIManager.h
src/kernel/WROIManager.h
+28
-6
src/kernel/WSelectorBranch.cpp
src/kernel/WSelectorBranch.cpp
+9
-5
src/kernel/WSelectorBranch.h
src/kernel/WSelectorBranch.h
+3
-0
src/kernel/WSelectorRoi.cpp
src/kernel/WSelectorRoi.cpp
+4
-2
src/kernel/WSelectorRoi.h
src/kernel/WSelectorRoi.h
+2
-0
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
+9
-4
src/modules/arbitraryPlane/WMArbitraryPlane.h
src/modules/arbitraryPlane/WMArbitraryPlane.h
+2
-0
src/modules/datasetManipulator/WMDatasetManipulator.cpp
src/modules/datasetManipulator/WMDatasetManipulator.cpp
+26
-12
src/modules/datasetManipulator/WMDatasetManipulator.h
src/modules/datasetManipulator/WMDatasetManipulator.h
+3
-1
src/modules/overlayAtlas/WMOverlayAtlas.cpp
src/modules/overlayAtlas/WMOverlayAtlas.cpp
+13
-6
src/modules/overlayAtlas/WMOverlayAtlas.h
src/modules/overlayAtlas/WMOverlayAtlas.h
+1
-0
No files found.
src/graphicsEngine/WROI.cpp
View file @
318244a6
...
...
@@ -118,17 +118,27 @@ void WROI::unhide()
void
WROI
::
signalRoiChange
()
{
for
(
std
::
list
<
boost
::
function
<
void
()
>
>::
iterator
iter
=
m_changeNotifiers
.
begin
();
for
(
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
>::
iterator
iter
=
m_changeNotifiers
.
begin
();
iter
!=
m_changeNotifiers
.
end
();
++
iter
)
{
(
*
iter
)();
(
*
*
iter
)();
}
}
void
WROI
::
addChangeNotifier
(
boost
::
function
<
void
()
>
notifier
)
void
WROI
::
addChangeNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
notifier
)
{
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_associatedNotifiersLock
);
m_changeNotifiers
.
push_back
(
notifier
);
lock
.
unlock
();
}
void
WROI
::
removeChangeNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
notifier
)
{
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_associatedNotifiersLock
);
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
>::
iterator
it
;
it
=
std
::
find
(
m_changeNotifiers
.
begin
(),
m_changeNotifiers
.
end
(),
notifier
);
m_changeNotifiers
.
erase
(
it
);
lock
.
unlock
();
}
src/kernel/WFiberSelector.cpp
View file @
318244a6
...
...
@@ -46,20 +46,28 @@ WFiberSelector::WFiberSelector( boost::shared_ptr< const WDataSetFibers > fibers
rois
[
i
].
get
()
->
getProperties
()
->
getProperty
(
"Dirty"
)
->
toPropBool
()
->
set
(
true
);
}
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
assocRoiSignal
=
boost
::
bind
(
&
WFiberSelector
::
slotAddRoi
,
this
,
_1
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
addAddNotifier
(
assocRoiSignal
);
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
removeRoiSignal
=
boost
::
bind
(
&
WFiberSelector
::
slotRemoveRoi
,
this
,
_1
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
addRemoveNotifier
(
removeRoiSignal
);
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
removeBranchSignal
=
boost
::
bind
(
&
WFiberSelector
::
slotRemoveBranch
,
this
,
_1
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
addRemoveBranchNotifier
(
removeBranchSignal
);
m_assocRoiSignal
=
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
(
new
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
(
boost
::
bind
(
&
WFiberSelector
::
slotAddRoi
,
this
,
_1
)
)
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
addAddNotifier
(
m_assocRoiSignal
);
m_removeRoiSignal
=
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
(
new
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
(
boost
::
bind
(
&
WFiberSelector
::
slotRemoveRoi
,
this
,
_1
)
)
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
addRemoveNotifier
(
m_removeRoiSignal
);
m_removeBranchSignal
=
boost
::
shared_ptr
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
(
new
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
(
boost
::
bind
(
&
WFiberSelector
::
slotRemoveBranch
,
this
,
_1
)
)
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
addRemoveBranchNotifier
(
m_removeBranchSignal
);
}
WFiberSelector
::~
WFiberSelector
()
{
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
removeAddNotifier
(
m_assocRoiSignal
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
removeRemoveNotifier
(
m_removeRoiSignal
);
WKernel
::
getRunningKernel
()
->
getRoiManager
()
->
removeRemoveBranchNotifier
(
m_removeBranchSignal
);
}
void
WFiberSelector
::
slotAddRoi
(
osg
::
ref_ptr
<
WROI
>
roi
)
...
...
@@ -84,14 +92,16 @@ void WFiberSelector::slotAddRoi( osg::ref_ptr< WROI > roi )
branch
->
addRoi
(
sroi
);
boost
::
function
<
void
()
>
changeRoiSignal
=
boost
::
bind
(
&
WFiberSelector
::
setDirty
,
this
);
sroi
->
getRoi
()
->
addChangeNotifier
(
changeRoiSignal
);
m_changeRoiSignal
=
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
(
new
boost
::
function
<
void
()
>
(
boost
::
bind
(
&
WFiberSelector
::
setDirty
,
this
)
)
);
sroi
->
getRoi
()
->
addChangeNotifier
(
m_changeRoiSignal
);
setDirty
();
}
void
WFiberSelector
::
slotRemoveRoi
(
osg
::
ref_ptr
<
WROI
>
roi
)
{
roi
->
removeChangeNotifier
(
m_changeRoiSignal
);
for
(
std
::
list
<
boost
::
shared_ptr
<
WSelectorBranch
>
>::
iterator
iter
=
m_branches
.
begin
();
iter
!=
m_branches
.
end
();
++
iter
)
{
(
*
iter
)
->
removeRoi
(
roi
);
...
...
src/kernel/WFiberSelector.h
View file @
318244a6
...
...
@@ -127,6 +127,11 @@ private:
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
m_workerBitfield
;
//!< bit field of activated fibers
std
::
list
<
boost
::
shared_ptr
<
WSelectorBranch
>
>
m_branches
;
//!< list of branches int he roi structure
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
m_assocRoiSignal
;
//!< Signal that can be used to update the selector
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
m_removeRoiSignal
;
//!< Signal that can be used to update the selector
boost
::
shared_ptr
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
m_removeBranchSignal
;
//!< Signal for updating the selector
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
m_changeRoiSignal
;
//!< Signal that can be used to update the selector
};
inline
size_t
WFiberSelector
::
size
()
...
...
src/kernel/WRMBranch.cpp
View file @
318244a6
...
...
@@ -61,8 +61,8 @@ void WRMBranch::propertyChanged()
void
WRMBranch
::
addRoi
(
osg
::
ref_ptr
<
WROI
>
roi
)
{
m_rois
.
push_back
(
roi
);
boost
::
function
<
void
()
>
changeRoiSignal
=
boost
::
bind
(
&
WRMBranch
::
setDirty
,
this
);
roi
->
addChangeNotifier
(
changeRoiSignal
);
m_changeRoiSignal
=
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
(
new
boost
::
function
<
void
()
>
(
boost
::
bind
(
&
WRMBranch
::
setDirty
,
this
)
)
);
roi
->
addChangeNotifier
(
m_
changeRoiSignal
);
setDirty
();
}
...
...
@@ -81,6 +81,7 @@ bool WRMBranch::contains( osg::ref_ptr< WROI > roi )
void
WRMBranch
::
removeRoi
(
osg
::
ref_ptr
<
WROI
>
roi
)
{
roi
->
removeChangeNotifier
(
m_changeRoiSignal
);
for
(
std
::
list
<
osg
::
ref_ptr
<
WROI
>
>::
iterator
iter
=
m_rois
.
begin
();
iter
!=
m_rois
.
end
();
++
iter
)
{
if
(
(
*
iter
)
==
roi
)
...
...
@@ -115,10 +116,10 @@ void WRMBranch::setDirty()
m_dirty
->
set
(
true
);
m_roiManager
->
setDirty
();
for
(
std
::
list
<
boost
::
function
<
void
()
>
>::
iterator
iter
=
m_changeNotifiers
.
begin
();
for
(
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
>::
iterator
iter
=
m_changeNotifiers
.
begin
();
iter
!=
m_changeNotifiers
.
end
();
++
iter
)
{
(
*
iter
)();
(
*
*
iter
)();
}
}
...
...
@@ -137,10 +138,20 @@ boost::shared_ptr< WProperties > WRMBranch::getProperties()
return
m_properties
;
}
void
WRMBranch
::
addChangeNotifier
(
boost
::
function
<
void
()
>
notifier
)
void
WRMBranch
::
addChangeNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
notifier
)
{
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_associatedNotifiersLock
);
m_changeNotifiers
.
push_back
(
notifier
);
lock
.
unlock
();
}
void
WRMBranch
::
removeChangeNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
notifier
)
{
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_associatedNotifiersLock
);
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
>::
iterator
it
;
it
=
std
::
find
(
m_changeNotifiers
.
begin
(),
m_changeNotifiers
.
end
(),
notifier
);
m_changeNotifiers
.
erase
(
it
);
lock
.
unlock
();
}
src/kernel/WRMBranch.h
View file @
318244a6
...
...
@@ -137,7 +137,15 @@ public:
*
* \param notifier the notifier function
*/
void
addChangeNotifier
(
boost
::
function
<
void
()
>
notifier
);
void
addChangeNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
notifier
);
/**
* Remove a specified notifier from the list of default notifiers which get connected to each branch
*
* \param notifier the notifier function
*/
void
removeChangeNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
notifier
);
protected:
...
...
@@ -176,7 +184,9 @@ private:
/**
* The notifiers connected to added rois by default.
*/
std
::
list
<
boost
::
function
<
void
()
>
>
m_changeNotifiers
;
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
>
m_changeNotifiers
;
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
m_changeRoiSignal
;
//!< Signal that can be used to update the ROImanager branch
/**
* Lock for associated notifiers set.
...
...
src/kernel/WROIManager.cpp
View file @
318244a6
...
...
@@ -50,10 +50,10 @@ void WROIManager::addRoi( osg::ref_ptr< WROI > newRoi )
// add roi to branch
newBranch
->
addRoi
(
newRoi
);
for
(
std
::
list
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>::
iterator
iter
=
m_addNotifiers
.
begin
();
for
(
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
>::
iterator
iter
=
m_addNotifiers
.
begin
();
iter
!=
m_addNotifiers
.
end
();
++
iter
)
{
(
*
iter
)(
newRoi
);
(
*
*
iter
)(
newRoi
);
}
}
...
...
@@ -71,10 +71,10 @@ void WROIManager::addRoi( osg::ref_ptr< WROI > newRoi, osg::ref_ptr< WROI > pare
// add roi to branch
branch
->
addRoi
(
newRoi
);
for
(
std
::
list
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>::
iterator
iter
=
m_addNotifiers
.
begin
();
for
(
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
>::
iterator
iter
=
m_addNotifiers
.
begin
();
iter
!=
m_addNotifiers
.
end
();
++
iter
)
{
(
*
iter
)(
newRoi
);
(
*
*
iter
)(
newRoi
);
}
}
...
...
@@ -86,12 +86,14 @@ void WROIManager::removeRoi( osg::ref_ptr< WROI > roi )
{
(
*
iter
)
->
removeRoi
(
roi
);
if
(
(
*
iter
)
->
empty
()
)
if
(
(
*
iter
)
->
empty
()
)
{
for
(
std
::
list
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>::
iterator
iter2
=
m_removeBranchNotifiers
.
begin
();
iter2
!=
m_removeBranchNotifiers
.
end
();
++
iter2
)
for
(
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
>::
iterator
iter2
=
m_removeBranchNotifiers
.
begin
();
iter2
!=
m_removeBranchNotifiers
.
end
();
++
iter2
)
{
(
*
iter2
)(
*
iter
);
(
*
*
iter2
)(
*
iter
);
}
m_branches
.
erase
(
iter
);
break
;
...
...
@@ -99,10 +101,12 @@ void WROIManager::removeRoi( osg::ref_ptr< WROI > roi )
}
setDirty
();
for
(
std
::
list
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>::
iterator
iter
=
m_removeNotifiers
.
begin
();
iter
!=
m_removeNotifiers
.
end
();
++
iter
)
for
(
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
>::
iterator
iter
=
m_removeNotifiers
.
begin
();
iter
!=
m_removeNotifiers
.
end
();
++
iter
)
{
(
*
iter
)(
roi
);
(
*
*
iter
)(
roi
);
}
}
...
...
@@ -115,12 +119,14 @@ void WROIManager::removeBranch( osg::ref_ptr< WROI > roi )
(
*
iter
)
->
removeAllRois
();
}
if
(
(
*
iter
)
->
empty
()
)
if
(
(
*
iter
)
->
empty
()
)
{
for
(
std
::
list
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>::
iterator
iter2
=
m_removeBranchNotifiers
.
begin
();
iter2
!=
m_removeBranchNotifiers
.
end
();
++
iter2
)
for
(
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
>::
iterator
iter2
=
m_removeBranchNotifiers
.
begin
();
iter2
!=
m_removeBranchNotifiers
.
end
();
++
iter2
)
{
(
*
iter2
)(
*
iter
);
(
*
*
iter2
)(
*
iter
);
}
m_branches
.
erase
(
iter
);
break
;
...
...
@@ -148,7 +154,7 @@ void WROIManager::setDirty()
m_dirty
->
set
(
true
);
}
void
WROIManager
::
addAddNotifier
(
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
notifier
)
void
WROIManager
::
addAddNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
notifier
)
{
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_associatedNotifiersLock
);
...
...
@@ -156,7 +162,17 @@ void WROIManager::addAddNotifier( boost::function< void( osg::ref_ptr< WROI > )
lock
.
unlock
();
}
void
WROIManager
::
addRemoveNotifier
(
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
notifier
)
void
WROIManager
::
removeAddNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
notifier
)
{
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_associatedNotifiersLock
);
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
>::
iterator
it
;
it
=
std
::
find
(
m_addNotifiers
.
begin
(),
m_addNotifiers
.
end
(),
notifier
);
m_addNotifiers
.
erase
(
it
);
lock
.
unlock
();
}
void
WROIManager
::
addRemoveNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
notifier
)
{
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_associatedNotifiersLock
);
...
...
@@ -164,7 +180,17 @@ void WROIManager::addRemoveNotifier( boost::function< void( osg::ref_ptr< WROI >
lock
.
unlock
();
}
void
WROIManager
::
addRemoveBranchNotifier
(
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
notifier
)
void
WROIManager
::
removeRemoveNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
notifier
)
{
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_associatedNotifiersLock
);
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
>::
iterator
it
;
it
=
std
::
find
(
m_removeNotifiers
.
begin
(),
m_removeNotifiers
.
end
(),
notifier
);
m_removeNotifiers
.
erase
(
it
);
lock
.
unlock
();
}
void
WROIManager
::
addRemoveBranchNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
notifier
)
{
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_associatedNotifiersLock
);
...
...
@@ -172,6 +198,16 @@ void WROIManager::addRemoveBranchNotifier( boost::function< void( boost::shared_
lock
.
unlock
();
}
void
WROIManager
::
removeRemoveBranchNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
notifier
)
{
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_associatedNotifiersLock
);
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
>::
iterator
it
;
it
=
std
::
find
(
m_removeBranchNotifiers
.
begin
(),
m_removeBranchNotifiers
.
end
(),
notifier
);
m_removeBranchNotifiers
.
erase
(
it
);
lock
.
unlock
();
}
void
WROIManager
::
setSelectedRoi
(
osg
::
ref_ptr
<
WROI
>
roi
)
{
m_selectedRoi
=
roi
;
...
...
src/kernel/WROIManager.h
View file @
318244a6
...
...
@@ -106,21 +106,43 @@ public:
*
* \param notifier the notifier function
*/
void
addAddNotifier
(
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
notifier
);
void
addAddNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
notifier
);
/**
* Remove a specified notifier from the list of default notifiers which get connected to each added roi.
*
* \param notifier the notifier function
*/
void
removeAddNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
notifier
);
/**
* Add a specified notifier to the list of default notifiers which get connected to each removed roi.
*
* \param notifier the notifier function
*/
void
addRemoveNotifier
(
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
notifier
);
void
addRemoveNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
notifier
);
/**
* Remove a specified notifier from the list of default notifiers which get connected to each removed roi.
*
* \param notifier the notifier function
*/
void
removeRemoveNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
notifier
);
/**
* Add a specified notifier to the list of default notifiers which get connected to each removed branch.
*
* \param notifier the notifier function
*/
void
addRemoveBranchNotifier
(
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
notifier
);
void
addRemoveBranchNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
notifier
);
/**
* Remove a specified notifier from the list of default notifiers which get connected to each removed branch.
*
* \param notifier the notifier function
*/
void
removeRemoveBranchNotifier
(
boost
::
shared_ptr
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
notifier
);
/**
* setter
...
...
@@ -164,17 +186,17 @@ private:
/**
* The notifiers connected to added rois by default.
*/
std
::
list
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
m_addNotifiers
;
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
>
m_addNotifiers
;
/**
* The notifiers connected to removed rois by default.
*/
std
::
list
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
m_removeNotifiers
;
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
osg
::
ref_ptr
<
WROI
>
)
>
>
>
m_removeNotifiers
;
/**
* The notifiers connected to removed rois by default.
*/
std
::
list
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
m_removeBranchNotifiers
;
std
::
list
<
boost
::
shared_ptr
<
boost
::
function
<
void
(
boost
::
shared_ptr
<
WRMBranch
>
)
>
>
>
m_removeBranchNotifiers
;
osg
::
ref_ptr
<
WROI
>
m_selectedRoi
;
//!< stores a pointer to the currently selected roi
...
...
src/kernel/WSelectorBranch.cpp
View file @
318244a6
...
...
@@ -35,20 +35,23 @@ WSelectorBranch::WSelectorBranch( boost::shared_ptr< const WDataSetFibers > fibe
{
m_bitField
=
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
(
new
std
::
vector
<
bool
>
(
m_size
,
false
)
);
boost
::
function
<
void
()
>
changeSignal
=
boost
::
bind
(
&
WSelectorBranch
::
setDirty
,
this
);
m_branch
->
addChangeNotifier
(
changeSignal
);
m_changeSignal
=
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
(
new
boost
::
function
<
void
()
>
(
boost
::
bind
(
&
WSelectorBranch
::
setDirty
,
this
)
)
);
m_branch
->
addChangeNotifier
(
m_changeSignal
);
}
WSelectorBranch
::~
WSelectorBranch
()
{
m_branch
->
removeChangeNotifier
(
m_changeSignal
);
}
void
WSelectorBranch
::
addRoi
(
boost
::
shared_ptr
<
WSelectorRoi
>
roi
)
void
WSelectorBranch
::
addRoi
(
boost
::
shared_ptr
<
WSelectorRoi
>
roi
)
{
m_rois
.
push_back
(
roi
);
boost
::
function
<
void
()
>
changeRoiSignal
=
boost
::
bind
(
&
WSelectorBranch
::
setDirty
,
this
);
roi
->
getRoi
()
->
addChangeNotifier
(
changeRoiSignal
);
m_changeRoiSignal
=
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
(
new
boost
::
function
<
void
()
>
(
boost
::
bind
(
&
WSelectorBranch
::
setDirty
,
this
)
)
);
roi
->
getRoi
()
->
addChangeNotifier
(
m_changeRoiSignal
);
}
void
WSelectorBranch
::
setDirty
()
...
...
@@ -71,6 +74,7 @@ void WSelectorBranch::removeRoi( osg::ref_ptr< WROI > roi )
break
;
}
}
roi
->
removeChangeNotifier
(
m_changeRoiSignal
);
}
void
WSelectorBranch
::
recalculate
()
...
...
src/kernel/WSelectorBranch.h
View file @
318244a6
...
...
@@ -133,6 +133,9 @@ private:
* pointer to the branch object in the roi manager
*/
boost
::
shared_ptr
<
WRMBranch
>
m_branch
;
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
m_changeSignal
;
//!< Signal that can be used to update the selector branch
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
m_changeRoiSignal
;
//!< Signal that can be used to update the selector branch
};
inline
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
WSelectorBranch
::
getBitField
()
...
...
src/kernel/WSelectorRoi.cpp
View file @
318244a6
...
...
@@ -43,12 +43,14 @@ WSelectorRoi::WSelectorRoi( osg::ref_ptr< WROI > roi, boost::shared_ptr< const W
m_currentArray
=
m_fibers
->
getVertices
();
m_currentReverse
=
m_fibers
->
getVerticesReverse
();
boost
::
function
<
void
()
>
changeRoiSignal
=
boost
::
bind
(
&
WSelectorRoi
::
setDirty
,
this
);
m_roi
->
addChangeNotifier
(
changeRoiSignal
);
m_changeRoiSignal
=
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
(
new
boost
::
function
<
void
()
>
(
boost
::
bind
(
&
WSelectorRoi
::
setDirty
,
this
)
)
);
m_roi
->
addChangeNotifier
(
m_changeRoiSignal
);
}
WSelectorRoi
::~
WSelectorRoi
()
{
m_roi
->
removeChangeNotifier
(
m_changeRoiSignal
);
}
void
WSelectorRoi
::
setDirty
()
...
...
src/kernel/WSelectorRoi.h
View file @
318244a6
...
...
@@ -141,6 +141,8 @@ private:
std
::
vector
<
float
>
m_boxMin
;
//!< lower boundary of the box, used for boxtest
std
::
vector
<
float
>
m_boxMax
;
//!< upper boundary of the box, used for boxtest
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
m_changeRoiSignal
;
//!< Signal that can be used to update the selector ROI
};
inline
boost
::
shared_ptr
<
std
::
vector
<
bool
>
>
WSelectorRoi
::
getBitField
()
...
...
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
View file @
318244a6
...
...
@@ -216,6 +216,10 @@ void WMArbitraryPlane::moduleMain()
WGraphicsEngine
::
getGraphicsEngine
()
->
getScene
()
->
remove
(
&
(
*
m_s1
)
);
WGraphicsEngine
::
getGraphicsEngine
()
->
getScene
()
->
remove
(
&
(
*
m_s2
)
);
m_s0
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_s1
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_s2
->
removeChangeNotifier
(
m_changeRoiSignal
);
con
.
disconnect
();
WKernel
::
getRunningKernel
()
->
getGraphicsEngine
()
->
getScene
()
->
remove
(
m_rootNode
);
...
...
@@ -246,10 +250,11 @@ void WMArbitraryPlane::initPlane()
WGraphicsEngine
::
getGraphicsEngine
()
->
getScene
()
->
addChild
(
&
(
*
m_s1
)
);
WGraphicsEngine
::
getGraphicsEngine
()
->
getScene
()
->
addChild
(
&
(
*
m_s2
)
);
boost
::
function
<
void
()
>
changeRoiSignal
=
boost
::
bind
(
&
WMArbitraryPlane
::
setDirty
,
this
);
m_s0
->
addChangeNotifier
(
changeRoiSignal
);
m_s1
->
addChangeNotifier
(
changeRoiSignal
);
m_s2
->
addChangeNotifier
(
changeRoiSignal
);
m_changeRoiSignal
=
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
(
new
boost
::
function
<
void
()
>
(
boost
::
bind
(
&
WMArbitraryPlane
::
setDirty
,
this
)
)
);
m_s0
->
addChangeNotifier
(
m_changeRoiSignal
);
m_s1
->
addChangeNotifier
(
m_changeRoiSignal
);
m_s2
->
addChangeNotifier
(
m_changeRoiSignal
);
}
void
WMArbitraryPlane
::
updatePlane
()
...
...
src/modules/arbitraryPlane/WMArbitraryPlane.h
View file @
318244a6
...
...
@@ -252,6 +252,8 @@ private:
std
::
vector
<
osg
::
ref_ptr
<
osg
::
Uniform
>
>
m_samplerUniforms
;
osg
::
ref_ptr
<
osg
::
Uniform
>
m_showCompleteUniform
;
//!< Determines whether the slice should be drawn completely
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
m_changeRoiSignal
;
//!< Signal that can be used to update the plane
};
#endif // WMARBITRARYPLANE_H
src/modules/datasetManipulator/WMDatasetManipulator.cpp
View file @
318244a6
...
...
@@ -165,18 +165,21 @@ void WMDatasetManipulator::init()
WGraphicsEngine
::
getGraphicsEngine
()
->
getScene
()
->
addChild
(
&
(
*
m_knobRotCenter
)
);
WGraphicsEngine
::
getGraphicsEngine
()
->
getScene
()
->
addChild
(
&
(
*
m_knobRot
)
);
boost
::
function
<
void
()
>
changeRoiSignal
=
boost
::
bind
(
&
WMDatasetManipulator
::
manipulatorMoved
,
this
);
m_knobCenter
->
addChangeNotifier
(
changeRoiSignal
);
m_knobx1
->
addChangeNotifier
(
changeRoiSignal
);
m_knobx2
->
addChangeNotifier
(
changeRoiSignal
);
m_knoby1
->
addChangeNotifier
(
changeRoiSignal
);
m_knoby2
->
addChangeNotifier
(
changeRoiSignal
);
m_knobz1
->
addChangeNotifier
(
changeRoiSignal
);
m_knobz2
->
addChangeNotifier
(
changeRoiSignal
);
boost
::
function
<
void
()
>
changeRotRoiSignal
=
boost
::
bind
(
&
WMDatasetManipulator
::
manipulatorRotMoved
,
this
);
m_knobRotCenter
->
addChangeNotifier
(
changeRotRoiSignal
);
m_knobRot
->
addChangeNotifier
(
changeRotRoiSignal
);
using
boost
::
function
;
m_changeRoiSignal
=
boost
::
shared_ptr
<
function
<
void
()
>
>
(
new
function
<
void
()
>
(
boost
::
bind
(
&
WMDatasetManipulator
::
manipulatorMoved
,
this
)
)
);
m_knobCenter
->
addChangeNotifier
(
m_changeRoiSignal
);
m_knobx1
->
addChangeNotifier
(
m_changeRoiSignal
);
m_knobx2
->
addChangeNotifier
(
m_changeRoiSignal
);
m_knoby1
->
addChangeNotifier
(
m_changeRoiSignal
);
m_knoby2
->
addChangeNotifier
(
m_changeRoiSignal
);
m_knobz1
->
addChangeNotifier
(
m_changeRoiSignal
);
m_knobz2
->
addChangeNotifier
(
m_changeRoiSignal
);
m_changeRotRoiSignal
=
boost
::
shared_ptr
<
function
<
void
()
>
>
(
new
function
<
void
()
>
(
boost
::
bind
(
&
WMDatasetManipulator
::
manipulatorRotMoved
,
this
)
)
);
m_knobRotCenter
->
addChangeNotifier
(
m_changeRotRoiSignal
);
m_knobRot
->
addChangeNotifier
(
m_changeRotRoiSignal
);
setManipulatorMode
();
}
...
...
@@ -455,5 +458,16 @@ void WMDatasetManipulator::moduleMain()
WDataHandler
::
getDefaultSubject
()
->
getChangeCondition
()
->
notify
();
}
}
m_knobCenter
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_knobx1
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_knobx2
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_knoby1
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_knoby2
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_knobz1
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_knobz2
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_knobRotCenter
->
removeChangeNotifier
(
m_changeRotRoiSignal
);
m_knobRot
->
removeChangeNotifier
(
m_changeRotRoiSignal
);
}
src/modules/datasetManipulator/WMDatasetManipulator.h
View file @
318244a6
...
...
@@ -35,7 +35,7 @@
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
/**
/**
* Someone should add some documentation here.
* Probably the best person would be the module's
* creator, i.e. "schurade".
...
...
@@ -150,6 +150,8 @@ private:
*/
WPropBool
m_rotationMode
;
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
m_changeRotRoiSignal
;
//!< Signal that can be used to update the rotation manipulator
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
m_changeRoiSignal
;
//!< Signal that can be used to update the translation manipulator
boost
::
shared_ptr
<
WROISphere
>
m_knobCenter
;
//!< stores pointer to the center manipulator
boost
::
shared_ptr
<
WROISphere
>
m_knobx1
;
//!< stores pointer to manipulator 1
...
...
src/modules/overlayAtlas/WMOverlayAtlas.cpp
View file @
318244a6
...
...
@@ -202,6 +202,12 @@ void WMOverlayAtlas::moduleMain()
}
WKernel
::
getRunningKernel
()
->
getGraphicsEngine
()
->
getScene
()
->
remove
(
m_rootNode
);
m_s0
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_s1
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_s2
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_s3
->
removeChangeNotifier
(
m_changeRoiSignal
);
m_s4
->
removeChangeNotifier
(
m_changeRoiSignal
);
}
void
WMOverlayAtlas
::
init
()
...
...
@@ -255,12 +261,13 @@ void WMOverlayAtlas::init()
WGraphicsEngine
::
getGraphicsEngine
()
->
getScene
()
->
addChild
(
&
(
*
m_s3
)
);
WGraphicsEngine
::
getGraphicsEngine
()
->
getScene
()
->
addChild
(
&
(
*
m_s4
)
);
boost
::
function
<
void
()
>
changeRoiSignal
=
boost
::
bind
(
&
WMOverlayAtlas
::
manipulatorMoved
,
this
);
m_s0
->
addChangeNotifier
(
changeRoiSignal
);
m_s1
->
addChangeNotifier
(
changeRoiSignal
);
m_s2
->
addChangeNotifier
(
changeRoiSignal
);
m_s3
->
addChangeNotifier
(
changeRoiSignal
);
m_s4
->
addChangeNotifier
(
changeRoiSignal
);
m_changeRoiSignal
=
boost
::
shared_ptr
<
boost
::
function
<
void
()
>
>
(
new
boost
::
function
<
void
()
>
(
boost
::
bind
(
&
WMOverlayAtlas
::
manipulatorMoved
,
this
)
)
);
m_s0
->
addChangeNotifier
(
m_changeRoiSignal
);
m_s1
->
addChangeNotifier
(
m_changeRoiSignal
);
m_s2
->
addChangeNotifier
(
m_changeRoiSignal
);
m_s3
->
addChangeNotifier
(
m_changeRoiSignal
);
m_s4
->
addChangeNotifier
(
m_changeRoiSignal
);
toggleManipulators
();
}
...
...