Commit 49a6d795 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] - ported texture mapper to new tex mapping infrastructure.

parent fad34dba
......@@ -6,14 +6,14 @@ ADD_SUBDIRECTORY( coordinateHUD )
ADD_SUBDIRECTORY( coordinateSystem )
ADD_SUBDIRECTORY( distanceMap )
ADD_SUBDIRECTORY( distanceMapIsosurface )
ADD_SUBDIRECTORY( fiberDisplay )
#ADD_SUBDIRECTORY( fiberDisplay )
ADD_SUBDIRECTORY( functionalMRIViewer )
ADD_SUBDIRECTORY( gridRenderer )
ADD_SUBDIRECTORY( hud )
ADD_SUBDIRECTORY( imageSpaceLIC )
ADD_SUBDIRECTORY( isosurfaceRaytracer )
ADD_SUBDIRECTORY( lic )
ADD_SUBDIRECTORY( marchingCubes )
#ADD_SUBDIRECTORY( marchingCubes )
ADD_SUBDIRECTORY( paintTexture )
ADD_SUBDIRECTORY( superquadricGlyphs )
ADD_SUBDIRECTORY( template )
......
ADD_SUBDIRECTORY( applyMask )
ADD_SUBDIRECTORY( arbitraryPlane )
#ADD_SUBDIRECTORY( arbitraryPlane )
ADD_SUBDIRECTORY( atlasCreator )
ADD_SUBDIRECTORY( atlasSurfaces )
ADD_SUBDIRECTORY( calculateGFA )
......@@ -21,16 +21,16 @@ ADD_SUBDIRECTORY( fiberSelection )
ADD_SUBDIRECTORY( fiberTransform )
ADD_SUBDIRECTORY( gaussProcesses )
ADD_SUBDIRECTORY( imageExtractor )
ADD_SUBDIRECTORY( lineGuidedSlice )
ADD_SUBDIRECTORY( overlayAtlas )
#ADD_SUBDIRECTORY( lineGuidedSlice )
#ADD_SUBDIRECTORY( overlayAtlas )
ADD_SUBDIRECTORY( probTractDisplay )
ADD_SUBDIRECTORY( scalarOperator )
ADD_SUBDIRECTORY( scalarSegmentation )
ADD_SUBDIRECTORY( splineSurface )
#ADD_SUBDIRECTORY( splineSurface )
ADD_SUBDIRECTORY( subtractDataSetScalar )
ADD_SUBDIRECTORY( surfaceParameterAnimator )
ADD_SUBDIRECTORY( vectorOperator )
#ADD_SUBDIRECTORY( textureMapper )
ADD_SUBDIRECTORY( textureMapper )
IF( Teem_FOUND )
IF( OSSIM_FOUND AND OW_USE_OSSIM )
......
......@@ -24,8 +24,8 @@
#include <string>
#include "../../dataHandler/WDataHandler.h"
#include "../../dataHandler/WDataTexture3D.h"
#include "../../dataHandler/WDataTexture3D_2.h"
#include "../../graphicsEngine/WGEColormapping.h"
#include "../../kernel/WKernel.h"
#include "WMTextureMapper.xpm"
......@@ -77,35 +77,6 @@ void WMTextureMapper::connectors()
void WMTextureMapper::properties()
{
m_propCondition = boost::shared_ptr< WCondition >( new WCondition() );
WPropertyBase::PropertyChangeNotifierType propertyCallback = boost::bind( &WMTextureMapper::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 );
WModule::properties();
}
......@@ -140,10 +111,12 @@ void WMTextureMapper::moduleMain()
debugLog() << "Registering new texture";
// de-register at datahandler
// de-register last input
if ( m_lastDataSet )
{
WDataHandler::deregisterDataSet( m_lastDataSet );
m_properties->removeProperty( m_lastDataSet->getTexture2()->getProperties() );
m_infoProperties->removeProperty( m_lastDataSet->getTexture2()->getInformationProperties() );
WGEColormapping::deregisterTexture( m_lastDataSet->getTexture2() );
}
// register only valid data
......@@ -154,20 +127,24 @@ void WMTextureMapper::moduleMain()
// register new
if ( m_lastDataSet->isTexture() )
{
WDataHandler::registerDataSet( m_lastDataSet );
m_properties->addProperty( m_lastDataSet->getTexture2()->getProperties() );
m_infoProperties->addProperty( m_lastDataSet->getTexture2()->getInformationProperties() );
WGEColormapping::registerTexture( m_lastDataSet->getTexture2() );
}
else
{
warnLog() << "Connected dataset is not usable as a texture.";
}
}
}
}
// remove if module is removed
if ( m_lastDataSet )
{
WDataHandler::deregisterDataSet( m_lastDataSet );
WGEColormapping::deregisterTexture( m_lastDataSet->getTexture2() );
// NOTE: the props get removed automatically
}
}
......@@ -176,39 +153,10 @@ void WMTextureMapper::activate()
// deactivate the output if wanted
if ( m_lastDataSet )
{
m_lastDataSet->getTexture()->setGloballyActive( m_active->get( true ) );
m_lastDataSet->getTexture2()->active()->set( m_active->get( true ) );
}
// Always call WModule's activate!
WModule::activate();
}
void WMTextureMapper::propertyChanged( boost::shared_ptr< WPropertyBase > property )
{
if ( !m_lastDataSet )
{
return;
}
if ( property == m_threshold )
{
m_lastDataSet->getTexture()->setThreshold( m_threshold->get() );
}
else if ( property == m_opacity )
{
m_lastDataSet->getTexture()->setOpacity( m_opacity->get() );
}
else if ( property == m_active )
{
m_lastDataSet->getTexture()->setGloballyActive( m_active->get() );
}
else if ( property == m_interpolation )
{
m_lastDataSet->getTexture()->setInterpolation( m_interpolation->get() );
}
else if ( property == m_colorMapSelection )
{
m_lastDataSet->getTexture()->setSelectedColormap( m_colorMapSelection->get( true ).getItemIndexOfSelected( 0 ) );
}
}
......@@ -110,44 +110,6 @@ private:
* This is a pointer to the dataset the module is currently working on.
*/
boost::shared_ptr< WDataSetSingle > m_lastDataSet;
// TODO(ebaum): cleanup -> belongs to some central place
/**
* Called whenever a property changes.
*
* \param property the property that has been changed
*/
void propertyChanged( boost::shared_ptr< WPropertyBase > property );
/**
* 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 // WMTEXTUREMAPPER_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