Commit 88a2e07e authored by schurade's avatar schurade

[MERGE] with 860a016a40fad742306d6b5f80b534702d7d4454

parents 4e83ac68 71eafac1
......@@ -612,10 +612,10 @@ RECURSIVE = YES
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE = src/dataHandler/io/nifti \
EXCLUDE = src/ext \
src/dataHandler/io/nifti \
src/dataHandler/io/biosig \
src/dataHandler/io/biosigWin \
src/dataHandler/io/libeep \
src/common/platformDependent/visualStudio/inttypes.h \
src/modules/lic/fibernavigator \
src/modules/lic/fantom
......
......@@ -612,10 +612,10 @@ RECURSIVE = YES
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE = src/dataHandler/io/nifti \
EXCLUDE = src/ext \
src/dataHandler/io/nifti \
src/dataHandler/io/biosig \
src/dataHandler/io/biosigWin \
src/dataHandler/io/libeep \
src/common/platformDependent/visualStudio/inttypes.h \
src/modules/lic/fibernavigator \
src/modules/lic/fantom
......
......@@ -147,6 +147,7 @@ ADD_SUBDIRECTORY( gui )
ADD_SUBDIRECTORY( kernel )
ADD_SUBDIRECTORY( common )
ADD_SUBDIRECTORY( modules )
ADD_SUBDIRECTORY( ext ) # The needed external libraries
#-------------------------------------------------------------------------------------------------------------
# Writes information about the revision of the current code to the file version.h which then gets included by OpenWalnut.cpp
......@@ -268,7 +269,7 @@ ADD_CUSTOM_TARGET( numCores
FILE( GLOB_RECURSE STYLE_CPP ${PROJECT_SOURCE_DIR}/*.cpp )
FILE( GLOB_RECURSE STYLE_H ${PROJECT_SOURCE_DIR}/*.h )
# Set dirs to exclude from stylecheck
SET( EXCLUDE_DIRS "/dataHandler/io/nifti/;/dataHandler/io/biosig/;/dataHandler/io/biosigWin/;/dataHandler/io/biosig/XMLParser/;/dataHandler/io/biosigWin/XMLParser/;/dataHandler/io/libeep/avr/;/dataHandler/io/libeep/cnt/;/dataHandler/io/libeep/eep/;/common/platformDependent/visualStudio/;/modules/lic/fibernavigator/;/modules/lic/fantom/" )
SET( EXCLUDE_DIRS "/ext/nifti/;/dataHandler/io/biosig/;/dataHandler/io/biosigWin/;/dataHandler/io/biosig/XMLParser/;/dataHandler/io/biosigWin/XMLParser/;/ext/libeep/avr/;/ext/libeep/cnt/;/ext/libeep/eep/;/common/platformDependent/visualStudio/;/modules/lic/fibernavigator/;/modules/lic/fantom/" )
FOREACH( dirname ${EXCLUDE_DIRS} )
FILE( GLOB EXCLUDE_H ${PROJECT_SOURCE_DIR}${dirname}*.h )
FILE( GLOB EXCLUDE_CPP ${PROJECT_SOURCE_DIR}${dirname}*.cpp )
......
# Needed because libeep has includes of form #include <cnt/cnt.h>
INCLUDE_DIRECTORIES( io/libeep )
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/ext/libeep )
ADD_SUBDIRECTORY( io )
ADD_SUBDIRECTORY( datastructures )
FILE( GLOB DATAHANDLER_SRC "*.cpp" "*.h" )
FILE( GLOB DATAHANDLER_DATASTRUCTURES_SRC "datastructures/*.cpp" "datastructures/*.h" )
FILE( GLOB DATAHANDLER_EXCEPTIONS_SRC "exceptions/*.cpp" "exceptions/*.h" )
......
ADD_SUBDIRECTORY( nifti )
IF( NOT CMAKE_GENERATOR MATCHES "Visual Studio" )
ADD_SUBDIRECTORY( biosig )
ELSE ()
ADD_SUBDIRECTORY( biosigWin )
ENDIF()
ADD_SUBDIRECTORY( libeep )
FILE( GLOB DATAHANDLER_IO_SRC "*.cpp" "*.h" )
......
......@@ -34,7 +34,7 @@
extern "C"
{
#include "libeep/cnt/cnt.h"
#include "../../ext/libeep/cnt/cnt.h"
}
#include "../../common/exceptions/WOutOfBounds.h"
......
......@@ -28,7 +28,7 @@
extern "C"
{
#include "libeep/cnt/cnt.h"
#include "../../ext/libeep/cnt/cnt.h"
}
#include "../../common/WLogger.h"
......
......@@ -33,7 +33,7 @@
#include "../WDataSet.h"
#include "../../common/math/WMatrix.h"
#include "nifti/nifti1_io.h"
#include "../../ext/nifti/nifti1_io.h"
/**
* Reader for the NIfTI file format. For NIfTI just see http://nifti.nimh.nih.gov/.
......
# Needed because libeep has includes of form #include <cnt/cnt.h>
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/ext/libeep )
ADD_SUBDIRECTORY( libeep )
ADD_SUBDIRECTORY( nifti )
\ No newline at end of file
This directory contains free software we distribute with OpenWalnut. This software has been created by others and might not be the most recent version available. See the specific subdirectories for the licenses of the codes.
\ No newline at end of file
......@@ -47,6 +47,68 @@ WMHomeGlyphs::WMHomeGlyphs():
{
}
namespace
{
// Helper routine to estimate normals in a triangle soup in which antipodal
// vertices are subsequent
// taken from teem (glyphElf.c)
void estimateNormalsAntipodal( limnPolyData *glyph, const char normalize )
{
unsigned int faceno = glyph->indxNum/3;
unsigned int *faces = glyph->indx;
unsigned int f;
memset( glyph->norm, 0, sizeof( float )*3*glyph->xyzwNum );
for( f = 0; f < faceno/2; f++ )
{
float diff1[3];
float diff2[3];
float cross[3];
ELL_3V_SUB( diff1, glyph->xyzw+4*faces[3*f+1],
glyph->xyzw+4*faces[3*f] );
ELL_3V_SUB( diff2, glyph->xyzw+4*faces[3*f+2],
glyph->xyzw+4*faces[3*f] );
ELL_3V_CROSS( cross, diff1, diff2 );
ELL_3V_INCR( glyph->norm+3*faces[3*f], cross );
ELL_3V_INCR( glyph->norm+3*faces[3*f+1], cross );
ELL_3V_INCR( glyph->norm+3*faces[3*f+2], cross );
/* same for anti-face */
if ( faces[3*f]%2 == 0 )
{
ELL_3V_SUB( glyph->norm+3*faces[3*f]+3, glyph->norm+3*faces[3*f]+3, cross );
}
else
{
ELL_3V_SUB( glyph->norm+3*faces[3*f]-3, glyph->norm+3*faces[3*f]-3, cross );
}
if ( faces[3*f+1]%2 == 0 )
{
ELL_3V_SUB( glyph->norm+3*faces[3*f+1]+3, glyph->norm+3*faces[3*f+1]+3, cross );
}
else
{
ELL_3V_SUB( glyph->norm+3*faces[3*f+1]-3, glyph->norm+3*faces[3*f+1]-3, cross );
}
if ( faces[3*f+2]%2 == 0 )
{
ELL_3V_SUB( glyph->norm+3*faces[3*f+2]+3, glyph->norm+3*faces[3*f+2]+3, cross );
}
else
{
ELL_3V_SUB( glyph->norm+3*faces[3*f+2]-3, glyph->norm+3*faces[3*f+2]-3, cross );
}
}
if ( normalize )
{
float len;
unsigned int i;
for ( i = 0; i < glyph->normNum; i++ )
{
ELL_3V_NORM_TT( glyph->norm + 3*i, float, glyph->norm + 3*i, len );
}
}
}
}
WMHomeGlyphs::~WMHomeGlyphs()
{
// Cleanup!
......@@ -90,21 +152,22 @@ void WMHomeGlyphs::properties()
m_sliceOrientations->addItem( "x", "x-slice" );
m_sliceOrientations->addItem( "y", "y-slice" );
m_sliceOrientations->addItem( "z", "z-slice" );
m_sliceOrientationSelection = m_properties->addProperty( "Slice Orientation",
m_sliceOrientationSelection = m_properties->addProperty( "Slice orientation",
"Which slice will be shown?",
m_sliceOrientations->getSelector( 1 ),
m_recompute );
WPropertyHelper::PC_SELECTONLYONE::addTo( m_sliceOrientationSelection );
m_glyphSizeProp = m_properties->addProperty( "Glyph Size", "Size of the displayed glyphs.", 0.5, m_recompute );
m_glyphSizeProp = m_properties->addProperty( "Glyph size", "Size of the displayed glyphs.", 0.5, m_recompute );
m_glyphSizeProp->setMin( 0 );
m_glyphSizeProp->setMax( 100. );
m_sliceIdProp = m_properties->addProperty( "Slice Id", "Number of the slice to display", 0, m_recompute );
m_sliceIdProp = m_properties->addProperty( "Slice ID", "Number of the slice to display", 0, m_recompute );
m_sliceIdProp->setMin( 0 );
m_sliceIdProp->setMax( 128 );
m_usePolarPlotProp = m_properties->addProperty( "Use Polar Plot", "Use polar plot for glyph instead of HOME?", false, m_recompute );
m_usePolarPlotProp = m_properties->addProperty( "Use polar plot", "Use polar plot for glyph instead of HOME?", true, m_recompute );
m_useNormalization = m_properties->addProperty( "Radius normalization", "Scale the radius of each glyph to be in [0,1].", true, m_recompute );
}
void WMHomeGlyphs::moduleMain()
......@@ -265,23 +328,33 @@ void WMHomeGlyphs::renderSlice( size_t sliceId )
limnPolyData *glyph = limnPolyDataNew();
limnPolyDataCopy( glyph, sphere );
double radius = 1.0; // some initialization
if( usePolar )
{
char isdef = 3; // some initialization
elfGlyphPolar( glyph, 1, ten, type, &isdef, 0, normalize, NULL, NULL );
radius = elfGlyphPolar( glyph, 1, ten, type, &isdef, 0, normalize, NULL, NULL );
WAssert( isdef != 0, "Tensor is non positive definite. Think about that." );
}
else
{
elfGlyphHOME( glyph, 1, ten, type, NULL, normalize );
radius = elfGlyphHOME( glyph, 1, ten, type, NULL, normalize );
}
// -------------------------------------------------------------------------------------------------------
// One can insert per-peak coloring here (see http://www.ci.uchicago.edu/~schultz/sphinx/home-glyph.html )
// -------------------------------------------------------------------------------------------------------
minMaxNormalization( glyph );
float scale = m_glyphSizeProp->get(); // glyph size
if( m_useNormalization->get() )
{
minMaxNormalization( glyph );
}
else
{
scale = scale / radius;
}
estimateNormalsAntipodal( glyph, normalize );
wmath::WPosition glyphPos = grid->getPosition( posId );
......@@ -292,15 +365,14 @@ void WMHomeGlyphs::renderSlice( size_t sliceId )
glyphElements->push_back( vertsUpToCurrentIteration + glyph->indx[vertId] );
}
float radius = 1.0 / m_glyphSizeProp->get(); // glyph size
for( unsigned int vertId = 0; vertId < glyph->xyzwNum; ++vertId )
{
//-------------------------------
// vertices
( *vertArray )[vertsUpToCurrentIteration+vertId][0] = glyph->xyzw[m_nbVertCoords*vertId ] / radius + glyphPos[0];
( *vertArray )[vertsUpToCurrentIteration+vertId][1] = glyph->xyzw[m_nbVertCoords*vertId+1] / radius + glyphPos[1];
( *vertArray )[vertsUpToCurrentIteration+vertId][2] = glyph->xyzw[m_nbVertCoords*vertId+2] / radius + glyphPos[2];
( *vertArray )[vertsUpToCurrentIteration+vertId][0] = glyph->xyzw[m_nbVertCoords*vertId ] * scale + glyphPos[0];
( *vertArray )[vertsUpToCurrentIteration+vertId][1] = glyph->xyzw[m_nbVertCoords*vertId+1] * scale + glyphPos[1];
( *vertArray )[vertsUpToCurrentIteration+vertId][2] = glyph->xyzw[m_nbVertCoords*vertId+2] * scale + glyphPos[2];
// ------------------------------------------------
// normals
......
......@@ -140,6 +140,7 @@ private:
boost::shared_ptr< WItemSelection > m_sliceOrientations; //!< A list of the selectable slice orientations, i.e x, y and z.
WPropSelection m_sliceOrientationSelection; //!< To choose whether to x, y or z slice.
WPropBool m_usePolarPlotProp; //!< Property indicating whether to use polar plot instead of HOME glyph
WPropBool m_useNormalization; //!< Indicates whether to us radius normalization.
WPropDouble m_glyphSizeProp; //!< Property holding the size of the displayed glyphs
WPropInt m_sliceIdProp; //!< Property holding the slice ID
......
......@@ -26,7 +26,7 @@ void main()
10.0, // shinines
1.0, // light diffuse
0.75, // light ambient
normalize( v_normal ), // normal
normalize( v_normal ), // normal
normalize( v_ray ), // view direction
normalize( v_lightSource ) // light source position
);
......
......@@ -39,7 +39,7 @@
#include "../../kernel/WKernel.h"
#include "../../common/math/WPosition.h"
#include "../../common/math/WVector3D.h"
#include "../../dataHandler/io/nifti/nifti1_io.h"
#include "../../ext/nifti/nifti1_io.h"
#include "WMWriteNIfTI.h"
// This line is needed by the module loader to actually find your module.
......
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