Commit 1055e1be by Sebastian Eichelbaum

[MERGE]

parents 29fa100b 7bce0e3c
......@@ -151,9 +151,28 @@ double WDataSetScalar::interpolate( const wmath::WPosition& pos, bool* success )
double result = 0;
for( size_t i = 0; i < 8; ++i )
{
result += h[i] * getValueAt( vertexIds[i] );
result += h[i] * WDataSetSingle::getValueAt( vertexIds[i] );
}
*success = true;
return result;
}
template< typename T > T WDataSetScalar::getValueAt( int x, int y, int z )
{
boost::shared_ptr< WValueSet< T > > vs = boost::shared_dynamic_cast< WValueSet< T > >( m_valueSet );
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
T v = vs->getScalar( id );
return v;
}
double WDataSetScalar::getValueAt( int x, int y, int z )
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
return WDataSetSingle::getValueAt( id );
}
......@@ -92,6 +92,25 @@ public:
double interpolate( const wmath::WPosition& pos, bool* success );
/**
* Get the value stored at a certain grid position of the data set
* \param x index in x direction
* \param y index in y direction
* \param z index in z direction
*/
template< typename T > T getValueAt( int x, int y, int z );
/**
* Get the value stored at a certain grid position of the data set
* \param x index in x direction
* \param y index in y direction
* \param z index in z direction
*
* \return the double value at the given cell.
*/
double getValueAt( int x, int y, int z );
/**
* Returns a prototype instantiated with the true type of the deriving class.
*
* \return the prototype.
......
......@@ -134,13 +134,5 @@ double WDataSetSingle::getValueAt( size_t id )
WAssert( false, "Unknow data type in dataset." );
}
return 0.0;
}
double WDataSetSingle::getValueAt( int x, int y, int z )
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
return getValueAt( id );
return 0.0; // should not be reached. Just there to quiet compiler.
}
......@@ -75,25 +75,7 @@ public:
boost::shared_ptr< WGrid > getGrid() const;
/**
* Get the value stored at a certain grid position of the data set
* \param x index in x direction
* \param y index in y direction
* \param z index in z direction
*/
template< typename T > T getValueAt( int x, int y, int z );
/**
* Get the value stored at a certain grid position of the data set
* \param x index in x direction
* \param y index in y direction
* \param z index in z direction
*
* \return the double value at the given cell.
*/
double getValueAt( int x, int y, int z );
/**
* Get the value stored at a certain grid position of the data set
* Get the value stored at position of the value set. This is the grid position only for scalar data sets.
*
* \param id The id'th value in the data set
*
......@@ -102,7 +84,7 @@ public:
template< typename T > T getValueAt( size_t id );
/**
* Get the value stored at a certain grid position of the data set in type double.
* Get the value stored at position of the value set. This is the grid position only for scalar data sets.
*
* \param id The id'th value in the data set
*
......@@ -169,17 +151,6 @@ private:
boost::shared_ptr< WDataTexture3D > m_texture3D;
};
template< typename T > T WDataSetSingle::getValueAt( int x, int y, int z )
{
boost::shared_ptr< WValueSet< T > > vs = boost::shared_dynamic_cast< WValueSet< T > >( m_valueSet );
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
T v = vs->getScalar( id );
return v;
}
template< typename T > T WDataSetSingle::getValueAt( size_t id )
{
boost::shared_ptr< WValueSet< T > > vs = boost::shared_dynamic_cast< WValueSet< T > >( m_valueSet );
......
......@@ -28,6 +28,7 @@
#include <osg/Geode>
#include <osg/Geometry>
#include "../../dataHandler/WDataSetScalar.h"
#include "../../kernel/WKernel.h"
#include "WMCoordinateSystem.h"
#include "coordinateSystem.xpm"
......@@ -280,7 +281,7 @@ void WMCoordinateSystem::findBoundingBox()
if ( dsl.size() > 0 )
{
boost::shared_ptr< WDataSetSingle > ds = boost::shared_dynamic_cast< WDataSetSingle >( dsl[0] );
boost::shared_ptr< WDataSetScalar > ds = boost::shared_dynamic_cast< WDataSetScalar >( dsl[0] );
if ( ds->getValueSet()->getDataType() != 2 )
{
......
......@@ -159,16 +159,22 @@ void WMNavSlices::moduleMain()
m_viewer->getPickHandler()->getPickSignal()->connect( boost::bind( &WMNavSlices::setSlicePosFromPick, this, _1 ) );
m_viewer = ge->getViewerByName( "axial" );
WAssert( m_viewer, "Requested viewer not found." );
m_viewer->getPickHandler()->getPickSignal()->connect( boost::bind( &WMNavSlices::setSlicePosFromPick, this, _1 ) );
if( m_viewer )
{
m_viewer->getPickHandler()->getPickSignal()->connect( boost::bind( &WMNavSlices::setSlicePosFromPick, this, _1 ) );
}
m_viewer = ge->getViewerByName( "sagittal" );
WAssert( m_viewer, "Requested viewer not found." );
m_viewer->getPickHandler()->getPickSignal()->connect( boost::bind( &WMNavSlices::setSlicePosFromPick, this, _1 ) );
if( m_viewer )
{
m_viewer->getPickHandler()->getPickSignal()->connect( boost::bind( &WMNavSlices::setSlicePosFromPick, this, _1 ) );
}
m_viewer = ge->getViewerByName( "coronal" );
WAssert( m_viewer, "Requested viewer not found." );
m_viewer->getPickHandler()->getPickSignal()->connect( boost::bind( &WMNavSlices::setSlicePosFromPick, this, _1 ) );
if( m_viewer )
{
m_viewer->getPickHandler()->getPickSignal()->connect( boost::bind( &WMNavSlices::setSlicePosFromPick, this, _1 ) );
}
m_viewer = ge->getViewerByName( "main" );
......
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