Commit 4af81fc2 authored by schurade's avatar schurade

[FIX] arbitrary rois works again with the new roi structure

parent 6f7b06c3
......@@ -58,15 +58,15 @@ WROIArbitrary::WROIArbitrary( size_t nbCoordsX, size_t nbCoordsY, size_t nbCoord
properties();
m_threshold->set( threshold );
m_threshold->setMax( maxThreshold );
updateGFX();
WGraphicsEngine::getGraphicsEngine()->getScene()->addChild( this );
setUserData( this );
setUpdateCallback( osg::ref_ptr<ROIArbNodeCallback>( new ROIArbNodeCallback ) );
m_threshold->set( threshold );
m_threshold->setMax( maxThreshold );
setDirty();
}
......@@ -87,15 +87,15 @@ WROIArbitrary::WROIArbitrary( size_t nbCoordsX, size_t nbCoordsY, size_t nbCoord
properties();
m_threshold->set( 0.01 );
m_threshold->setMax( maxThreshold );
updateGFX();
WGraphicsEngine::getGraphicsEngine()->getScene()->addChild( this );
setUserData( this );
setUpdateCallback( osg::ref_ptr< ROIArbNodeCallback >( new ROIArbNodeCallback ) );
m_threshold->set( 0.01 );
m_threshold->setMax( maxThreshold );
setDirty();
}
......
......@@ -101,10 +101,11 @@ void WMArbitraryRois::connectors()
void WMArbitraryRois::properties()
{
m_aTrigger = m_properties->addProperty( "Create", "Create a ROI", WPVBaseTypes::PV_TRIGGER_READY );
m_bTrigger = m_properties->addProperty( "Finalize", "Finalize and add to ROI manager", WPVBaseTypes::PV_TRIGGER_READY );
m_threshold = m_properties->addProperty( "Threshold", "", 0. );
m_surfaceColor = m_properties->addProperty( "Surface color", "", WColor( 1.0, 0.3, 0.3, 1.0 ) );
m_propCondition = boost::shared_ptr< WCondition >( new WCondition() );
m_finalizeTrigger = m_properties->addProperty( "Finalize", "Finalize and add to ROI manager", WPVBaseTypes::PV_TRIGGER_READY, m_propCondition );
m_threshold = m_properties->addProperty( "Threshold", "", 0., m_propCondition );
m_surfaceColor = m_properties->addProperty( "Surface color", "", WColor( 1.0, 0.3, 0.3, 1.0 ), m_propCondition );
WModule::properties();
}
......@@ -113,6 +114,7 @@ void WMArbitraryRois::moduleMain()
{
// use the m_input "data changed" flag
m_moduleState.setResetable( true, true );
m_moduleState.add( m_propCondition );
m_moduleState.add( m_input->getDataChangedCondition() );
m_moduleState.add( m_recompute );
......@@ -140,26 +142,22 @@ void WMArbitraryRois::moduleMain()
initSelectionRoi();
}
// this waits for m_moduleState to fire. By default, this is only the m_shutdownFlag condition.
// NOTE: you can add your own conditions to m_moduleState using m_moduleState.add( ... )
if ( m_aTrigger->get( true ) == WPVBaseTypes::PV_TRIGGER_TRIGGERED )
if ( m_threshold->changed() )
{
debugLog() << "Creating cut dataset.";
m_threshold->get( true );
m_showSelector = true;
createCutDataset();
renderMesh();
m_aTrigger->set( WPVBaseTypes::PV_TRIGGER_READY, false );
}
if ( m_bTrigger->get( true ) == WPVBaseTypes::PV_TRIGGER_TRIGGERED )
if ( m_finalizeTrigger->get( true ) == WPVBaseTypes::PV_TRIGGER_TRIGGERED )
{
debugLog() << "Creating cut dataset.";
m_showSelector = false;
createCutDataset();
renderMesh();
finalizeRoi();
m_bTrigger->set( WPVBaseTypes::PV_TRIGGER_READY, false );
m_finalizeTrigger->set( WPVBaseTypes::PV_TRIGGER_READY, false );
}
//m_moduleState.wait();
......@@ -352,12 +350,6 @@ void WMArbitraryRois::finalizeRoi()
return;
}
if( !WKernel::getRunningKernel()->getSelectionManager()->getBitField() )
{
wlog::warn( "WMArbitraryRois" ) << "Refused to add ROI, as ROIManager does not have computed its bitfield yet.";
return;
}
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_dataSet->getGrid() );
osg::ref_ptr< WROI > newRoi = osg::ref_ptr< WROI >( new WROIArbitrary( grid->getNbCoordsX(), grid->getNbCoordsY(), grid->getNbCoordsZ(),
grid->getTransformationMatrix(),
......
......@@ -38,6 +38,7 @@
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
class WROIArbitrary;
class WROIBox;
class WDataSetScalar;
......@@ -161,14 +162,14 @@ private:
osg::ref_ptr< WROIBox > m_selectionRoi; //!< stores a pointer to the cutting tool roi
/**
* A trigger which can be used to trigger some kind of operation.
* A condition used to notify about changes in several properties.
*/
WPropTrigger m_aTrigger;
boost::shared_ptr< WCondition > m_propCondition;
/**
* A trigger which can be used to trigger some kind of operation.
*/
WPropTrigger m_bTrigger;
WPropTrigger m_finalizeTrigger;
WPropDouble m_threshold; //!< the threshold for the roi
......
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