Commit 0d9de569 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[FIX #282] replaced assert by WAssert in relevant modules.

parent 6bb85493
......@@ -33,6 +33,7 @@
#include <cmath>
#include "../../common/WProgress.h"
#include "../../common/WAssert.h"
#include "../../kernel/WKernel.h"
#include "WMApplyMask.h"
#include "apply_mask.xpm"
......@@ -101,7 +102,7 @@ void WMApplyMask::moduleMain()
{
boost::shared_ptr< WValueSet< unsigned char > > vals;
vals = boost::shared_dynamic_cast< WValueSet< unsigned char > >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
applyMask( vals, type );
break;
}
......@@ -109,7 +110,7 @@ void WMApplyMask::moduleMain()
{
boost::shared_ptr< WValueSet< int16_t > > vals;
vals = boost::shared_dynamic_cast< WValueSet< int16_t > >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
applyMask( vals, type );
break;
}
......@@ -117,7 +118,7 @@ void WMApplyMask::moduleMain()
{
boost::shared_ptr< WValueSet< int32_t > > vals;
vals = boost::shared_dynamic_cast< WValueSet< int32_t > >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
applyMask( vals, type );
break;
}
......@@ -125,7 +126,7 @@ void WMApplyMask::moduleMain()
{
boost::shared_ptr< WValueSet< float > > vals;
vals = boost::shared_dynamic_cast< WValueSet< float > >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
applyMask( vals, type );
break;
}
......@@ -133,7 +134,7 @@ void WMApplyMask::moduleMain()
{
boost::shared_ptr< WValueSet< double > > vals;
vals = boost::shared_dynamic_cast< WValueSet< double > >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
applyMask( vals, type );
break;
}
......
......@@ -30,6 +30,7 @@
#include <cmath>
#include "../../common/WAssert.h"
#include "../../common/WStringUtils.h"
#include "../../dataHandler/WGridRegular3D.h"
#include "../../graphicsEngine/WGEGeodeUtils.h"
......@@ -98,7 +99,7 @@ void WMBoundingBox::moduleMain()
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_dataSet->getGrid() );
assert( grid && "Seems that grid is of wrong type." );
WAssert( grid, "Seems that grid is of wrong type." );
std::pair< wmath::WPosition, wmath::WPosition > bb = grid->getBoundingBox();
......
......@@ -22,8 +22,6 @@
//
//---------------------------------------------------------------------------
#include <cassert>
#include "WTalairachConverter.h"
#include "../../common/math/WLinearAlgebraFunctions.h"
......
......@@ -25,6 +25,7 @@
#include <string>
#include <vector>
#include "../../common/WAssert.h"
#include "../../common/WIOTools.h"
#include "../../dataHandler/WDataSet.h"
#include "../../dataHandler/WDataSetSingle.h"
......@@ -223,7 +224,7 @@ void WMData::moduleMain()
boost::filesystem::path p( fileName );
p.replace_extension( "" );
suffix = getSuffix( p.string() );
assert( suffix == ".nii" && "currently only nii files may be gzipped" );
WAssert( suffix == ".nii", "Currently only nii files may be gzipped." );
}
m_isTexture = true;
......
......@@ -179,7 +179,7 @@ boost::shared_ptr< WValueSet< float > > makeFloatValueSet( boost::shared_ptr< WV
WAssert( false, "Unknow data type in makeFloatDataSet" );
}
assert( false && "If this assertion is reached, the code above has to be fixed." );
WAssert( false, "If this assertion is reached, the code above has to be fixed." );
return boost::shared_ptr< WValueSet< float > >();
}
......
......@@ -25,6 +25,7 @@
#include <list>
#include <vector>
#include "../../common/WAssert.h"
#include "WUpdateThread.h"
#include "WROIManagerFibers.h"
......@@ -143,7 +144,7 @@ void WROIManagerFibers::addFiberDataset( boost::shared_ptr< const WDataSetFibers
void WROIManagerFibers::removeFiberDataset( boost::shared_ptr< const WDataSetFibers > /*fibers*/ )
{
assert( 0 && "removeFiberDataset( --- ) not implemented yet." );
WAssert( false, "removeFiberDataset( --- ) not implemented yet." );
}
boost::shared_ptr< std::vector< bool > > WROIManagerFibers::getBitField()
......
......@@ -33,6 +33,7 @@
#include "../../common/WStringUtils.h"
#include "../../common/WProgress.h"
#include "../../common/WAssert.h"
#include "../../dataHandler/WGridRegular3D.h"
#include "../../kernel/WKernel.h"
#include "../../common/math/WPosition.h"
......@@ -81,9 +82,9 @@ size_t getId( size_t xDim, size_t yDim, size_t /*zDim*/, size_t x, size_t y, siz
double mask( size_t i, size_t j, size_t k )
{
assert( i < 3 );
assert( j < 3 );
assert( k < 3 );
WAssert( i < 3, "Index larger than two where [0,1,2] is expected." );
WAssert( j < 3, "Index larger than two where [0,1,2] is expected." );
WAssert( k < 3, "Index larger than two where [0,1,2] is expected." );
double maskEntries[3][3][3] = { // NOLINT
{ { 0, 1, 0 }, { 1, 2, 1 }, { 0, 1, 0 } }, // NOLINT
{ { 1, 2, 1 }, { 2, 4, 2 }, { 1, 2, 1 } }, // NOLINT
......@@ -148,7 +149,7 @@ boost::shared_ptr< WValueSet< double > > WMGaussFiltering::iterativeFilterField(
{
// the grid used
boost::shared_ptr<WGridRegular3D> grid = boost::shared_dynamic_cast< WGridRegular3D >( m_dataSet->getGrid() );
assert( grid );
WAssert( grid, "Grid is not of type WGridRegular3D." );
// use a custom progress combiner
boost::shared_ptr< WProgress > prog = boost::shared_ptr< WProgress >(
......@@ -235,7 +236,7 @@ void WMGaussFiltering::moduleMain()
{
boost::shared_ptr<WValueSet<unsigned char> > vals;
vals = boost::shared_dynamic_cast<WValueSet<unsigned char> >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
newValueSet = iterativeFilterField( vals, iterations );
break;
}
......@@ -243,7 +244,7 @@ void WMGaussFiltering::moduleMain()
{
boost::shared_ptr<WValueSet<int16_t> > vals;
vals = boost::shared_dynamic_cast<WValueSet<int16_t> >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
newValueSet = iterativeFilterField( vals, iterations );
break;
}
......@@ -251,7 +252,7 @@ void WMGaussFiltering::moduleMain()
{
boost::shared_ptr<WValueSet<int32_t> > vals;
vals = boost::shared_dynamic_cast<WValueSet<int32_t> >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
newValueSet = iterativeFilterField( vals, iterations );
break;
}
......@@ -259,7 +260,7 @@ void WMGaussFiltering::moduleMain()
{
boost::shared_ptr<WValueSet<float> > vals;
vals = boost::shared_dynamic_cast<WValueSet<float> >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
newValueSet = iterativeFilterField( vals, iterations );
break;
}
......@@ -267,12 +268,12 @@ void WMGaussFiltering::moduleMain()
{
boost::shared_ptr<WValueSet<double> > vals;
vals = boost::shared_dynamic_cast<WValueSet<double> >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
newValueSet = iterativeFilterField( vals, iterations );
break;
}
default:
assert( false && "Unknown data type in Gauss Filtering module" );
WAssert( false, "Unknown data type in Gauss Filtering module" );
}
m_output->updateData( boost::shared_ptr<WDataSetScalar>( new WDataSetScalar( newValueSet, m_dataSet->getGrid() ) ) );
......@@ -315,19 +316,4 @@ void WMGaussFiltering::properties()
m_iterations = m_properties->addProperty( "Iterations", "How often should the filter be applied.", 1, m_propCondition );
m_iterations->setMin( 0 );
m_iterations->setMax( 100 );
// ( m_properties->addInt( "Filter Size", 1 ) )->connect( boost::bind( &WMGaussFiltering::slotPropertyChanged, this, _1 ) );
}
void WMGaussFiltering::slotPropertyChanged( std::string propertyName )
{
if( propertyName == "Filter Size" )
{
// TODO(wiebel): need code here
}
else
{
std::cout << propertyName << std::endl;
assert( 0 && "This property name is not supported by this function yet." );
}
}
......@@ -73,12 +73,6 @@ public:
*/
virtual const std::string getDescription() const;
/**
* Determine what to do if a property was changed.
* \param propertyName Name of the property.
*/
void slotPropertyChanged( std::string propertyName );
/**
* Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
* should never be initialized or modified in some other way. A simple new instance is required.
......
......@@ -27,6 +27,7 @@
#include <osg/MatrixTransform>
#include <osg/Projection>
#include "../../common/WAssert.h"
#include "../../kernel/WKernel.h"
#include "../../graphicsEngine/WGEResourceManager.h"
......@@ -195,7 +196,7 @@ void WMHud::init()
// connect updateGFX with picking
boost::shared_ptr< WGEViewer > viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "main" );
assert( viewer );
WAssert( viewer, "Requested viewer (main) not found." );
viewer->getPickHandler()->getPickSignal()->connect( boost::bind( &WMHud::updatePickText, this, _1 ) );
}
......
......@@ -209,7 +209,7 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
{
boost::shared_ptr< WValueSet< unsigned char > > vals;
vals = boost::shared_dynamic_cast< WValueSet< unsigned char > >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
generateSurface( ( *m_dataSet ).getGrid(), vals, isoValue );
break;
}
......@@ -217,7 +217,7 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
{
boost::shared_ptr< WValueSet< int16_t > > vals;
vals = boost::shared_dynamic_cast< WValueSet< int16_t > >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
generateSurface( ( *m_dataSet ).getGrid(), vals, isoValue );
break;
}
......@@ -225,7 +225,7 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
{
boost::shared_ptr< WValueSet< int32_t > > vals;
vals = boost::shared_dynamic_cast< WValueSet< int32_t > >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
generateSurface( ( *m_dataSet ).getGrid(), vals, isoValue );
break;
}
......@@ -233,7 +233,7 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
{
boost::shared_ptr< WValueSet< float > > vals;
vals = boost::shared_dynamic_cast< WValueSet< float > >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
generateSurface( ( *m_dataSet ).getGrid(), vals, isoValue );
break;
}
......@@ -241,12 +241,12 @@ void WMMarchingCubes::generateSurfacePre( double isoValue )
{
boost::shared_ptr< WValueSet< double > > vals;
vals = boost::shared_dynamic_cast< WValueSet< double > >( ( *m_dataSet ).getValueSet() );
assert( vals );
WAssert( vals, "Data type and data type indicator must fit." );
generateSurface( ( *m_dataSet ).getGrid(), vals, isoValue );
break;
}
default:
assert( false && "Unknow data type in MarchingCubes module" );
WAssert( false, "Unknow data type in MarchingCubes module" );
}
}
......@@ -274,14 +274,14 @@ template< typename T > void WMMarchingCubes::generateSurface( boost::shared_ptr<
boost::shared_ptr< WValueSet< T > > vals,
double isoValue )
{
assert( vals );
WAssert( vals, "No value set provided." );
m_idToVertices.clear();
m_trivecTriangles.clear();
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( inGrid );
m_grid = grid;
assert( grid );
WAssert( grid, "Grid is not of type WGridRegular3D." );
m_fCellLengthX = grid->getOffsetX();
m_fCellLengthY = grid->getOffsetY();
......@@ -794,7 +794,7 @@ int myIsfinite( double number )
// Microsoft Visual C++ and Borland C++ Builder use _finite().
return _finite(number);
#else
assert( 0 && "isfinite not provided on this platform or platform not known" );
WAssert( false, "isfinite not provided on this platform or platform not known." );
#endif
}
......
......@@ -35,6 +35,7 @@
#include <osg/Geometry>
#include <osg/Group>
#include "../../common/WAssert.h"
#include "../../common/math/WVector3D.h"
#include "../../dataHandler/WDataSet.h"
#include "../../dataHandler/WDataHandler.h"
......@@ -155,10 +156,10 @@ void WMNavSlices::notifyTextureChange()
void WMNavSlices::moduleMain()
{
boost::shared_ptr< WGraphicsEngine > ge = WGraphicsEngine::getGraphicsEngine();
assert( ge );
WAssert( ge, "No graphics engine present." );
m_viewer = ge->getViewerByName( "main" );
assert( m_viewer );
WAssert( m_viewer, "Requested viewer not found." );
m_viewer->getPickHandler()->getPickSignal()->connect( boost::bind( &WMNavSlices::setSlicePosFromPick, this, _1 ) );
// signal ready state
......
......@@ -137,7 +137,7 @@ template< typename T > void WMWriteNIfTI::castData( void*& returnData )
{
boost::shared_ptr< WValueSetBase > valsB = ( *m_dataSet ).getValueSet();
boost::shared_ptr< WValueSet< T > > vals = boost::shared_dynamic_cast< WValueSet< T > >( ( *m_dataSet ).getValueSet() );
assert( vals && "Seems that value set type is not yet supported." );
WAssert( vals, "Seems that value set type is not yet supported." );
T* data = new T[vals->size()];
for( unsigned int i = 0; i < vals->size(); ++i )
......@@ -153,14 +153,15 @@ void WMWriteNIfTI::writeToFile()
nifti_image *outField = nifti_simple_init_nim();
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_dataSet->getGrid() );
assert( grid && "Seems that grid is of wrong type." );
WAssert( grid, "Seems that grid is of wrong type." );
size_t nbValues = ( *m_dataSet ).getValueSet()->size();
outField->nx = grid->getNbCoordsX();
outField->ny = grid->getNbCoordsY();
outField->nz = grid->getNbCoordsZ();
assert( grid->getNbCoordsX() * grid->getNbCoordsY() * grid->getNbCoordsZ() == nbValues );
WAssert( grid->getNbCoordsX() * grid->getNbCoordsY() * grid->getNbCoordsZ() == nbValues,
"Overall size incompatible with size in axis directions." );
// TODO(wiebel): only able to handle scalars now.
outField->nt = 1;
......
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