Commit ce0b3c34 authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[MERGE]

parents 9444c50e 35899368
......@@ -96,7 +96,7 @@ IF( CMAKE_HOST_SYSTEM MATCHES Windows )
SET( CMAKE_SHARED_LINKER_FLAGS " /STACK:10000000 /machine:I386 /NODEFAULTLIB:${EXCLUDE_LIBRARIES}" CACHE STRING "" FORCE )
SET( CMAKE_EXE_LINKER_FLAGS " /STACK:10000000 /machine:I386 /NODEFAULTLIB:${EXCLUDE_LIBRARIES}" CACHE STRING "" FORCE )
ELSE()
SET( CMAKE_CXX_FLAGS "-frtti -pedantic -ansi -Wall -Wno-long-long -Wextra" CACHE STRING "" FORCE )
SET( CMAKE_CXX_FLAGS "-frtti -pedantic -ansi -Wall -Wno-long-long -Wextra -Wold-style-cast" CACHE STRING "" FORCE )
SET( CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "" FORCE )
SET( CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG -O0" CACHE STRING "" FORCE )
ENDIF()
......
......@@ -194,7 +194,7 @@ osg::ref_ptr< osg::Image > WDataTexture3D::createTexture3D( int16_t* source, int
unsigned char* data = ima->data();
unsigned char* charSource = ( unsigned char* )&tempSource[0];
unsigned char* charSource = reinterpret_cast< unsigned char* >( &tempSource[0] );
for ( unsigned int i = 0; i < m_grid->getNbCoordsX() * m_grid->getNbCoordsY() * m_grid->getNbCoordsZ() * 2 ; ++i )
{
......@@ -214,7 +214,7 @@ osg::ref_ptr< osg::Image > WDataTexture3D::createTexture3D( float* source, int c
unsigned char* data = ima->data();
unsigned char* charSource = ( unsigned char* )source;
unsigned char* charSource = reinterpret_cast< unsigned char* >( source );
for ( unsigned int i = 0; i < m_grid->getNbCoordsX() * m_grid->getNbCoordsY() * m_grid->getNbCoordsZ() * 4 ; ++i )
{
......
......@@ -219,7 +219,7 @@ void WQtDatasetBrowser::addModule2( boost::shared_ptr< WModule > module, int sub
{
if ( boost::shared_dynamic_cast< WMData >( module ) )
{
WQtSubjectTreeItem* subject = ( WQtSubjectTreeItem* )m_treeWidget->topLevelItem( subjectId + 1 );
WQtSubjectTreeItem* subject = static_cast< WQtSubjectTreeItem* >( m_treeWidget->topLevelItem( subjectId + 1 ) );
subject->setExpanded( true );
WQtDatasetTreeItem* item = subject->addDatasetItem( module );
item->setDisabled( true );
......@@ -235,7 +235,7 @@ void WQtDatasetBrowser::addModule2( boost::shared_ptr< WModule > module, int sub
WQtDatasetTreeItem* WQtDatasetBrowser::addDataset( boost::shared_ptr< WModule > module, int subjectId )
{
int c = getFirstSubject();
WQtSubjectTreeItem* subject = ( WQtSubjectTreeItem* )m_treeWidget->topLevelItem( subjectId + c );
WQtSubjectTreeItem* subject = static_cast< WQtSubjectTreeItem* >( m_treeWidget->topLevelItem( subjectId + c ) );
subject->setExpanded( true );
WQtDatasetTreeItem* item = subject->addDatasetItem( module );
item->setDisabled( true );
......@@ -258,7 +258,7 @@ void WQtDatasetBrowser::addRoi( boost::shared_ptr< WRMROIRepresentation > roi )
{
case ROI :
{
WQtRoiTreeItem* roiItem =( ( WQtRoiTreeItem* ) m_treeWidget->selectedItems().at( 0 ) );
WQtRoiTreeItem* roiItem =( static_cast< WQtRoiTreeItem* >( m_treeWidget->selectedItems().at( 0 ) ) );
m_tiRois->setExpanded( true );
roiItem->setExpanded( true );
WQtRoiTreeItem* item = roiItem->addRoiItem( roi );
......@@ -267,7 +267,7 @@ void WQtDatasetBrowser::addRoi( boost::shared_ptr< WRMROIRepresentation > roi )
}
case SUBROI :
{
WQtRoiTreeItem* roiItem =( ( WQtRoiTreeItem* ) m_treeWidget->selectedItems().at( 0 )->parent() );
WQtRoiTreeItem* roiItem =( static_cast< WQtRoiTreeItem* >( m_treeWidget->selectedItems().at( 0 )->parent() ) );
m_tiRois->setExpanded( true );
roiItem->setExpanded( true );
WQtRoiTreeItem* item = roiItem->addRoiItem( roi );
......@@ -295,11 +295,11 @@ boost::shared_ptr< WModule > WQtDatasetBrowser::getSelectedModule()
{
if ( m_treeWidget->selectedItems().at( 0 )->type() == 1 )
{
return ( ( WQtDatasetTreeItem* ) m_treeWidget->selectedItems().at( 0 ) )->getModule();
return ( static_cast< WQtDatasetTreeItem* >( m_treeWidget->selectedItems().at( 0 ) )->getModule() );
}
else if ( m_treeWidget->selectedItems().at( 0 )->type() == 3 )
{
return ( ( WQtModuleTreeItem* ) m_treeWidget->selectedItems().at( 0 ) )->getModule();
return ( static_cast< WQtModuleTreeItem* >( m_treeWidget->selectedItems().at( 0 ) )->getModule() );
}
return boost::shared_ptr< WModule >();
......
......@@ -57,7 +57,7 @@ void WMCoordinateSystem::moduleMain()
waitForStop();
// clean up stuff
// NOTE: ALLAWAYS remove your osg nodes!
// NOTE: ALWAYS remove your osg nodes!
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->remove( m_rootNode );
}
......@@ -73,27 +73,25 @@ const std::string WMCoordinateSystem::getDescription() const
void WMCoordinateSystem::properties()
{
m_properties->addBool( "dataSetAdded", false, true );
( m_properties->addBool( "active", true, true ) )->connect( boost::bind( &WMCoordinateSystem::slotPropertyChanged, this, _1 ) );
m_dataSetAddedProp = m_properties2->addProperty( "dataSetAdded", "", false, true );
m_properties->addInt( "axialPos", 80 );
m_properties->addInt( "coronalPos", 100 );
m_properties->addInt( "sagittalPos", 80 );
m_axialPosProp = m_properties2->addProperty( "axialPos", "", 80 );
m_coronalPosProp = m_properties2->addProperty( "coronalPos", "", 100 );
m_sagittalPosProp = m_properties2->addProperty( "sagittalPos", "", 80 );
m_properties->addInt( "type", 1 );
// initialize the properties with a certain standard set
// those properties will be updatet as soon as the first dataset is looaded
m_properties->addFloat( "zeroX", 80.0 );
m_properties->addFloat( "zeroY", 100.0 );
m_properties->addFloat( "zeroZ", 80.0 );
m_zeroXProp = m_properties2->addProperty( "zeroX", "", 80.0 );
m_zeroYProp = m_properties2->addProperty( "zeroY", "", 100.0 );
m_zeroZProp = m_properties2->addProperty( "zeroZ", "", 80.0 );
m_properties->addFloat( "fltX", 0.0 );
m_properties->addFloat( "fltY", 0.0 );
m_properties->addFloat( "fltZ", 0.0 );
m_fltXProp = m_properties2->addProperty( "fltX", "", 0.0 );
m_fltYProp = m_properties2->addProperty( "fltY", "", 0.0 );
m_fltZProp = m_properties2->addProperty( "fltZ", "", 0.0 );
m_properties->addFloat( "brbX", 160.0 );
m_properties->addFloat( "brbY", 200.0 );
m_properties->addFloat( "brbZ", 160.0 );
m_brbXProp = m_properties2->addProperty( "brbX", "", 160.0 );
m_brbYProp = m_properties2->addProperty( "brbY", "", 200.0 );
m_brbZProp = m_properties2->addProperty( "brbZ", "", 160.0 );
}
void WMCoordinateSystem::createGeometry()
......@@ -137,7 +135,7 @@ void WMCoordinateSystem::createGeometry()
m_rootNode->setUserData( this );
m_rootNode->addUpdateCallback( new coordinateNodeCallback );
if ( m_properties->getValue<bool>( "active" ) )
if ( m_active->get() )
{
m_rootNode->setNodeMask( 0xFFFFFFFF );
}
......@@ -149,7 +147,7 @@ void WMCoordinateSystem::createGeometry()
void WMCoordinateSystem::updateGeometry()
{
if ( !m_properties->getValue< bool > ( "dataSetAdded" ) || !WKernel::getRunningKernel()->getGui()->isInitialized()() )
if ( !m_dataSetAddedProp->get() || !WKernel::getRunningKernel()->getGui()->isInitialized()() )
{
return;
}
......@@ -157,21 +155,21 @@ void WMCoordinateSystem::updateGeometry()
boost::shared_lock< boost::shared_mutex > slock;
slock = boost::shared_lock< boost::shared_mutex >( m_updateLock );
// *******************************************************************************************************
m_properties->setValue( "dataSetAdded", false );
m_dataSetAddedProp->set( false );
findBoundingBox();
//float zeroZ = m_properties->getValue<float>( "axialPos" );
float zeroY = m_properties->getValue<float>( "coronalPos" );
float zeroX = m_properties->getValue<float>( "sagittalPos" );
//float zeroZ = m_axialPosProp->get();
float zeroY = m_coronalPosProp->get();
float zeroX = m_sagittalPosProp->get();
float fltX = m_properties->getValue<float>( "fltX" );
float fltY = m_properties->getValue<float>( "fltY" );
float fltZ = m_properties->getValue<float>( "fltZ" );
float fltX = m_fltXProp->get();
float fltY = m_fltYProp->get();
float fltZ = m_fltZProp->get();
float brbX = m_properties->getValue<float>( "brbX" );
float brbY = m_properties->getValue<float>( "brbY" );
//float brbZ = m_properties->getValue<float>( "brbZ" );
float brbX = m_brbXProp->get();
float brbY = m_brbYProp->get();
//float brbZ = m_brbZProp->get();
osg::ref_ptr<osg::Drawable> old = osg::ref_ptr<osg::Drawable>( m_boxNode->getDrawable( 0 ) );
......@@ -204,17 +202,17 @@ void WMCoordinateSystem::updateGeometry()
osg::ref_ptr<osg::Geometry> WMCoordinateSystem::createGeometryNode()
{
float zeroZ = m_properties->getValue<float>( "axialPos" );
float zeroY = m_properties->getValue<float>( "coronalPos" );
float zeroX = m_properties->getValue<float>( "sagittalPos" );
float zeroZ = m_axialPosProp->get();
float zeroY = m_coronalPosProp->get();
float zeroX = m_sagittalPosProp->get();
float fltX = m_properties->getValue<float>( "fltX" );
float fltY = m_properties->getValue<float>( "fltY" );
float fltZ = m_properties->getValue<float>( "fltZ" );
float fltX = m_fltXProp->get();
float fltY = m_fltYProp->get();
float fltZ = m_fltZProp->get();
float brbX = m_properties->getValue<float>( "brbX" );
float brbY = m_properties->getValue<float>( "brbY" );
float brbZ = m_properties->getValue<float>( "brbZ" );
float brbX = m_brbXProp->get();
float brbY = m_brbYProp->get();
float brbZ = m_brbZProp->get();
osg::ref_ptr<osg::Geometry> geometry = osg::ref_ptr<osg::Geometry>( new osg::Geometry() );
......@@ -302,7 +300,7 @@ void WMCoordinateSystem::findBoundingBox()
}
if ( count > 5 )
{
m_properties->setValue( "fltX", static_cast<float>( x ) );
m_fltXProp->set( static_cast<float>( x ) );
break;
}
}
......@@ -322,7 +320,7 @@ void WMCoordinateSystem::findBoundingBox()
}
if ( count > 5 )
{
m_properties->setValue( "brbX", static_cast<float>( x ) );
m_brbXProp->set( static_cast<float>( x ) );
break;
}
}
......@@ -343,7 +341,7 @@ void WMCoordinateSystem::findBoundingBox()
}
if ( count > 5 )
{
m_properties->setValue( "fltY", static_cast<float>( y ) );
m_fltYProp->set( static_cast<float>( y ) );
break;
}
}
......@@ -363,7 +361,7 @@ void WMCoordinateSystem::findBoundingBox()
}
if ( count > 5 )
{
m_properties->setValue( "brbY", static_cast<float>( y ) );
m_brbYProp->set( static_cast<float>( y ) );
break;
}
}
......@@ -386,7 +384,7 @@ void WMCoordinateSystem::findBoundingBox()
}
if ( count > 5 )
{
m_properties->setValue( "fltZ", static_cast<float>( z ) );
m_fltZProp->set( static_cast<float>( z ) );
break;
}
}
......@@ -406,24 +404,25 @@ void WMCoordinateSystem::findBoundingBox()
}
if ( count > 5 )
{
m_properties->setValue( "brbZ", static_cast<float>( z ) );
m_brbZProp->set( static_cast<float>( z ) );
break;
}
}
}
}
void WMCoordinateSystem::slotPropertyChanged( std::string propertyName )
void WMCoordinateSystem::activate()
{
if ( propertyName == "active" )
// Activate/Deactivate the coordinate system
if ( m_active->get() )
{
if ( m_properties->getValue<bool>( "active" ) )
{
m_rootNode->setNodeMask( 0xFFFFFFFF );
}
else
{
m_rootNode->setNodeMask( 0x0 );
}
m_rootNode->setNodeMask( 0xFFFFFFFF );
}
else
{
m_rootNode->setNodeMask( 0x0 );
}
// Always call WModule's activate!
WModule::activate();
}
......@@ -90,18 +90,34 @@ protected:
virtual void moduleMain();
private:
WPropBool m_dataSetAddedProp; //!< TODO(schurade): document this.
WPropInt m_axialPosProp; //!< Axial slice position.
WPropInt m_coronalPosProp; //!< Coronal slice position.
WPropInt m_sagittalPosProp; //!< Sagittal slice position.
WPropDouble m_fltXProp; //!< Front left top corner X comp.
WPropDouble m_fltYProp; //!< Front left top corner Y comp.
WPropDouble m_fltZProp; //!< Front left top corner Z comp.
WPropDouble m_brbXProp; //!< Back right bottom corner X comp.
WPropDouble m_brbYProp; //!< Back right bottom corner Y comp.
WPropDouble m_brbZProp; //!< Back right bottom corner Z comp.
WPropDouble m_zeroXProp; //!< Zero point X comp.
WPropDouble m_zeroYProp; //!< Zero point Y comp.
WPropDouble m_zeroZProp; //!< Zero point Z comp.
/**
* initialize the properties for this module
*/
void properties();
/**
* Gets signaled from the properties object when something was changed
*
* \param propertyName the name of the property that has changed.
* Callback for m_active. Overwrite this in your modules to handle m_active changes separately.
*/
void slotPropertyChanged( std::string propertyName );
virtual void activate();
/**
* initial creation function for the slice geometry
......
......@@ -489,6 +489,6 @@ double WMDistanceMap::xxgauss( double x, double sigma )
{
double y, z, a = 2.506628273;
z = x / sigma;
y = exp( ( double ) -z * z * 0.5 ) / ( sigma * a );
y = exp( -z * z * 0.5 ) / ( sigma * a );
return y;
}
......@@ -314,9 +314,9 @@ osg::ref_ptr<osg::Geometry> WMNavSlices::createGeometry( int slice )
{
float maxDim = 255.0;
float xSlice = ( float )( m_sagittalPos->get() );
float ySlice = ( float )( m_coronalPos->get() );
float zSlice = ( float )( m_axialPos->get() );
float xSlice = static_cast< float >( m_sagittalPos->get() );
float ySlice = static_cast< float >( m_coronalPos->get() );
float zSlice = static_cast< float >( m_axialPos->get() );
float xPos = xSlice + 0.5f;
float yPos = ySlice + 0.5f;
......@@ -346,9 +346,9 @@ osg::ref_ptr<osg::Geometry> WMNavSlices::createGeometry( int slice )
{
boost::shared_ptr< WGridRegular3D > grid = ( *iter )->getGrid();
float maxX = ( float )( grid->getNbCoordsX() );
float maxY = ( float )( grid->getNbCoordsY() );
float maxZ = ( float )( grid->getNbCoordsZ() );
float maxX = static_cast< float >( grid->getNbCoordsX() );
float maxY = static_cast< float >( grid->getNbCoordsY() );
float maxZ = static_cast< float >( grid->getNbCoordsZ() );
float texX = xSlice / maxX;
//float texY = ySlice / maxY;
......@@ -381,9 +381,9 @@ osg::ref_ptr<osg::Geometry> WMNavSlices::createGeometry( int slice )
{
boost::shared_ptr< WGridRegular3D > grid = ( *iter )->getGrid();
float maxX = ( float )( grid->getNbCoordsX() );
float maxY = ( float )( grid->getNbCoordsY() );
float maxZ = ( float )( grid->getNbCoordsZ() );
float maxX = static_cast< float >( grid->getNbCoordsX() );
float maxY = static_cast< float >( grid->getNbCoordsY() );
float maxZ = static_cast< float >( grid->getNbCoordsZ() );
//float texX = xSlice / maxX;
float texY = ySlice / maxY;
......@@ -417,9 +417,9 @@ osg::ref_ptr<osg::Geometry> WMNavSlices::createGeometry( int slice )
boost::shared_ptr< WGridRegular3D > grid = ( *iter )->getGrid();
float maxX = ( float )( grid->getNbCoordsX() );
float maxY = ( float )( grid->getNbCoordsY() );
float maxZ = ( float )( grid->getNbCoordsZ() );
float maxX = static_cast< float >( grid->getNbCoordsX() );
float maxY = static_cast< float >( grid->getNbCoordsY() );
float maxZ = static_cast< float >( grid->getNbCoordsZ() );
//float texX = xSlice / maxX;
//float texY = ySlice / maxY;
......@@ -444,9 +444,9 @@ osg::ref_ptr<osg::Geometry> WMNavSlices::createGeometry( int slice )
}
else
{
float maxX = ( float )( m_maxSagittal->get() );
float maxY = ( float )( m_maxCoronal->get() );
float maxZ = ( float )( m_maxAxial->get() );
float maxX = static_cast< float >( m_maxSagittal->get() );
float maxY = static_cast< float >( m_maxCoronal->get() );
float maxZ = static_cast< float >( m_maxAxial->get() );
m_sagittalPos->setMax( maxX );
m_coronalPos->setMax( maxY );
......
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