Commit d9eaccfd authored by reichenbach's avatar reichenbach
Browse files

[FIX #386] fibers and fiber selector are now updated atomically

parent b42c3645
......@@ -361,7 +361,15 @@ void WMFiberDisplay::moduleMain()
if( fibersUpdated || dataPropertiesUpdated || propertiesUpdated )
{
debugLog() << "Fibers updated.";
m_fibers = fibers;
{
boost::unique_lock< boost::mutex > lock( m_mutex );
m_fibers = fibers;
// get a new fiber selector
m_fiberSelector = boost::shared_ptr<WFiberSelector>( new WFiberSelector( fibers ) );
}
// update the prop observer if new data is available
m_coloringGroup->removeProperty( m_fibProps );
......@@ -378,9 +386,6 @@ void WMFiberDisplay::moduleMain()
// add geode to module node
postNode->clear();
// get a new fiber selector
m_fiberSelector = boost::shared_ptr<WFiberSelector>( new WFiberSelector( fibers ) );
// register dirty notifier
m_roiUpdateConnection.disconnect();
m_roiUpdateConnection = m_fiberSelector->getDirtyCondition()->subscribeSignal(
......@@ -743,6 +748,8 @@ void WMFiberDisplay::geometryUpdate( osg::Drawable* geometry )
{
if( m_fiberSelectorChanged )
{
boost::unique_lock< boost::mutex > lock( m_mutex );
bool overrideROIFiltering = m_fiberSelector->isNothingFiltered();
m_roiFilterColorsOverride->set( overrideROIFiltering ? 1.0f : 0.0f );
......
......@@ -27,6 +27,8 @@
#include <string>
#include <boost/thread.hpp>
#include "core/kernel/WModule.h"
#include "core/kernel/WModuleInputData.h"
#include "core/kernel/WModuleOutputData.h"
......@@ -105,6 +107,11 @@ private:
*/
bool m_fiberClusteringUpdate;
/**
* A mutex used to atomically update the fibers and their selector.
*/
boost::mutex m_mutex;
/**
* The fiber dataset which is going to be filtered.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment