Commit ba391d49 authored by Stefan Philips's avatar Stefan Philips
Browse files

[ADD] Threshold parameters for CSA reconstruction as module propoerties

parent 441da628
......@@ -120,6 +120,8 @@ void WMHARDIToSphericalHarmonics::moduleMain()
m_doErrorCalculation->setHidden( false );
m_doResidualCalculation->setHidden( false );
m_doNormalisation->setHidden( false );
m_CSADelta1->setHidden();
m_CSADelta2->setHidden();
reconstructionType = DEFAULT;
break;
case 1:
......@@ -127,6 +129,8 @@ void WMHARDIToSphericalHarmonics::moduleMain()
m_doErrorCalculation->setHidden();
m_doResidualCalculation->setHidden();
m_doNormalisation->setHidden();
m_CSADelta1->setHidden( false );
m_CSADelta2->setHidden( false );
reconstructionType = CSA;
break;
}
......@@ -215,6 +219,8 @@ void WMHARDIToSphericalHarmonics::moduleMain()
parameter.m_doErrorCalculation = false;
parameter.m_normalize = false;
parameter.m_doFunkRadonTransformation = false;
parameter.m_CSADelta1 = m_CSADelta1->get( true );
parameter.m_CSADelta2 = m_CSADelta2->get( true );
transformMatrix = WSymmetricSphericalHarmonic::getSHFittingMatrixForConstantSolidAngle( gradients,
order,
m_regularisationFactorLambda->get( true ) );
......@@ -320,6 +326,20 @@ void WMHARDIToSphericalHarmonics::properties()
false,
m_propCondition );
m_CSADelta1 = m_properties->addProperty( "delta 1",
"delta1 threshold",
0.01,
m_propCondition );
m_CSADelta1->setMin( 0.0 );
m_CSADelta1->setMax( 1.0 );
m_CSADelta2 = m_properties->addProperty( "delta 2",
"delta2 threshold",
0.01,
m_propCondition );
m_CSADelta2->setMin( 0.0 );
m_CSADelta2->setMax( 1.0 );
// vista-daten
// order Gesamtfehler
// 0 8,7%
......
......@@ -141,6 +141,9 @@ private:
*/
WPropBool m_doNormalisation;
WPropDouble m_CSADelta1; //!< Delta1 value for the constant solid angle reconstruction.
WPropDouble m_CSADelta2; //!< Delta2 value for the constant solid angle reconstruction.
/**
* This is a pointer to the dataset the module is currently working on.
*/
......
......@@ -68,7 +68,9 @@ public:
* \param flag A reference to a shutdown flag that we should listen to.
*/
ThreadParameter( WBoolFlag const& flag ) // NOLINT no explicit
: m_shutdownFlag( flag )
: m_CSADelta1( 0.01 ),
m_CSADelta2( 0.01 ),
m_shutdownFlag( flag )
{
}
......@@ -149,6 +151,16 @@ public:
*/
bool m_csa;
/**
* Delta1 value for the constant solid angle reconstruction.
*/
double m_CSADelta1;
/**
* Delta2 value for the constant solid angle reconstruction.
*/
double m_CSADelta2;
/**
* A shutdownFlag that may tell the thread to stop.
*/
......@@ -244,28 +256,26 @@ void WSphericalHarmonicsCoefficientsThread< T >::threadMain()
// double minVal = 1e99;
// double maxVal = -1e99;
double thresholdDelta1 = 0.01;
double thresholdDelta2 = 0.01;
for( std::vector< size_t >::const_iterator it = m_parameter.m_validIndices.begin(); it != m_parameter.m_validIndices.end(); it++, idx++ )
{
if( m_parameter.m_csa )
{
double val = static_cast< double >( allMeasures[ *it ] ) / S0avg;
if( val < 0.0)
if( val < 0.0 )
{
val = thresholdDelta1 / 2.0;
val = m_parameter.m_CSADelta1 / 2.0;
}
else if( val < thresholdDelta1 )
else if( val < m_parameter.m_CSADelta1 )
{
val = thresholdDelta1 / 2.0 + val * val / ( 2.0 * thresholdDelta1 );
val = m_parameter.m_CSADelta1 / 2.0 + val * val / ( 2.0 * m_parameter.m_CSADelta1 );
}
else if( val > 1.0 - thresholdDelta2 && val < 1.0 )
else if( val > 1.0 - m_parameter.m_CSADelta2 && val < 1.0 )
{
val = 1.0 - thresholdDelta2 / 2.0 - std::pow( 1.0 - val, 2 ) / ( 2.0 * thresholdDelta2 );
val = 1.0 - m_parameter.m_CSADelta2 / 2.0 - std::pow( 1.0 - val, 2 ) / ( 2.0 * m_parameter.m_CSADelta2 );
}
else if( val >= 1.0 )
{
val = 1.0 - thresholdDelta2 / 2.0;
val = 1.0 - m_parameter.m_CSADelta2 / 2.0;
}
measures[ idx ] = std::log( -std::log( val ) );
}
......
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