Commit e6a82f5e by Sebastian Eichelbaum

[FIX #246] replaced shared_*_cast by *_pointer_cast

parent fb4df33f
......@@ -115,67 +115,67 @@ void WPropertyBase::setHidden( bool hidden )
WPropInt WPropertyBase::toPropInt()
{
return boost::shared_static_cast< WPVInt >( shared_from_this() );
return boost::static_pointer_cast< WPVInt >( shared_from_this() );
}
WPropDouble WPropertyBase::toPropDouble()
{
return boost::shared_static_cast< WPVDouble >( shared_from_this() );
return boost::static_pointer_cast< WPVDouble >( shared_from_this() );
}
WPropBool WPropertyBase::toPropBool()
{
return boost::shared_static_cast< WPVBool >( shared_from_this() );
return boost::static_pointer_cast< WPVBool >( shared_from_this() );
}
WPropString WPropertyBase::toPropString()
{
return boost::shared_static_cast< WPVString >( shared_from_this() );
return boost::static_pointer_cast< WPVString >( shared_from_this() );
}
WPropFilename WPropertyBase::toPropFilename()
{
return boost::shared_static_cast< WPVFilename >( shared_from_this() );
return boost::static_pointer_cast< WPVFilename >( shared_from_this() );
}
WPropSelection WPropertyBase::toPropSelection()
{
return boost::shared_static_cast< WPVSelection >( shared_from_this() );
return boost::static_pointer_cast< WPVSelection >( shared_from_this() );
}
WPropColor WPropertyBase::toPropColor()
{
return boost::shared_static_cast< WPVColor >( shared_from_this() );
return boost::static_pointer_cast< WPVColor >( shared_from_this() );
}
WPropPosition WPropertyBase::toPropPosition()
{
return boost::shared_static_cast< WPVPosition >( shared_from_this() );
return boost::static_pointer_cast< WPVPosition >( shared_from_this() );
}
WPropGroup WPropertyBase::toPropGroup()
{
return boost::shared_static_cast< WPVGroup >( shared_from_this() );
return boost::static_pointer_cast< WPVGroup >( shared_from_this() );
}
WPropertyGroupBase::SPtr WPropertyBase::toPropGroupBase()
{
return boost::shared_static_cast< WPropertyGroupBase >( shared_from_this() );
return boost::static_pointer_cast< WPropertyGroupBase >( shared_from_this() );
}
WPropMatrix4X4 WPropertyBase::toPropMatrix4X4()
{
return boost::shared_static_cast< WPVMatrix4X4 >( shared_from_this() );
return boost::static_pointer_cast< WPVMatrix4X4 >( shared_from_this() );
}
WPropTrigger WPropertyBase::toPropTrigger()
{
return boost::shared_static_cast< WPVTrigger >( shared_from_this() );
return boost::static_pointer_cast< WPVTrigger >( shared_from_this() );
}
WPropTransferFunction WPropertyBase::toPropTransferFunction()
{
return boost::shared_static_cast< WPVTransferFunction >( shared_from_this() );
return boost::static_pointer_cast< WPVTransferFunction >( shared_from_this() );
}
boost::shared_ptr< WCondition > WPropertyBase::getUpdateCondition() const
......
......@@ -349,7 +349,7 @@ private:
template< typename T >
boost::shared_ptr< WPropertyVariable< T > > WPropertyBase::toPropertyVariable()
{
return boost::shared_dynamic_cast< WPropertyVariable< T > >( shared_from_this() );
return boost::dynamic_pointer_cast< WPropertyVariable< T > >( shared_from_this() );
}
#endif // WPROPERTYBASE_H
......
......@@ -145,7 +145,7 @@ T addDefaultConstraints( T prop )
bool WPropertyGroup::set( boost::shared_ptr< WPropertyBase > value, bool recommendedOnly )
{
// is this the same type as we are?
WPropertyGroup::SPtr v = boost::shared_dynamic_cast< WPropertyGroup >( value );
WPropertyGroup::SPtr v = boost::dynamic_pointer_cast< WPropertyGroup >( value );
if( !v )
{
// it is not a WPropertyStruct with the same type
......@@ -193,8 +193,8 @@ bool WPropertyGroup::setImpl( boost::shared_ptr< WPropertyGroup > value, std::st
}
// not excluded. Is it a group or something else?
WPropertyGroup::SPtr meAsGroup = boost::shared_dynamic_cast< WPropertyGroup >( prop );
WPropertyGroup::SPtr inputAsGroup = boost::shared_dynamic_cast< WPropertyGroup >( *it );
WPropertyGroup::SPtr meAsGroup = boost::dynamic_pointer_cast< WPropertyGroup >( prop );
WPropertyGroup::SPtr inputAsGroup = boost::dynamic_pointer_cast< WPropertyGroup >( *it );
if( inputAsGroup && meAsGroup )
{
// not excluded and is group, recurse:
......
......@@ -168,7 +168,7 @@ public:
virtual bool set( boost::shared_ptr< WPropertyBase > value )
{
// is this the same type as we are?
typename WPropertyListType::SPtr v = boost::shared_dynamic_cast< WPropertyListType >( value );
typename WPropertyListType::SPtr v = boost::dynamic_pointer_cast< WPropertyListType >( value );
if( !v )
{
// it is not a WPropertyList with the same type
......
......@@ -278,7 +278,7 @@ public:
typename boost::mpl::at< TypeVector, boost::mpl::size_t< N > >::type getProperty()
{
typedef typename boost::mpl::at< TypeVector, boost::mpl::size_t< N > >::type::element_type TargetType;
return boost::shared_dynamic_cast< TargetType >( getProperty( N ) );
return boost::dynamic_pointer_cast< TargetType >( getProperty( N ) );
}
/**
......@@ -292,7 +292,7 @@ public:
typename boost::mpl::at< TypeVector, boost::mpl::size_t< N > >::type::element_type::ConstSPtr getProperty() const
{
typedef typename boost::mpl::at< TypeVector, boost::mpl::size_t< N > >::type::element_type TargetType;
return boost::shared_dynamic_cast< const TargetType >( getProperty( N ) );
return boost::dynamic_pointer_cast< const TargetType >( getProperty( N ) );
}
/**
......@@ -428,7 +428,7 @@ public:
virtual bool set( boost::shared_ptr< WPropertyBase > value, bool recommendedOnly = false )
{
// is this the same type as we are?
typename WPropertyStructType::SPtr v = boost::shared_dynamic_cast< WPropertyStructType >( value );
typename WPropertyStructType::SPtr v = boost::dynamic_pointer_cast< WPropertyStructType >( value );
if( !v )
{
// it is not a WPropertyStruct with the same type
......
......@@ -584,7 +584,7 @@ bool WPropertyVariable< T >::accept( const T& newValue )
bool acceptable = WFlag< T >::accept( newValue );
for( typename ConstraintContainerType::ConstIterator it = l->get().begin(); it != l->get().end(); ++it )
{
acceptable &= ( *it )->accept( boost::shared_static_cast< WPropertyVariable< T > >( shared_from_this() ), newValue );
acceptable &= ( *it )->accept( boost::static_pointer_cast< WPropertyVariable< T > >( shared_from_this() ), newValue );
}
return acceptable;
......@@ -620,7 +620,7 @@ template < typename T >
bool WPropertyVariable< T >::set( boost::shared_ptr< WPropertyBase > value, bool recommendedOnly )
{
// try to cast the given property to a WPropertyVariable of right type:
boost::shared_ptr< WPropertyVariable< T > > v = boost::shared_dynamic_cast< WPropertyVariable< T > >( value );
boost::shared_ptr< WPropertyVariable< T > > v = boost::dynamic_pointer_cast< WPropertyVariable< T > >( value );
if( v )
{
if( recommendedOnly )
......@@ -795,7 +795,7 @@ boost::shared_ptr< WPropertyConstraintMin< T > > WPropertyVariable< T >::getMin(
}
// cast to proper type
return boost::shared_static_cast< WPropertyConstraintMin< T > >( c );
return boost::static_pointer_cast< WPropertyConstraintMin< T > >( c );
}
template < typename T >
......@@ -810,7 +810,7 @@ boost::shared_ptr< WPropertyConstraintMax< T > > WPropertyVariable< T >::getMax(
}
// cast to proper type
return boost::shared_static_cast< WPropertyConstraintMax< T > >( c );
return boost::static_pointer_cast< WPropertyConstraintMax< T > >( c );
}
template< typename T >
......
......@@ -59,7 +59,7 @@ WDataSetSingle::SPtr WDataSetDTI::clone() const
WTensorSym< 2, 3, float > WDataSetDTI::getTensor( size_t index ) const
{
boost::shared_ptr< WValueSet< float > > values = boost::shared_dynamic_cast< WValueSet< float > >( m_valueSet );
boost::shared_ptr< WValueSet< float > > values = boost::dynamic_pointer_cast< WValueSet< float > >( m_valueSet );
WAssert( values, "The value set of a WDataSetDTI must be a WValueSet< float >, nothing else!" );
return WTensorSym< 2, 3, float >( values->getWValue( index ) );
}
......
......@@ -205,12 +205,12 @@ WDataSetFibers::TangentArray WDataSetFibers::getTangents() const
WDataSetFibers::ColorArray WDataSetFibers::getGlobalColors() const
{
return boost::shared_static_cast< const ColorScheme >( ( *m_colors )[0] )->getColor();
return boost::static_pointer_cast< const ColorScheme >( ( *m_colors )[0] )->getColor();
}
WDataSetFibers::ColorArray WDataSetFibers::getLocalColors() const
{
return boost::shared_static_cast< const ColorScheme >( ( *m_colors )[1] )->getColor();
return boost::static_pointer_cast< const ColorScheme >( ( *m_colors )[1] )->getColor();
}
void WDataSetFibers::addColorScheme( WDataSetFibers::ColorArray colors, std::string name, std::string description )
......@@ -243,7 +243,7 @@ void WDataSetFibers::removeColorScheme( WDataSetFibers::ColorArray colors )
WItemSelection::Iterator i = l->get().begin();
while( i != l->get().end() )
{
if( boost::shared_static_cast< const ColorScheme >( *i )->getColor() == colors )
if( boost::static_pointer_cast< const ColorScheme >( *i )->getColor() == colors )
{
i = l->get().erase( i );
}
......@@ -260,7 +260,7 @@ void WDataSetFibers::replaceColorScheme( WDataSetFibers::ColorArray oldColors, W
WItemSelection::WriteTicket l = m_colors->getWriteTicket();
for( WItemSelection::Iterator i = l->get().begin(); i != l->get().end(); ++i )
{
boost::shared_ptr< ColorScheme > ci = boost::shared_static_cast< ColorScheme >( *i );
boost::shared_ptr< ColorScheme > ci = boost::static_pointer_cast< ColorScheme >( *i );
if(ci->getColor() == oldColors )
{
ci->setColor( newColors );
......@@ -279,18 +279,18 @@ const boost::shared_ptr< WDataSetFibers::ColorScheme > WDataSetFibers::getColorS
throw WDHNoSuchDataSet( std::string( "Color scheme with specified name could not be found." ) );
}
return boost::shared_static_cast< ColorScheme >( *i );
return boost::static_pointer_cast< ColorScheme >( *i );
}
const boost::shared_ptr< WDataSetFibers::ColorScheme > WDataSetFibers::getColorScheme( size_t idx ) const
{
WItemSelection::ReadTicket l = m_colors->getReadTicket();
return boost::shared_static_cast< ColorScheme >( l->get()[ idx ] );
return boost::static_pointer_cast< ColorScheme >( l->get()[ idx ] );
}
const boost::shared_ptr< WDataSetFibers::ColorScheme > WDataSetFibers::getColorScheme() const
{
return boost::shared_static_cast< ColorScheme >( m_colorProp->get().at( 0 ) );
return boost::static_pointer_cast< ColorScheme >( m_colorProp->get().at( 0 ) );
}
const WPropSelection WDataSetFibers::getColorSchemeProperty() const
......
......@@ -210,7 +210,7 @@ template< typename T > WValue< T > WDataSetRawHARDI::getNonZeroGradientSignals(
{
WValue< T > result( m_nonZeroGradientIndexes.size() );
size_t idx = 0;
boost::shared_ptr< WValueSet< T > > vs = boost::shared_dynamic_cast< WValueSet< T > >( m_valueSet );
boost::shared_ptr< WValueSet< T > > vs = boost::dynamic_pointer_cast< WValueSet< T > >( m_valueSet );
WValue< T > signal( vs->getWValue( index ) );
for( std::vector< size_t >::const_iterator cit = m_nonZeroGradientIndexes.begin(); cit != m_nonZeroGradientIndexes.end(); ++cit )
{
......
......@@ -92,7 +92,7 @@ boost::shared_ptr< WPrototyped > WDataSetScalar::getPrototype()
double WDataSetScalar::interpolate( const WPosition& pos, bool* success ) const
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
boost::shared_ptr< WGridRegular3D > grid = boost::dynamic_pointer_cast< WGridRegular3D >( m_grid );
WAssert( grid, "This data set has a grid whose type is not yet supported for interpolation." );
WAssert( ( m_valueSet->order() == 0 && m_valueSet->dimension() == 1 ),
......@@ -145,7 +145,7 @@ double WDataSetScalar::interpolate( const WPosition& pos, bool* success ) const
double WDataSetScalar::getValueAt( int x, int y, int z ) const
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
boost::shared_ptr< WGridRegular3D > grid = boost::dynamic_pointer_cast< WGridRegular3D >( m_grid );
size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
return WDataSetSingle::getValueAt( id );
......
......@@ -187,8 +187,8 @@ private:
template< typename T > T WDataSetScalar::getValueAt( int x, int y, int z ) const
{
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 );
boost::shared_ptr< WValueSet< T > > vs = boost::dynamic_pointer_cast< WValueSet< T > >( m_valueSet );
boost::shared_ptr< WGridRegular3D > grid = boost::dynamic_pointer_cast< WGridRegular3D >( m_grid );
size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
......
......@@ -110,7 +110,7 @@ boost::shared_ptr< WPrototyped > WDataSetSegmentation::getPrototype()
float WDataSetSegmentation::getWMProbability( int x, int y, int z ) const
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
boost::shared_ptr< WGridRegular3D > grid = boost::dynamic_pointer_cast< WGridRegular3D >( m_grid );
size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
return WDataSetSingle::getValueAt( whiteMatter + ( 3*id ) );
......@@ -118,7 +118,7 @@ float WDataSetSegmentation::getWMProbability( int x, int y, int z ) const
float WDataSetSegmentation::getGMProbability( int x, int y, int z ) const
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
boost::shared_ptr< WGridRegular3D > grid = boost::dynamic_pointer_cast< WGridRegular3D >( m_grid );
size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
return WDataSetSingle::getValueAt( grayMatter + ( 3*id ) );
......@@ -126,7 +126,7 @@ float WDataSetSegmentation::getGMProbability( int x, int y, int z ) const
float WDataSetSegmentation::getCSFProbability( int x, int y, int z ) const
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
boost::shared_ptr< WGridRegular3D > grid = boost::dynamic_pointer_cast< WGridRegular3D >( m_grid );
size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
return WDataSetSingle::getValueAt( csf + ( 3*id ) );
......@@ -142,9 +142,9 @@ boost::shared_ptr< WValueSetBase > WDataSetSegmentation::convert( boost::shared_
WAssert( cerebrospinalFluid, "No CSF data given." );
// check for same dimension of all three tissue types
boost::shared_ptr< WGridRegular3D > wm_grid = boost::shared_dynamic_cast< WGridRegular3D >( whiteMatter->getGrid() );
boost::shared_ptr< WGridRegular3D > gm_grid = boost::shared_dynamic_cast< WGridRegular3D >( grayMatter->getGrid() );
boost::shared_ptr< WGridRegular3D > csf_grid = boost::shared_dynamic_cast< WGridRegular3D >( cerebrospinalFluid->getGrid() );
boost::shared_ptr< WGridRegular3D > wm_grid = boost::dynamic_pointer_cast< WGridRegular3D >( whiteMatter->getGrid() );
boost::shared_ptr< WGridRegular3D > gm_grid = boost::dynamic_pointer_cast< WGridRegular3D >( grayMatter->getGrid() );
boost::shared_ptr< WGridRegular3D > csf_grid = boost::dynamic_pointer_cast< WGridRegular3D >( cerebrospinalFluid->getGrid() );
WAssert( ( wm_grid->getNbCoordsX() == gm_grid->getNbCoordsX() ) && ( gm_grid->getNbCoordsX() == csf_grid->getNbCoordsX() ),
"Different X size of GrayMatter, WhiteMatter or CSF-Input" );
......@@ -207,7 +207,7 @@ boost::shared_ptr< WValueSetBase > WDataSetSegmentation::convert( boost::shared_
// size_t WMVoxel = 0;
// size_t GMVoxel = 0;
// size_t CSFVoxel = 0;
// boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( getGrid() );
// boost::shared_ptr< WGridRegular3D > grid = boost::dynamic_pointer_cast< WGridRegular3D >( getGrid() );
// for( size_t x = 0; x < grid->getNbCoordsX(); x++ )
// for( size_t y = 0; y < grid->getNbCoordsY(); y++ )
// for( size_t z = 0; z < grid->getNbCoordsZ(); z++ )
......
......@@ -214,7 +214,7 @@ WDataSetSegmentation::copyDataSetsToArray( const std::vector< boost::shared_ptr<
{
for( size_t voxelNumber = 0; voxelNumber < countVoxels; voxelNumber++ )
{
data[ voxelNumber * voxelDim + dimIndex ] = ( boost::shared_static_cast< WDataSetSingle > ( *it ) )->getValueAt< T >( voxelNumber );
data[ voxelNumber * voxelDim + dimIndex ] = ( boost::static_pointer_cast< WDataSetSingle > ( *it ) )->getValueAt< T >( voxelNumber );
}
dimIndex++;
}
......@@ -224,8 +224,8 @@ WDataSetSegmentation::copyDataSetsToArray( const std::vector< boost::shared_ptr<
// template < typename T > T WDataSetSegmentation::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 );
// boost::shared_ptr< WValueSet< T > > vs = boost::dynamic_pointer_cast< WValueSet< T > >( m_valueSet );
// boost::shared_ptr< WGridRegular3D > grid = boost::dynamic_pointer_cast< WGridRegular3D >( m_grid );
//
// size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
//
......
......@@ -54,7 +54,7 @@ WDataSetSingle::WDataSetSingle( boost::shared_ptr< WValueSetBase > newValueSet,
m_infoProperties->addProperty( m_grid->getInformationProperties() );
// technically this should be placed into the WDataSetScalar, WDataSetVector and so on
boost::shared_ptr< WGridRegular3D > regGrid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
boost::shared_ptr< WGridRegular3D > regGrid = boost::dynamic_pointer_cast< WGridRegular3D >( m_grid );
if( regGrid && ( m_valueSet->dimension() < 5 ) && ( m_valueSet->dimension() != 0 ) )
{
m_texture = osg::ref_ptr< WDataTexture3D >( new WDataTexture3D( m_valueSet, regGrid ) );
......@@ -138,23 +138,23 @@ double WDataSetSingle::getValueAt( size_t id ) const
{
case W_DT_UNSIGNED_CHAR:
{
return static_cast< double >( boost::shared_dynamic_cast< WValueSet< uint8_t > >( getValueSet() )->getScalar( id ) );
return static_cast< double >( boost::dynamic_pointer_cast< WValueSet< uint8_t > >( getValueSet() )->getScalar( id ) );
}
case W_DT_INT16:
{
return static_cast< double >( boost::shared_dynamic_cast< WValueSet< int16_t > >( getValueSet() )->getScalar( id ) );
return static_cast< double >( boost::dynamic_pointer_cast< WValueSet< int16_t > >( getValueSet() )->getScalar( id ) );
}
case W_DT_SIGNED_INT:
{
return static_cast< double >( boost::shared_dynamic_cast< WValueSet< int32_t > >( getValueSet() )->getScalar( id ) );
return static_cast< double >( boost::dynamic_pointer_cast< WValueSet< int32_t > >( getValueSet() )->getScalar( id ) );
}
case W_DT_FLOAT:
{
return static_cast< double >( boost::shared_dynamic_cast< WValueSet< float > >( getValueSet() )->getScalar( id ) );
return static_cast< double >( boost::dynamic_pointer_cast< WValueSet< float > >( getValueSet() )->getScalar( id ) );
}
case W_DT_DOUBLE:
{
return static_cast< double >( boost::shared_dynamic_cast< WValueSet< double > >( getValueSet() )->getScalar( id ) );
return static_cast< double >( boost::dynamic_pointer_cast< WValueSet< double > >( getValueSet() )->getScalar( id ) );
}
default:
WAssert( false, "Unknow data type in dataset." );
......
......@@ -190,7 +190,7 @@ private:
template< typename T > T WDataSetSingle::getValueAt( size_t id )
{
boost::shared_ptr< WValueSet< T > > vs = boost::shared_dynamic_cast< WValueSet< T > >( m_valueSet );
boost::shared_ptr< WValueSet< T > > vs = boost::dynamic_pointer_cast< WValueSet< T > >( m_valueSet );
return vs->getScalar( id );
}
#endif // WDATASETSINGLE_H
......@@ -40,7 +40,7 @@ WDataSetSphericalHarmonics::WDataSetSphericalHarmonics( boost::shared_ptr< WValu
boost::shared_ptr< WGrid > newGrid ) :
WDataSetSingle( newValueSet, newGrid ), m_valueSet( newValueSet )
{
m_gridRegular3D = boost::shared_dynamic_cast< WGridRegular3D >( newGrid );
m_gridRegular3D = boost::dynamic_pointer_cast< WGridRegular3D >( newGrid );
WAssert( newValueSet, "No value set given." );
WAssert( newGrid, "No grid given." );
}
......
......@@ -42,7 +42,7 @@ WDataSetTimeSeries::WDataSetTimeSeries( std::vector< boost::shared_ptr< WDataSet
WAssert( datasets.size() == times.size(), "" );
std::vector< boost::shared_ptr< WDataSetScalar const > >::iterator dit;
std::vector< float >::iterator tit;
boost::shared_ptr< WGridRegular3D > g = boost::shared_dynamic_cast< WGridRegular3D >( datasets.front()->getGrid() );
boost::shared_ptr< WGridRegular3D > g = boost::dynamic_pointer_cast< WGridRegular3D >( datasets.front()->getGrid() );
WAssert( g, "" );
dataType d = datasets.front()->getValueSet()->getDataType();
m_minValue = datasets.front()->getMin();
......@@ -50,7 +50,7 @@ WDataSetTimeSeries::WDataSetTimeSeries( std::vector< boost::shared_ptr< WDataSet
for( dit = datasets.begin(), tit = times.begin(); dit != datasets.end() && tit != times.end(); ++dit, ++tit )
{
WAssert( *dit, "" );
WAssert( g == boost::shared_dynamic_cast< WGridRegular3D >( ( *dit )->getGrid() ), "" );
WAssert( g == boost::dynamic_pointer_cast< WGridRegular3D >( ( *dit )->getGrid() ), "" );
WAssert( !wlimits::isNaN( *tit ), "" );
WAssert( d == ( *dit )->getValueSet()->getDataType(), "" );
WAssert( ( *dit )->getValueSet()->dimension() == 1, "" );
......
......@@ -295,8 +295,8 @@ boost::shared_ptr< WValueSetBase > WDataSetTimeSeries::calcInterpolatedValueSet(
boost::shared_ptr< WDataSetScalar const > f = getDataSetPtrAtTimeSlice( lb );
boost::shared_ptr< WDataSetScalar const > g = getDataSetPtrAtTimeSlice( ub );
WAssert( f && g, "" );
boost::shared_ptr< WValueSet< Data_T > > vf = boost::shared_dynamic_cast< WValueSet< Data_T > >( f->getValueSet() );
boost::shared_ptr< WValueSet< Data_T > > vg = boost::shared_dynamic_cast< WValueSet< Data_T > >( g->getValueSet() );
boost::shared_ptr< WValueSet< Data_T > > vf = boost::dynamic_pointer_cast< WValueSet< Data_T > >( f->getValueSet() );
boost::shared_ptr< WValueSet< Data_T > > vg = boost::dynamic_pointer_cast< WValueSet< Data_T > >( g->getValueSet() );
WAssert( vf && vg, "" );
boost::shared_ptr< std::vector< Data_T > > values = boost::shared_ptr< std::vector< Data_T > >( new std::vector< Data_T >( vf->size() ) );
float ml = ( ub - time ) / ( ub - lb );
......
......@@ -88,7 +88,7 @@ namespace
bool *success,
boost::shared_ptr< WGridRegular3D::CellVertexArray > vertexIds )
{
boost::shared_ptr< const WGridRegular3D > grid = boost::shared_dynamic_cast< const WGridRegular3D >( i_grid );
boost::shared_ptr< const WGridRegular3D > grid = boost::dynamic_pointer_cast< const WGridRegular3D >( i_grid );
WAssert( grid, "This data set has a grid whose type is not yet supported for interpolation." );
WAssert( ( i_valueSet->order() == 1 && i_valueSet->dimension() == 3 ),
......@@ -180,23 +180,23 @@ WVector3d WDataSetVector::getVectorAt( size_t index ) const
{
case W_DT_UNSIGNED_CHAR:
{
return boost::shared_dynamic_cast< WValueSet< uint8_t > >( getValueSet() )->getVector3D( index );
return boost::dynamic_pointer_cast< WValueSet< uint8_t > >( getValueSet() )->getVector3D( index );
}
case W_DT_INT16:
{
return boost::shared_dynamic_cast< WValueSet< int16_t > >( getValueSet() )->getVector3D( index );
return boost::dynamic_pointer_cast< WValueSet< int16_t > >( getValueSet() )->getVector3D( index );
}
case W_DT_SIGNED_INT:
{
return boost::shared_dynamic_cast< WValueSet< int32_t > >( getValueSet() )->getVector3D( index );
return boost::dynamic_pointer_cast< WValueSet< int32_t > >( getValueSet() )->getVector3D( index );
}
case W_DT_FLOAT:
{
return boost::shared_dynamic_cast< WValueSet< float > >( getValueSet() )->getVector3D( index );
return boost::dynamic_pointer_cast< WValueSet< float > >( getValueSet() )->getVector3D( index );
}
case W_DT_DOUBLE:
{
return boost::shared_dynamic_cast< WValueSet< double > >( getValueSet() )->getVector3D( index );
return boost::dynamic_pointer_cast< WValueSet< double > >( getValueSet() )->getVector3D( index );
}
default:
WAssert( false, "Unknow data type in dataset." );
......
......@@ -155,7 +155,7 @@ private:
inline boost::shared_ptr< WDataSetVector > WDataSetVector::isVectorDataSet()
{
return boost::shared_static_cast< WDataSetVector >( shared_from_this() );
return boost::static_pointer_cast< WDataSetVector >( shared_from_this() );
}
#endif // WDATASETVECTOR_H
......@@ -78,77 +78,77 @@ void WDataTexture3D::create()
if( m_valueSet->getDataType() == W_DT_UINT8 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_UINT8";
boost::shared_ptr< WValueSet< uint8_t > > vs = boost::shared_dynamic_cast< WValueSet< uint8_t > >( m_valueSet );
boost::shared_ptr< WValueSet< uint8_t > > vs = boost::dynamic_pointer_cast< WValueSet< uint8_t > >( m_valueSet );
uint8_t* source = const_cast< uint8_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_INT8 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_INT8";
boost::shared_ptr< WValueSet< int8_t > > vs = boost::shared_dynamic_cast< WValueSet< int8_t > >( m_valueSet );
boost::shared_ptr< WValueSet< int8_t > > vs = boost::dynamic_pointer_cast< WValueSet< int8_t > >( m_valueSet );
int8_t* source = const_cast< int8_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_INT16 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_INT16";
boost::shared_ptr< WValueSet< int16_t > > vs = boost::shared_dynamic_cast< WValueSet< int16_t > >( m_valueSet );
boost::shared_ptr< WValueSet< int16_t > > vs = boost::dynamic_pointer_cast< WValueSet< int16_t > >( m_valueSet );
int16_t* source = const_cast< int16_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_UINT16 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_UINT16";
boost::shared_ptr< WValueSet< uint16_t > > vs = boost::shared_dynamic_cast< WValueSet< uint16_t > >( m_valueSet );
boost::shared_ptr< WValueSet< uint16_t > > vs = boost::dynamic_pointer_cast< WValueSet< uint16_t > >( m_valueSet );
uint16_t* source = const_cast< uint16_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_UINT32 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_UINT32";
boost::shared_ptr< WValueSet< uint32_t > > vs = boost::shared_dynamic_cast< WValueSet< uint32_t > >( m_valueSet );
boost::shared_ptr< WValueSet< uint32_t > > vs = boost::dynamic_pointer_cast< WValueSet< uint32_t > >( m_valueSet );
uint32_t* source = const_cast< uint32_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_INT64 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_INT64";
boost::shared_ptr< WValueSet< int64_t > > vs = boost::shared_dynamic_cast< WValueSet< int64_t > >( m_valueSet );
boost::shared_ptr< WValueSet< int64_t > > vs = boost::dynamic_pointer_cast< WValueSet< int64_t > >( m_valueSet );
int64_t* source = const_cast< int64_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_UINT64 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_UINT64";
boost::shared_ptr< WValueSet< uint64_t > > vs = boost::shared_dynamic_cast< WValueSet< uint64_t > >( m_valueSet );
boost::shared_ptr< WValueSet< uint64_t > > vs = boost::dynamic_pointer_cast< WValueSet< uint64_t > >( m_valueSet );
uint64_t* source = const_cast< uint64_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_SIGNED_INT )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_SIGNED_INT";
boost::shared_ptr< WValueSet< int32_t > > vs = boost::shared_dynamic_cast< WValueSet< int32_t > >( m_valueSet );
boost::shared_ptr< WValueSet< int32_t > > vs = boost::dynamic_pointer_cast< WValueSet< int32_t > >( m_valueSet );
int* source = const_cast< int* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_FLOAT )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_FLOAT";
boost::shared_ptr< WValueSet< float > > vs = boost::shared_dynamic_cast< WValueSet< float > >( m_valueSet );
boost::shared_ptr< WValueSet< float > > vs = boost::dynamic_pointer_cast< WValueSet< float > >( m_valueSet );
float* source = const_cast< float* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_DOUBLE )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_DOUBLE";
boost::shared_ptr< WValueSet< double > > vs = boost::shared_dynamic_cast< WValueSet< double > >( m_valueSet );
boost::shared_ptr< WValueSet< double > > vs = boost::dynamic_pointer_cast< WValueSet< double > >( m_valueSet );
double* source = const_cast< double* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_FLOAT128 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_FLOAT128";
boost::shared_ptr< WValueSet< long double > > vs = boost::shared_dynamic_cast< WValueSet< long double > >( m_valueSet );
boost::shared_ptr< WValueSet< long double > > vs = boost::dynamic_pointer_cast< WValueSet< long double > >( m_valueSet );
long double* source = const_cast< long double* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
......
......@@ -47,7 +47,7 @@
template< typename T >
typename itk::Image< T, 3 >::Pointer makeImageFromDataSet( boost::shared_ptr< WDataSetScalar const > dataSet )
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( dataSet->getGrid() );
boost::shared_ptr< WGridRegular3D > grid = boost::dynamic_pointer_cast< WGridRegular3D >( dataSet->getGrid() );
WAssert( grid, "" );
// this is a shared-pointer
......
......@@ -139,7 +139,7 @@ template< typename Value_T, std::size_t numValues, typename Output_T, std::size_
WThreadedPerVoxelOperation< Value_T, numValues, Output_T, numOutputs >::WThreadedPerVoxelOperation(
boost::shared_ptr< WDataSetSingle const > dataset,
FunctionType func )
: BaseType( ( dataset ? boost::shared_dynamic_cast< ValueSetType >( dataset->getValueSet() )
: BaseType( ( dataset ? boost::dynamic_pointer_cast< ValueSetType >( dataset->getValueSet() )
: boost::shared_ptr< ValueSetType >() ) ) // NOLINT
{
if( !dataset )
......
......@@ -35,7 +35,7 @@ namespace wtracking
{
// TODO(reichenbach): Give those WAsserts correct strings incase they occur
WAssert( dataset->getGrid(), "" );
Grid3DPtr g = boost::shared_dynamic_cast< WGridRegular3D >( dataset->getGrid() );
Grid3DPtr g = boost::dynamic_pointer_cast< WGridRegular3D >( dataset->getGrid() );
WAssert( g, "" );
WAssert( g->encloses( job.first ), "" );
......@@ -165,7 +165,7 @@ namespace wtracking
std::size_t seedPositions, std::size_t seedsPerPos,
std::vector< int > v0, std::vector< int > v1 )
: Base( dataset ),
m_grid( boost::shared_dynamic_cast< GridType >( dataset->getGrid() ) ),
m_grid( boost::dynamic_pointer_cast< GridType >( dataset->getGrid() ) ),
m_directionFunc( dirFunc ),
m_nextPosFunc( nextFunc ),
m_fiberVisitor( fiberVst ),
......
......@@ -49,12 +49,12 @@ WJoinContourTree::WJoinContourTree( boost::shared_ptr< WDataSetSingle > dataset
{
throw WNotImplemented( std::string( "ATM there is only support for scalar fields" ) );
}
m_valueSet = boost::shared_dynamic_cast< WValueSet< double > >( dataset->getValueSet() );
m_valueSet = boost::dynamic_pointer_cast< WValueSet< double > >( dataset->getValueSet() );
if( !m_valueSet )
{
throw WNotImplemented( std::string( "ATM there is only support for scalar fields with doubles as scalars" ) );
}
m_grid = boost::shared_dynamic_cast< WGridRegular3D >( dataset->getGrid() );
m_grid = boost::dynamic_pointer_cast< WGridRegular3D >( dataset->getGrid() );
if( !m_grid )
{
throw WNotImplemented( std::string( "Only WGridRegular3D is supported, despite that its not a simplicial mesh!" ) );
......
......@@ -394,7 +394,7 @@ public:
std::vector< double > v( 27, 1.35 );
ds = ts.calcDataSetAtTime( 0.35f, name );
TS_ASSERT( ds );
boost::shared_ptr< WValueSet< double > > vs = boost::shared_dynamic_cast< WValueSet< double > >( ds->getValueSet() );
boost::shared_ptr< WValueSet< double > > vs = boost::dynamic_pointer_cast< WValueSet< double > >( ds->getValueSet() );
TS_ASSERT( vs );
for( std::size_t k = 0; k < v.size(); ++k )
{
......@@ -405,7 +405,7 @@ public:
std::vector< double > v( 27, 1.99 );
ds = ts.calcDataSetAtTime( 0.99f, name );
TS_ASSERT( ds );
boost::shared_ptr< WValueSet< double > > vs = boost::shared_dynamic_cast< WValueSet< double > >( ds->getValueSet() );
boost::shared_ptr< WValueSet< double > > vs = boost::dynamic_pointer_cast< WValueSet< double > >( ds->getValueSet() );
TS_ASSERT( vs );
for( std::size_t k = 0; k < v.size(); ++k )
{
......@@ -416,7 +416,7 @@ public:
std::vector< double > v( 27, 2.598 );
ds = ts.calcDataSetAtTime( 1.598f, name );