Commit 887d7835 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - removed texture registration from histogram module since...

[CHANGE] - removed texture registration from histogram module since textureMapper now does this job.
parent d3cf76ce
......@@ -118,71 +118,10 @@ void WMHistogramEqualization::properties()
m_cdfResolution->setMin( 10 );
m_cdfResolution->setMax( 1000000 );
// use this callback for the other properties
WPropertyBase::PropertyChangeNotifierType propertyCallback = boost::bind( &WMHistogramEqualization::propertyChanged, this, _1 );
m_groupTex = m_properties->addPropertyGroup( "Texture Properties", "Properties only related to the texture representation." );
// several other properties
m_interpolation = m_groupTex->addProperty( "Interpolation",
"If active, the boundaries of single voxels"
" will not be visible in colormaps. The transition between"
" them will be smooth by using interpolation then.",
true,
propertyCallback );
m_threshold = m_groupTex->addProperty( "Threshold", "Values below this threshold will not be "
"shown in colormaps.", 0., propertyCallback );
m_opacity = m_groupTex->addProperty( "Opacity %", "The opacity of this data in colormaps combining"
" values from several data sets.", 100, propertyCallback );
m_opacity->setMax( 100 );
m_opacity->setMin( 0 );
m_colorMapSelectionsList = boost::shared_ptr< WItemSelection >( new WItemSelection() );
m_colorMapSelectionsList->addItem( "Grayscale", "" );
m_colorMapSelectionsList->addItem( "Rainbow", "" );
m_colorMapSelectionsList->addItem( "Hot iron", "" );
m_colorMapSelectionsList->addItem( "Red-Yellow", "" );
m_colorMapSelectionsList->addItem( "Atlas", "" );
m_colorMapSelectionsList->addItem( "Blue-Green-Purple", "" );
m_colorMapSelection = m_groupTex->addProperty( "Colormap", "Colormap type.", m_colorMapSelectionsList->getSelectorFirst(), propertyCallback );
WPropertyHelper::PC_SELECTONLYONE::addTo( m_colorMapSelection );
// call WModule's initialization
WModule::properties();
}
void WMHistogramEqualization::propertyChanged( boost::shared_ptr< WPropertyBase > property )
{
if ( !m_lastOutputDataSet )
{
return;
}
if ( property == m_threshold )
{
m_lastOutputDataSet->getTexture()->setThreshold( m_threshold->get() );
}
else if ( property == m_opacity )
{
m_lastOutputDataSet->getTexture()->setOpacity( m_opacity->get() );
}
else if ( property == m_active )
{
m_lastOutputDataSet->getTexture()->setGloballyActive( m_active->get() );
}
else if ( property == m_interpolation )
{
m_lastOutputDataSet->getTexture()->setInterpolation( m_interpolation->get() );
}
else if ( property == m_colorMapSelection )
{
m_lastOutputDataSet->getTexture()->setSelectedColormap( m_colorMapSelection->get( true ).getItemIndexOfSelected( 0 ) );
}
}
void WMHistogramEqualization::moduleMain()
{
// get notified about data changes
......@@ -328,23 +267,11 @@ void WMHistogramEqualization::moduleMain()
// update output with a new dataset, reuse grid
debugLog() << "Updating output";
// de-register at datahandler
if ( m_lastOutputDataSet )
{
WDataHandler::deregisterDataSet( m_lastOutputDataSet );
}
// construct
m_lastOutputDataSet = boost::shared_ptr< WDataSetScalar >(
m_output->updateData( boost::shared_ptr< WDataSetScalar >(
new WDataSetScalar( boost::shared_ptr< WValueSetBase >(
new WValueSet< unsigned char >( 0, 1, newData, W_DT_UNSIGNED_CHAR ) ), dataSet->getGrid() )
);
m_lastOutputDataSet->getTexture()->setSelectedColormap( 4 );
// register new
WDataHandler::registerDataSet( m_lastOutputDataSet );
m_output->updateData( m_lastOutputDataSet );
) );
debugLog() << "Done";
......@@ -353,15 +280,3 @@ void WMHistogramEqualization::moduleMain()
}
}
void WMHistogramEqualization::activate()
{
// deactivate the output if wanted
if ( m_lastOutputDataSet )
{
m_lastOutputDataSet->getTexture()->setGloballyActive( m_active->get( true ) );
}
// Always call WModule's activate!
WModule::activate();
}
......@@ -94,18 +94,6 @@ protected:
*/
virtual void properties();
/**
* Callback for m_active. Overwrite this in your modules to handle m_active changes separately.
*/
virtual void activate();
/**
* Called whenever a property changes.
*
* \param property the property that has been changed
*/
void propertyChanged( boost::shared_ptr< WPropertyBase > property );
private:
/**
......@@ -118,11 +106,6 @@ private:
*/
boost::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output;
/**
* This is a pointer to the dataset the module is currently working on.
*/
boost::shared_ptr< WDataSetScalar > m_lastOutputDataSet;
/**
* A condition used to notify about changes in several properties.
*/
......@@ -162,37 +145,6 @@ private:
* Group for keeping all the equalizing-related props
*/
WPropGroup m_equalizing;
// TODO(ebaum): cleanup -> belongs to some central place
/**
* grouping the texture display properties
*/
WPropGroup m_groupTex;
/**
* Interpolation?
*/
WPropBool m_interpolation;
/**
* A list of color map selection types
*/
boost::shared_ptr< WItemSelection > m_colorMapSelectionsList;
/**
* Selection property for color map
*/
WPropSelection m_colorMapSelection;
/**
* Threshold value for this data.
*/
WPropDouble m_threshold;
/**
* Opacity value for this data.
*/
WPropInt m_opacity;
};
#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