Commit 1a6c970a authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[MERGE]

parents 3d2902c4 b6ee4c9e
...@@ -85,7 +85,7 @@ void WMBermanTracking::connectors() ...@@ -85,7 +85,7 @@ void WMBermanTracking::connectors()
"inSH", "A spherical harmonics dataset." ) "inSH", "A spherical harmonics dataset." )
); );
m_inputGFA = boost::shared_ptr< WModuleInputData< WDataSetSingle > >( new WModuleInputData< WDataSetSingle >( shared_from_this(), m_inputGFA = boost::shared_ptr< WModuleInputData< WDataSetScalar > >( new WModuleInputData< WDataSetScalar >( shared_from_this(),
"inGFA", "GFA." ) "inGFA", "GFA." )
); );
...@@ -93,7 +93,7 @@ void WMBermanTracking::connectors() ...@@ -93,7 +93,7 @@ void WMBermanTracking::connectors()
"inResiduals", "The residual HARDI data." ) "inResiduals", "The residual HARDI data." )
); );
m_output = boost::shared_ptr< WModuleOutputData< WDataSetSingle > >( new WModuleOutputData< WDataSetSingle >( shared_from_this(), m_output = boost::shared_ptr< WModuleOutputData< WDataSetScalar > >( new WModuleOutputData< WDataSetScalar >( shared_from_this(),
"outProb", "The probabilistic tracking result." ) "outProb", "The probabilistic tracking result." )
); );
...@@ -156,6 +156,7 @@ void WMBermanTracking::moduleMain() ...@@ -156,6 +156,7 @@ void WMBermanTracking::moduleMain()
m_moduleState.setResetable( true, true ); m_moduleState.setResetable( true, true );
m_moduleState.add( m_input->getDataChangedCondition() ); m_moduleState.add( m_input->getDataChangedCondition() );
m_moduleState.add( m_inputResidual->getDataChangedCondition() ); m_moduleState.add( m_inputResidual->getDataChangedCondition() );
m_moduleState.add( m_inputGFA->getDataChangedCondition() );
m_moduleState.add( m_propCondition ); m_moduleState.add( m_propCondition );
m_moduleState.add( m_exceptionCondition ); m_moduleState.add( m_exceptionCondition );
...@@ -176,32 +177,37 @@ void WMBermanTracking::moduleMain() ...@@ -176,32 +177,37 @@ void WMBermanTracking::moduleMain()
boost::shared_ptr< WDataSetSphericalHarmonics > inData = m_input->getData(); boost::shared_ptr< WDataSetSphericalHarmonics > inData = m_input->getData();
boost::shared_ptr< WDataSetRawHARDI > inData2 = m_inputResidual->getData(); boost::shared_ptr< WDataSetRawHARDI > inData2 = m_inputResidual->getData();
bool dataChanged = ( m_dataSet != inData ) || ( m_dataSetResidual != inData2 ); boost::shared_ptr< WDataSetScalar > inData3 = m_inputGFA->getData();
bool dataChanged = ( m_dataSet != inData ) || ( m_dataSetResidual != inData2 ) || ( m_gfa != inData3 );
if( dataChanged || !m_dataSet || !m_dataSetResidual ) if( dataChanged )
{ {
if( dataChanged ) if( m_trackingPool )
{ {
if( m_trackingPool ) m_trackingPool->stop();
m_trackingPool->wait();
if( m_currentProgress )
{ {
m_trackingPool->stop(); m_currentProgress->finish();
m_trackingPool->wait();
if( m_currentProgress )
{
m_currentProgress->finish();
}
} }
} }
m_dataSet = inData; m_dataSet = inData;
m_dataSetResidual = inData2; m_dataSetResidual = inData2;
m_gfa = inData3;
}
if( !m_dataSet || !m_dataSetResidual ) if( m_startTrigger->get( true ) == WPVBaseTypes::PV_TRIGGER_TRIGGERED )
{ {
continue; m_startTrigger->set( WPVBaseTypes::PV_TRIGGER_READY, false );
}
else if( m_dataSet && m_dataSetResidual && m_gfa )
{ {
if( m_result )
{
WDataHandler::deregisterDataSet( m_result );
}
// calculate some matrices needed for the residuals // calculate some matrices needed for the residuals
std::vector< wmath::WUnitSphereCoordinates > c; std::vector< wmath::WUnitSphereCoordinates > c;
for( std::size_t i = 0; i < m_dataSetResidual->getOrientations().size(); ++i ) for( std::size_t i = 0; i < m_dataSetResidual->getOrientations().size(); ++i )
...@@ -216,32 +222,21 @@ void WMBermanTracking::moduleMain() ...@@ -216,32 +222,21 @@ void WMBermanTracking::moduleMain()
m_HMat = m_BMat * wmath::WSymmetricSphericalHarmonic::getSHFittingMatrix( c, 4, 0.0, false ); m_HMat = m_BMat * wmath::WSymmetricSphericalHarmonic::getSHFittingMatrix( c, 4, 0.0, false );
WAssert( m_HMat.getNbCols() == m_HMat.getNbRows(), "" ); WAssert( m_HMat.getNbCols() == m_HMat.getNbRows(), "" );
m_gfa = m_inputGFA->getData(); // get current properties
m_currentMinFA = m_minFA->get( true );
m_currentMinPoints = static_cast< std::size_t >( m_minPoints->get( true ) );
m_currentMinCos = m_minCos->get( true );
m_currentProbabilistic = m_probabilistic->get( true );
m_currentRatio = m_ratio->get( true );
m_currentEpsImpr = m_epsImpr->get( true );
// start tracking
resetTracking();
m_hits = boost::shared_ptr< std::vector< float > >( new std::vector< float >( m_dataSet->getGrid()->size(), 0.0 ) );
m_trackingPool->run();
debugLog() << "Running tracking function.";
} }
} }
if( m_dataSet && m_dataSetResidual && m_gfa && ( dataChanged || m_startTrigger->get( true ) == WPVBaseTypes::PV_TRIGGER_TRIGGERED ) )
{
m_startTrigger->set( WPVBaseTypes::PV_TRIGGER_READY, false );
if( m_result )
{
WDataHandler::deregisterDataSet( m_result );
}
// get current properties
m_currentMinFA = m_minFA->get( true );
m_currentMinPoints = static_cast< std::size_t >( m_minPoints->get( true ) );
m_currentMinCos = m_minCos->get( true );
m_currentProbabilistic = m_probabilistic->get( true );
m_currentRatio = m_ratio->get( true );
m_currentEpsImpr = m_epsImpr->get( true );
// start tracking
resetTracking();
m_hits = boost::shared_ptr< std::vector< float > >( new std::vector< float >( m_dataSet->getGrid()->size(), 0.0 ) );
m_trackingPool->run();
debugLog() << "Running tracking function.";
}
else if( m_trackingPool && m_trackingPool->status() == W_THREADS_FINISHED ) else if( m_trackingPool && m_trackingPool->status() == W_THREADS_FINISHED )
{ {
// get result // get result
...@@ -254,9 +249,9 @@ void WMBermanTracking::moduleMain() ...@@ -254,9 +249,9 @@ void WMBermanTracking::moduleMain()
m_outputFibers->updateData( m_fiberSet ); m_outputFibers->updateData( m_fiberSet );
m_trackingPool = boost::shared_ptr< TrackingFuncType >(); m_trackingPool = boost::shared_ptr< TrackingFuncType >();
boost::shared_ptr< WValueSet< float > > vs( new WValueSet< float >( 1, 1, *m_hits, DataType< float >::type ) ); boost::shared_ptr< WValueSet< float > > vs( new WValueSet< float >( 0, 1, *m_hits, DataType< float >::type ) );
m_result = boost::shared_ptr< WDataSetSingle >( new WDataSetSingle( vs, m_dataSet->getGrid() ) ); m_result = boost::shared_ptr< WDataSetScalar >( new WDataSetScalar( vs, m_dataSet->getGrid() ) );
m_result->setFileName( "Berman_prob_tracking_result" ); m_result->setFileName( "Berman_prob_tracking_result" );
m_result->getTexture()->setThreshold( 0.05f ); m_result->getTexture()->setThreshold( 0.05f );
m_result->getTexture()->setSelectedColormap( 2 ); m_result->getTexture()->setSelectedColormap( 2 );
...@@ -374,7 +369,7 @@ wmath::WVector3D WMBermanTracking::getDirFunc( boost::shared_ptr< WDataSetSingle ...@@ -374,7 +369,7 @@ wmath::WVector3D WMBermanTracking::getDirFunc( boost::shared_ptr< WDataSetSingle
WAssert( v != -1, "" ); WAssert( v != -1, "" );
WAssert( m_gfa, "" ); WAssert( m_gfa, "" );
if( m_gfa->getValueAt( v ) < m_currentMinFA ) if( boost::shared_dynamic_cast< WDataSetSingle >( m_gfa )->getValueAt( v ) < m_currentMinFA )
{ {
return wmath::WVector3D( 0.0, 0.0, 0.0 ); return wmath::WVector3D( 0.0, 0.0, 0.0 );
} }
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "../../dataHandler/WDataSetSphericalHarmonics.h" #include "../../dataHandler/WDataSetSphericalHarmonics.h"
#include "../../dataHandler/WDataSetFibers.h" #include "../../dataHandler/WDataSetFibers.h"
#include "../../dataHandler/WDataSetRawHARDI.h" #include "../../dataHandler/WDataSetRawHARDI.h"
#include "../../dataHandler/WDataSetScalar.h"
#include "../../dataHandler/WThreadedTrackingFunction.h" #include "../../dataHandler/WThreadedTrackingFunction.h"
#include "../../dataHandler/WFiberAccumulator.h" #include "../../dataHandler/WFiberAccumulator.h"
...@@ -184,7 +185,7 @@ private: ...@@ -184,7 +185,7 @@ private:
wmath::WSymmetricSphericalHarmonic createRandomODF( std::size_t i ); wmath::WSymmetricSphericalHarmonic createRandomODF( std::size_t i );
//! Stores the gfa measure for the input data. //! Stores the gfa measure for the input data.
boost::shared_ptr< WDataSetSingle > m_gfa; boost::shared_ptr< WDataSetScalar > m_gfa;
//! Stores a matrix representing the funk-radon-transform. //! Stores a matrix representing the funk-radon-transform.
wmath::WMatrix< double > m_frtMat; wmath::WMatrix< double > m_frtMat;
...@@ -214,7 +215,7 @@ private: ...@@ -214,7 +215,7 @@ private:
boost::shared_ptr< WDataSetRawHARDI > m_dataSetResidual; boost::shared_ptr< WDataSetRawHARDI > m_dataSetResidual;
//! The output dataset. //! The output dataset.
boost::shared_ptr< WDataSetSingle > m_result; boost::shared_ptr< WDataSetScalar > m_result;
//! Stores the number of hits for a voxel. //! Stores the number of hits for a voxel.
boost::shared_ptr< std::vector< float > > m_hits; boost::shared_ptr< std::vector< float > > m_hits;
...@@ -223,7 +224,7 @@ private: ...@@ -223,7 +224,7 @@ private:
boost::shared_ptr< WDataSetFibers > m_fiberSet; boost::shared_ptr< WDataSetFibers > m_fiberSet;
//! The output Connector. //! The output Connector.
boost::shared_ptr< WModuleOutputData< WDataSetSingle > > m_output; boost::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output;
//! The fiber output, used for testing. //! The fiber output, used for testing.
boost::shared_ptr< WModuleOutputData< WDataSetFibers > > m_outputFibers; boost::shared_ptr< WModuleOutputData< WDataSetFibers > > m_outputFibers;
...@@ -235,7 +236,7 @@ private: ...@@ -235,7 +236,7 @@ private:
boost::shared_ptr< WModuleInputData< WDataSetRawHARDI > > m_inputResidual; boost::shared_ptr< WModuleInputData< WDataSetRawHARDI > > m_inputResidual;
//! The input for the gfa. //! The input for the gfa.
boost::shared_ptr< WModuleInputData< WDataSetSingle > > m_inputGFA; boost::shared_ptr< WModuleInputData< WDataSetScalar > > m_inputGFA;
//! The threadpool for the tracking. //! The threadpool for the tracking.
boost::shared_ptr< TrackingFuncType > m_trackingPool; boost::shared_ptr< TrackingFuncType > m_trackingPool;
......
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