Commit a50ca2d5 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[MERGE]

parents 0b4af10e 79e5b492
......@@ -85,14 +85,57 @@ void WMHistogramEqualization::connectors()
void WMHistogramEqualization::properties()
{
m_propCondition = boost::shared_ptr< WCondition >( new WCondition() );
// enable histogram equalization?
m_equalize = m_properties->addProperty( "Equalize Histogram", "If true, the dataset's histogram will be equalized which ensures that the\
cumulative histogram is a linear function.", true, m_propCondition );
// call WModule's initialization
WModule::properties();
}
void WMHistogramEqualization::moduleMain()
{
// get notified about data changes
m_moduleState.setResetable( true, true );
m_moduleState.add( m_input->getDataChangedCondition() );
// Remember the condition provided to some properties in properties()? The condition can now be used with this condition set.
m_moduleState.add( m_propCondition );
ready();
waitForStop();
// main loop
while ( !m_shutdownFlag() )
{
debugLog() << "Waiting ...";
m_moduleState.wait();
// woke up since the module is requested to finish?
if ( m_shutdownFlag() )
{
break;
}
// To query whether an input was updated, simply ask the input:
bool dataUpdated = m_input->updated();
// Remember the above criteria. We now need to check if the data is valid. After a connect-update, it might be NULL.
boost::shared_ptr< WDataSetScalar > dataSet = m_input->getData();
dataUpdated = dataUpdated && dataSet;
// this ensures the below code only gets executed upon data or property change
if ( !dataUpdated && !m_equalize->changed() )
{
continue;
}
// The data is valid and we received an update. The data is not NULL but may be the same as in previous loops.
debugLog() << "Recalculating";
// Grab the histogram
}
}
......@@ -115,6 +115,11 @@ private:
* A condition used to notify about changes in several properties.
*/
boost::shared_ptr< WCondition > m_propCondition;
/**
* If true, histogram equalization is turned on.
*/
WPropBool m_equalize;
};
#endif // WMHISTOGRAMEQUALIZATION_H
......
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