Commit 6a076928 authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[MERGE]

parents 2e38ebd8 4d99caf9
......@@ -6,10 +6,13 @@ allowOnlyOneFiberDataSet = yes # This will prevent you from accidently loading m
[modules]
## use this to specify the default module to add during load.
## It is a comma seperated list. If this is not specified the default empty is assumed.
## It is a comma seperated list. If this is not specified the
## default empty is assumed.
## An example could be
# default="HUD"
whiteList ="Isosurface,Bounding Box,Direct Volume Rendering,Distance Map Isosurface,Gauss Filtering,HUD,Vector Plot,Write NIfTI" # A list of modules that will be provided through the GUI. If the list is empty all available modules are provided.
# default="HUD"
## A list of modules that will be provided through the GUI.
## If the list is empty all available modules are provided.
whiteList ="Isosurface,Bounding Box,Direct Volume Rendering,Distance Map Isosurface,Gauss Filtering,HUD,Vector Plot,Write NIfTI,Mesh Reader,Triangle Mesh Renderer"
[qt4gui]
# hideAxial = yes # hide the axial view widget
......
......@@ -27,6 +27,7 @@
#include "exceptions/WDHException.h"
#include "WDataTexture3D.h"
#include "../common/WAssert.h"
#include "../common/WTransferable.h"
#include "../common/WCondition.h"
#include "WDataSet.h"
......@@ -42,7 +43,7 @@ WDataSet::WDataSet()
void WDataSet::setFileName( const std::string fileName )
{
assert( fileName != "" );
WAssert( fileName != "", "No filename set for data set." );
m_fileName = fileName;
}
......
......@@ -106,21 +106,14 @@ double WDataSetScalar::interpolate( const wmath::WPosition& pos, bool* success )
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
// TODO(wiebel): change this to eassert.
if( !grid )
{
throw WException( std::string( "This data set has a grid whose type is not yet supported for interpolation." ) );
}
// TODO(wiebel): change this to eassert.
WAssert( grid, "This data set has a grid whose type is not yet supported for interpolation." );
// TODO(wiebel): change this to WAssert.
// if( grid->getTransformationMatrix() != wmath::WMatrix<double>( 4, 4 ).makeIdentity() )
// {
// throw WException( std::string( "Only feasible for untranslated grid so far." ) );
// }
// TODO(wiebel): change this to eassert.
if( !( m_valueSet->order() == 0 && m_valueSet->dimension() == 1 ) )
{
throw WException( std::string( "Only implemented for scalar values so far." ) );
}
WAssert( ( m_valueSet->order() == 0 && m_valueSet->dimension() == 1 ),
"Only implemented for scalar values so far." );
*success = grid->encloses( pos );
......
......@@ -28,6 +28,7 @@
#include "WDataTexture3D.h"
#include "WValueSet.h"
#include "WGrid.h"
#include "../common/WAssert.h"
#include "../common/WPrototyped.h"
#include "../common/WException.h"
......@@ -40,9 +41,10 @@ WDataSetSingle::WDataSetSingle( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid )
: WDataSet()
{
assert( newValueSet );
assert( newGrid );
assert( newValueSet->size() == newGrid->size() );
WAssert( newValueSet, "Need a value set for new data set." );
WAssert( newGrid, "Need a grid for new data set." );
WAssert( newValueSet->size() == newGrid->size(),
"Number of grid position unequal number of values in value set." );
m_valueSet = newValueSet;
m_grid = newGrid;
......@@ -129,7 +131,7 @@ double WDataSetSingle::getValueAt( size_t id )
return static_cast< double >( boost::shared_dynamic_cast< WValueSet< double > >( getValueSet() )->getScalar( id ) );
}
default:
assert( false && "Unknow data type in dataset." );
WAssert( false, "Unknow data type in dataset." );
}
return 0.0;
......
......@@ -65,21 +65,14 @@ wmath::WVector3D WDataSetVector::interpolate( const wmath::WPosition& pos, bool
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
// TODO(wiebel): change this to eassert.
if( !grid )
{
throw WException( std::string( "This data set has a grid whose type is not yet supported for interpolation." ) );
}
// TODO(wiebel): change this to eassert.
WAssert( grid, "This data set has a grid whose type is not yet supported for interpolation." );
// TODO(wiebel): change this to WAssert.
// if( grid->getTransformationMatrix() != wmath::WMatrix<double>( 4, 4 ).makeIdentity() )
// {
// throw WException( std::string( "Only feasible for untranslated grid so far." ) );
// }
// TODO(wiebel): change this to eassert.
if( !( m_valueSet->order() == 1 && m_valueSet->dimension() == 3 ) )
{
throw WException( std::string( "Only implemented for 3D Vectors so far." ) );
}
WAssert( ( m_valueSet->order() == 1 && m_valueSet->dimension() == 3 ),
"Only implemented for 3D Vectors so far." );
*success = grid->encloses( pos );
......@@ -149,7 +142,7 @@ wmath::WVector3D WDataSetVector::getVectorAt( size_t index ) const
return boost::shared_dynamic_cast< WValueSet< double > >( getValueSet() )->getVector3D( index );
}
default:
assert( false && "Unknow data type in dataset." );
WAssert( false, "Unknow data type in dataset." );
}
return wmath::WVector3D( 0, 0, 0 );
......
......@@ -85,9 +85,9 @@ WGridRegular3D::WGridRegular3D( unsigned int nbPosX, unsigned int nbPosY, unsign
m_matrix( wmath::WMatrix<double>( mat ) ),
m_matrixInverse( 3, 3 )
{
assert( mat.getNbRows() == 4 && mat.getNbCols() == 4 );
WAssert( mat.getNbRows() == 4 && mat.getNbCols() == 4, "Transformation matrix has wrong dimensions." );
// only affine transformations are allowed
assert( mat( 3, 0 ) == 0.0 && mat( 3, 1 ) == 0.0 && mat( 3, 2 ) == 0.0 );
WAssert( mat( 3, 0 ) == 0.0 && mat( 3, 1 ) == 0.0 && mat( 3, 2 ) == 0.0, "Transf. matrix has to have no projection part." );
m_origin = WPosition( mat( 0, 3 ) / mat( 3, 3 ), mat( 1, 3 ) / mat( 3, 3 ), mat( 2, 3 ) / mat( 3, 3 ) );
......@@ -251,13 +251,13 @@ int WGridRegular3D::getNVoxelCoord( const wmath::WPosition& pos, size_t axis ) c
case 2 : nbAxisPos = m_nbPosZ;
offsetAxis = m_offsetZ;
break;
default : assert( 1 == 0 && "invalid axis selected, must be between 0 and 2, including 0 and 2" );
default : WAssert( false, "Invalid axis selected, must be between 0 and 2, including 0 and 2." );
}
if( result < 0 || result > offsetAxis * ( nbAxisPos - 1 ) )
{
return -1;
}
assert( offsetAxis != 0.0 );
WAssert( offsetAxis != 0.0, "The offset in axis direction has to be non-zero for all grids." );
int integerFactor = std::floor( result / offsetAxis );
double remainder = result - integerFactor * offsetAxis;
double x = integerFactor + std::floor( remainder / ( offsetAxis * 0.5 ) );
......
......@@ -24,8 +24,8 @@
#include <string>
#include "../common/WAssert.h"
#include "WSubject.h"
#include "WPersonalInformation.h"
WPersonalInformation WPersonalInformation::createDummyInformation()
......@@ -65,7 +65,7 @@ uint64_t WPersonalInformation::getSubjectID() const
void WPersonalInformation::setSubjectID( uint64_t subjectID )
{
assert( subjectID != WSubject::SUBJECT_UNKNOWN && "zero is reserved for dummies" );
WAssert( subjectID != WSubject::SUBJECT_UNKNOWN, "ID zero is reserved for dummies." );
m_subjectID = subjectID;
}
......@@ -81,7 +81,7 @@ std::string WPersonalInformation::getCompleteName() const
void WPersonalInformation::setLastName( std::string lastName )
{
assert( m_subjectID != WSubject::SUBJECT_UNKNOWN && "SubjectID is still zero. This is reserved for empty dummies. Set it first." );
WAssert( m_subjectID != WSubject::SUBJECT_UNKNOWN, "SubjectID is still zero. This is reserved for empty dummies. Set it first." );
m_lastName = lastName;
}
......
......@@ -25,7 +25,6 @@
#ifndef WVALUESET_H
#define WVALUESET_H
#include <cassert>
#include <cstddef>
#include <vector>
......@@ -69,17 +68,17 @@ public:
switch( m_order )
{
case 0 : // scalar
assert( m_dimension == 1 && "but m_order was 0" );
return rawSize();
WAssert( m_dimension == 1, "Although order zero, (dimension != 1) was found." );
return rawSize();
case 1 : // vector
assert( rawSize() % m_dimension == 0 );
return rawSize() / m_dimension;
WAssert( rawSize() % m_dimension == 0, "Raw size and dimension don't fit." );
return rawSize() / m_dimension;
case 2 : // matrix
assert( rawSize() % ( m_dimension * m_dimension ) == 0 );
return rawSize() / ( m_dimension * m_dimension );
WAssert( rawSize() % ( m_dimension * m_dimension ) == 0, "Raw size and dimension don't fit." );
return rawSize() / ( m_dimension * m_dimension );
default : // other
assert( 1 == 0 && "Unsupported tensor order" );
return 0;
WAssert( false, "Unsupported tensor order." );
return 0;
}
}
......
......@@ -23,8 +23,8 @@
//---------------------------------------------------------------------------
#include <cstddef>
#include <cassert>
#include "../common/WAssert.h"
#include "WValueSetBase.h"
......@@ -33,8 +33,8 @@ WValueSetBase::WValueSetBase( size_t order, size_t dimension, dataType inDataTyp
m_dimension( dimension ),
m_dataType( inDataType )
{
assert( order <= 2 );
assert( dimension >= 1 );
WAssert( order <= 2, "We probably do not (yet) support the found order of tensors." );
WAssert( dimension >= 1, "Dimension has to be 1 at least." );
}
WValueSetBase::~WValueSetBase()
......
......@@ -31,6 +31,7 @@
#include "WLoaderBiosig.h"
#include "../WEEG.h"
#include "../WSubject.h"
#include "../../common/WAssert.h"
#include "../../common/WException.h"
#include "../../common/WLogger.h"
#include "../../common/WStringUtils.h"
......@@ -71,7 +72,7 @@ void WLoaderBiosig::fillSegmentRowBased( std::vector<std::vector<double> >* segm
boost::shared_ptr< WDataSet > WLoaderBiosig::load()
{
assert( m_fileName.substr( m_fileName.size() - 4 ) == ".edf" && "We expect only EDF so far." );
WAssert( m_fileName.substr( m_fileName.size() - 4 ) == ".edf", "We expect only EDF for the biosig loader so far." );
#ifdef _MSC_VER
hd = biosig_sopen( m_fileName.c_str(), "r", 0 );
......
......@@ -28,6 +28,7 @@
#include <boost/lexical_cast.hpp>
#include "../../common/WAssert.h"
#include "../../common/WLogger.h"
#include "WLoaderEEG.h"
......@@ -102,8 +103,8 @@ WEEGElectrodeLibrary WLoaderEEG::extractElectrodePositions()
}
std::getline( ifs, line );
assert( elecPos.size() == numPositions );
assert( line.substr( 0, 6 ) == "Labels" );
WAssert( elecPos.size() == numPositions, "Incompatible number of positions and electrodes found." );
WAssert( line.substr( 0, 6 ) == "Labels", "Wrong string in file header found." );
return elecPos;
}
......@@ -29,6 +29,7 @@
#include <boost/lexical_cast.hpp>
#include "../../common/WAssert.h"
#include "../../common/WException.h"
#include "../../common/WStringUtils.h"
#include "../WEEG.h"
......@@ -70,7 +71,7 @@ boost::shared_ptr< WDataSet > WLoaderEEGASCII::load()
while( !in.eof() )
{
tokens = string_utils::tokenize( tmp );
assert( tokens.size() == nbChannels );
WAssert( tokens.size() == nbChannels, "Error." );
for( unsigned int i = 0; i < nbChannels; ++i )
{
segments[0][i].push_back( boost::lexical_cast< double >( tokens[i].c_str() ) );
......
......@@ -23,8 +23,6 @@
//---------------------------------------------------------------------------
#include <stdint.h>
#include <cassert>
#include <fstream>
#include <string>
#include <vector>
......@@ -32,6 +30,7 @@
#include <boost/shared_ptr.hpp>
#include "../../common/WIOTools.h"
#include "../../common/WAssert.h"
#include "../../common/WLogger.h"
#include "../../common/WStringUtils.h"
#include "../WDataSetFibers.h"
......@@ -137,7 +136,7 @@ void WReaderFiberVTK::readPoints()
m_pointFiberMapping->reserve( numPoints );
line = getLine( "also eat the remaining newline after points declaration" );
assert( std::string( "" ) == line );
WAssert( std::string( "" ) == line, "Found characters in file where nothing was expected." );
}
void WReaderFiberVTK::readLines()
......@@ -182,7 +181,7 @@ void WReaderFiberVTK::readLines()
delete[] lineData;
line = getLine( "also eat the remaining newline after lines declaration" );
assert( std::string( "" ) == line );
WAssert( std::string( "" ) == line, "Found characters in file where nothing was expected." );
}
std::string WReaderFiberVTK::getLine( const std::string& desc )
......
......@@ -30,6 +30,7 @@
#include <boost/lexical_cast.hpp>
#include <boost/shared_ptr.hpp>
#include "../../common/WAssert.h"
#include "../../common/WIOTools.h"
#include "../../common/WStringUtils.h"
#include "../exceptions/WDHException.h"
......@@ -44,13 +45,13 @@ WReaderLookUpTableVTK::WReaderLookUpTableVTK( std::string fname )
void WReaderLookUpTableVTK::readTable( boost::shared_ptr< std::vector< double > > table ) const
{
assert( table->size() == 0 && "error, since the vector will be filled IN HERE" );
WAssert( table->size() == 0, "Non-zero size indicates an error, since the vector will be filled IN HERE." );
// code mainly taken from WLoaderFibers.cpp, and adjusted since I don't
// know how to code this DRY. Any suggestions?
std::ifstream ifs;
ifs.open( m_fname.c_str(), std::ifstream::in | std::ifstream::binary );
assert( ifs && !ifs.bad() );
WAssert( ifs && !ifs.bad(), "" );
std::vector< std::string > header;
std::string line;
......@@ -70,10 +71,10 @@ void WReaderLookUpTableVTK::readTable( boost::shared_ptr< std::vector< double >
{
throw WDHIOFailure( "Reading first 4 lines of '" + m_fname + "': " + e.what() );
}
assert( header[0] == "# vtk DataFile Version 3.0" );
assert( header[1] == "DXtLookUpTable from OpenWalnut" );
assert( header[2] == "BINARY" );
assert( header[3] == "FIELD DXtLookUpTable 1" );
WAssert( header[0] == "# vtk DataFile Version 3.0", "Wrong string in file header found." );
WAssert( header[1] == "DXtLookUpTable from OpenWalnut", "Wrong string in file header found." );
WAssert( header[2] == "BINARY", "Wrong string in file header found." );
WAssert( header[3] == "FIELD DXtLookUpTable 1", "Wrong string in file header found." );
try
{
......
......@@ -22,13 +22,13 @@
//
//---------------------------------------------------------------------------
#include <cassert>
#include <fstream>
#include <string>
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
#include "../../common/WAssert.h"
#include "../../common/WIOTools.h"
#include "../WDataSetFiberVector.h"
#include "../exceptions/WDHIOFailure.h"
......@@ -70,13 +70,13 @@ void WWriterFiberVTK::writeFibs( boost::shared_ptr< const WDataSetFiberVector >
for( size_t j = 0; j < fib.size(); ++j )
{
const wmath::WPosition &point = fib[j];
assert( pntPosOffset % 3 == 0 && "(pOff % 3) was not equal to 0" );
assert( pntPosOffset / 3 < numPoints );
WAssert( pntPosOffset % 3 == 0, "(pOff % 3) was not equal to 0" );
WAssert( pntPosOffset / 3 < numPoints, "pntPosOffset is to large." );
rawLineData[lnsPosOffset++] = static_cast< unsigned int >( pntPosOffset / 3 );
rawPointData[pntPosOffset++] = static_cast< float >( point[0] );
rawPointData[pntPosOffset++] = static_cast< float >( point[1] );
rawPointData[pntPosOffset++] = static_cast< float >( point[2] );
assert( pntPosOffset < ( ( numPoints * 3 ) + 1 ) && "pOff < #pts" );
WAssert( pntPosOffset < ( ( numPoints * 3 ) + 1 ), "pOff < #pts" );
}
}
wiotools::switchByteOrderOfArray< float >( rawPointData, numPoints * 3 );
......
......@@ -22,7 +22,6 @@
//
//---------------------------------------------------------------------------
#include <cassert>
#include <fstream>
#include <string>
#include <vector>
......
......@@ -393,6 +393,7 @@ void WMainWindow::projectSave( const std::vector< boost::shared_ptr< WProjectFil
QFileDialog fd;
fd.setWindowTitle( "Save Project as" );
fd.setFileMode( QFileDialog::AnyFile );
fd.setAcceptMode( QFileDialog::AcceptSave );
QStringList filters;
filters << "Project File (*.owproj)"
......
......@@ -365,6 +365,11 @@ void WQtDatasetBrowser::selectTreeItem()
switch ( m_treeWidget->selectedItems().at( 0 )->type() )
{
case SUBJECT:
case MODULEHEADER:
// Here we just take a prototype module with no output connectors
// to get the modules with no input connector.
module = WModuleFactory::getModuleFactory()->getPrototypeByName( "HUD" );
createCompatibleButtons( module );
break;
case DATASET:
module = ( static_cast< WQtDatasetTreeItem* >( m_treeWidget->selectedItems().at( 0 ) ) )->getModule();
......@@ -372,8 +377,6 @@ void WQtDatasetBrowser::selectTreeItem()
infoProps = module->getInformationProperties();
createCompatibleButtons( module );
break;
case MODULEHEADER:
break;
case MODULE:
module = ( static_cast< WQtModuleTreeItem* >( m_treeWidget->selectedItems().at( 0 ) ) )->getModule();
props = module->getProperties();
......
......@@ -58,6 +58,7 @@
#include "../modules/vectorPlot/WMVectorPlot.h"
#include "../modules/geometryGlyphs/WMGeometryGlyphs.h"
#include "../modules/arbitraryRois/WMArbitraryRois.h"
#include "../modules/meshReader/WMMeshReader.h"
#include "WModuleFactory.h"
#include "exceptions/WPrototypeNotUnique.h"
#include "exceptions/WPrototypeUnknown.h"
......@@ -114,6 +115,7 @@ void WModuleFactory::load()
m_prototypes.insert( boost::shared_ptr< WModule >( new WMVectorPlot() ) );
m_prototypes.insert( boost::shared_ptr< WModule >( new WMGeometryGlyphs() ) );
m_prototypes.insert( boost::shared_ptr< WModule >( new WMArbitraryRois() ) );
m_prototypes.insert( boost::shared_ptr< WModule >( new WMMeshReader() ) );
lock.unlock();
......
......@@ -133,8 +133,7 @@ void WMMarchingCubes::moduleMain()
// set appropriate constraints for properties
m_isoValueProp->setMin( m_dataSet->getMin() );
m_isoValueProp->setMax( m_dataSet->getMax() );
m_isoValueProp->set( 0.5 * ( m_dataSet->getMax() + m_dataSet->getMin() ) );
m_moduleState.wait(); // need this to avoid double executing because "set" fires the conditionset
m_isoValueProp->set( 0.5 * ( m_dataSet->getMax() + m_dataSet->getMin() ), true );
}
// update ISO surface
......@@ -163,6 +162,8 @@ void WMMarchingCubes::moduleMain()
// NOTE: you can add your own conditions to m_moduleState using m_moduleState.add( ... )
m_moduleState.wait();
}
WKernel::getRunningKernel()->getGraphicsEngine()->getViewer()->getScene()->remove( m_moduleNode );
}
void WMMarchingCubes::connectors()
......@@ -400,7 +401,7 @@ void WMMarchingCubes::renderMesh( boost::shared_ptr< WTriangleMesh2 > mesh )
m_cmapUniforms.push_back( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "useCmap8", 0 ) ) );
m_cmapUniforms.push_back( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "useCmap9", 0 ) ) );
for ( int i = 0; i < 10; ++i )
for ( int i = 0; i < m_maxNumberOfTextures; ++i )
{
state->addUniform( m_typeUniforms[i] );
state->addUniform( m_thresholdUniforms[i] );
......@@ -564,7 +565,7 @@ void WMMarchingCubes::updateGraphics()
osg::StateSet* rootState = m_surfaceGeode->getOrCreateStateSet();
// reset all uniforms
for ( int i = 0; i < 10; ++i )
for ( int i = 0; i < m_maxNumberOfTextures; ++i )
{
m_typeUniforms[i]->set( 0 );
}
......@@ -599,6 +600,10 @@ void WMMarchingCubes::updateGraphics()
m_cmapUniforms[c]->set( cmap );
++c;
if( c == m_maxNumberOfTextures )
{
break;
}
}
}
}
......
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