Commit 74bf01b4 authored by Dirk Albrecht's avatar Dirk Albrecht

[MERGE] with 3364

parents 444bc070 d2cff2e5
...@@ -12,7 +12,7 @@ allowOnlyOneFiberDataSet = yes # This will prevent you from accidently loading m ...@@ -12,7 +12,7 @@ allowOnlyOneFiberDataSet = yes # This will prevent you from accidently loading m
# default=HUD # default=HUD
## A list of modules that will be provided through the GUI. ## A list of modules that will be provided through the GUI.
## If the list is empty all available modules are provided. ## If the list is empty all available modules are provided.
whiteList = Arbitrary Plane,Coordinate System,Image Extractor,Paint Texture,Arbitrary Rois,Bounding Box,Distance Map Isosurface,Gauss Filtering,HUD,Isosurface,Isosurface Raytracer,LIC,Mesh Reader,Voxelizer,Superquadric Glyphs,Triangle Mesh Renderer,Vector Plot,Write NIfTI whiteList = Arbitrary Plane,Coordinate System,Image Extractor,Paint Texture,Arbitrary Rois,Bounding Box,Distance Map Isosurface,Gauss Filtering,HUD,Isosurface,Isosurface Raytracer,LIC,Read Mesh,Voxelizer,Superquadric Glyphs,Triangle Mesh Renderer,Vector Plot,Write NIfTI
## Specify a ";" separated list of additional paths for modules. The order of appearance is the order of loading. The following additional rules apply here: ## Specify a ";" separated list of additional paths for modules. The order of appearance is the order of loading. The following additional rules apply here:
## 1. if the directory contains one or more libOWmodule_XYZ it/they get loaded ## 1. if the directory contains one or more libOWmodule_XYZ it/they get loaded
......
...@@ -113,6 +113,22 @@ IF( OSSIM_FOUND ) ...@@ -113,6 +113,22 @@ IF( OSSIM_FOUND )
# MARK_AS_ADVANCED( OSSIM_LIBDIR ) # MARK_AS_ADVANCED( OSSIM_LIBDIR )
ENDIF() ENDIF()
# insight toolkit (for image segmentation and registration)
#----------------------------------------------------------
FIND_PACKAGE( ITK QUIET )
OPTION( OW_USE_ITK "Use the insight toolkit for image segmentation" OFF )
IF( ITK_FOUND AND OW_USE_ITK )
INCLUDE( ${ITK_USE_FILE} )
ENDIF( ITK_FOUND AND OW_USE_ITK )
### Eigen #### (for the gauss process, the covariance matrices tend to be sparse and 20x20, but ~70.000 of them)
FIND_PACKAGE( Eigen3 QUIET )
IF( EIGEN3_FOUND )
MESSAGE( STATUS "Found Eigen3 in: ${EIGEN3_INCLUDE_DIR} with version: ${EIGEN3_VERSION}" )
MARK_AS_ADVANCED( EIGEN3_INCLUDE_DIR )
MARK_AS_ADVANCED( EIGEN3_VERSION )
ENDIF()
# other options: # other options:
#--------------- #---------------
# Set default build type # Set default build type
...@@ -136,6 +152,8 @@ IF( CMAKE_GENERATOR MATCHES "Visual Studio" ) ...@@ -136,6 +152,8 @@ IF( CMAKE_GENERATOR MATCHES "Visual Studio" )
SET( CMAKE_SHARED_LINKER_FLAGS " /STACK:10000000 /machine:I386 /NODEFAULTLIB:${EXCLUDE_LIBRARIES}" CACHE STRING "" FORCE ) SET( CMAKE_SHARED_LINKER_FLAGS " /STACK:10000000 /machine:I386 /NODEFAULTLIB:${EXCLUDE_LIBRARIES}" CACHE STRING "" FORCE )
SET( CMAKE_EXE_LINKER_FLAGS " /STACK:10000000 /machine:I386 /NODEFAULTLIB:${EXCLUDE_LIBRARIES}" CACHE STRING "" FORCE ) SET( CMAKE_EXE_LINKER_FLAGS " /STACK:10000000 /machine:I386 /NODEFAULTLIB:${EXCLUDE_LIBRARIES}" CACHE STRING "" FORCE )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"NOMINMAX\"" ) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"NOMINMAX\"" )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
SET( CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows" )
ELSE() ELSE()
# Unfortunately libstdc++'s header files don't work with mingw in ansi mode (basically libstdc++'s fault) # Unfortunately libstdc++'s header files don't work with mingw in ansi mode (basically libstdc++'s fault)
IF( CMAKE_HOST_SYSTEM MATCHES "Windows" ) IF( CMAKE_HOST_SYSTEM MATCHES "Windows" )
...@@ -154,6 +172,11 @@ ELSE() ...@@ -154,6 +172,11 @@ ELSE()
SET( CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG -O0" CACHE STRING "" FORCE ) SET( CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG -O0" CACHE STRING "" FORCE )
ENDIF() ENDIF()
IF( ITK_FOUND AND OW_USE_ITK )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOW_USE_ITK" CACHE STRING "" FORCE )
SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DOW_USE_ITK" CACHE STRING "" FORCE )
ENDIF( ITK_FOUND AND OW_USE_ITK )
SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DDEBUG -O2" CACHE STRING "" FORCE ) SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DDEBUG -O2" CACHE STRING "" FORCE )
ADD_SUBDIRECTORY( dataHandler ) ADD_SUBDIRECTORY( dataHandler )
...@@ -186,6 +209,11 @@ ENDIF() ...@@ -186,6 +209,11 @@ ENDIF()
ADD_EXECUTABLE( walnut OpenWalnut.cpp version.h ) ADD_EXECUTABLE( walnut OpenWalnut.cpp version.h )
TARGET_LINK_LIBRARIES( walnut OWkernel OWdataHandler OWgui OWguiqt4 OWcommon OWge ${Boost_LIBRARIES} ) TARGET_LINK_LIBRARIES( walnut OWkernel OWdataHandler OWgui OWguiqt4 OWcommon OWge ${Boost_LIBRARIES} )
IF(MSVC_IDE)
SET_TARGET_PROPERTIES( walnut PROPERTIES DEBUG_POSTFIX "d")
SET_TARGET_PROPERTIES( walnut PROPERTIES PREFIX "../")
ENDIF(MSVC_IDE)
#---------- Shaders ------------- #---------- Shaders -------------
option( OW_COPY_SHADERS "This enables copying shaders with every make call." ON ) option( OW_COPY_SHADERS "This enables copying shaders with every make call." ON )
if( OW_COPY_SHADERS ) if( OW_COPY_SHADERS )
......
...@@ -10,6 +10,10 @@ ADD_SUBDIRECTORY( math ) ...@@ -10,6 +10,10 @@ ADD_SUBDIRECTORY( math )
ADD_LIBRARY( OWcommon SHARED ${COMMON_SRC} ${COMMON_DATASTRUCTURES_SRC} ${COMMON_EXCEPTIONS_SRC} ${MATH_SRC} ${FIBERSIMILARITY_SRC} ) ADD_LIBRARY( OWcommon SHARED ${COMMON_SRC} ${COMMON_DATASTRUCTURES_SRC} ${COMMON_EXCEPTIONS_SRC} ${MATH_SRC} ${FIBERSIMILARITY_SRC} )
TARGET_LINK_LIBRARIES( OWcommon ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} ) TARGET_LINK_LIBRARIES( OWcommon ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} )
IF(MSVC_IDE)
SET_TARGET_PROPERTIES( OWcommon PROPERTIES PREFIX "../")
ENDIF(MSVC_IDE)
# Set the prefix and suffix of dynamically loadable modules to match # Set the prefix and suffix of dynamically loadable modules to match
# CMAKEs naming of them. The quotes are necessary so the shell doesn't mess # CMAKEs naming of them. The quotes are necessary so the shell doesn't mess
# with these defines. Unfortunately, the Visual Studio has problems handling # with these defines. Unfortunately, the Visual Studio has problems handling
......
...@@ -193,3 +193,8 @@ void WItemSelector::unlock() ...@@ -193,3 +193,8 @@ void WItemSelector::unlock()
m_lock.reset(); m_lock.reset();
} }
WItemSelector::operator unsigned int() const
{
return getItemIndexOfSelected( 0 );
}
...@@ -218,6 +218,13 @@ public: ...@@ -218,6 +218,13 @@ public:
*/ */
void unlock(); void unlock();
/**
* Allow cast from selector to unsigned int.
*
* \return the index of the first selected item in the selection.
*/
operator unsigned int() const;
protected: protected:
/** /**
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <cstdlib>
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
...@@ -70,7 +71,22 @@ boost::filesystem::path WPathHelper::getAppPath() ...@@ -70,7 +71,22 @@ boost::filesystem::path WPathHelper::getAppPath()
boost::filesystem::path WPathHelper::getConfigFile() boost::filesystem::path WPathHelper::getConfigFile()
{ {
// TODO(ebaum): we should prefer a user config file in ~.walnut.cfg in future. This needs to be platform independent of course. // TODO(ebaum): we should prefer a user config file in ~.walnut.cfg in future. This needs to be platform independent of course.
return getPathHelper()->m_sharePath / "walnut.cfg"; namespace fs = boost::filesystem;
// I know that this work only for linux, but it should not break anything elsewhere.
// Thus, we prefer the file in the home directory now.
std::string homeDir = getenv( "HOME" ) ? getenv( "HOME" ) : "";
std::string linuxDefault= homeDir + "/.walnut.cfg";
boost::filesystem::path configFile;
if( fs::exists( linuxDefault ) )
{
configFile = boost::filesystem::path( linuxDefault );
}
else
{
configFile = getPathHelper()->m_sharePath / "walnut.cfg";
}
return configFile;
} }
boost::filesystem::path WPathHelper::getFontPath() boost::filesystem::path WPathHelper::getFontPath()
......
...@@ -39,11 +39,6 @@ class OWCOMMON_EXPORT WPathHelper // NOLINT ...@@ -39,11 +39,6 @@ class OWCOMMON_EXPORT WPathHelper // NOLINT
{ {
public: public:
/**
* Default constructor.
*/
WPathHelper();
/** /**
* Destructor. * Destructor.
*/ */
...@@ -157,6 +152,11 @@ public: ...@@ -157,6 +152,11 @@ public:
protected: protected:
/**
* Constructors are protected because this is a Singleton.
*/
WPathHelper();
private: private:
/** /**
......
...@@ -22,20 +22,15 @@ ...@@ -22,20 +22,15 @@
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#include <vector> #include "WRequirement.h"
#include "WROIBitfield.h" WRequirement::WRequirement()
WROIBitfield::WROIBitfield( boost::shared_ptr< std::vector<bool> > bitfield ) :
WROI(),
m_bitfield( bitfield )
{ {
// initialize members
} }
WROIBitfield::~WROIBitfield() WRequirement::~WRequirement()
{ {
// cleanup
} }
void WROIBitfield::updateGFX()
{
}
...@@ -22,51 +22,41 @@ ...@@ -22,51 +22,41 @@
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#ifndef WUPDATETHREAD_H #ifndef WREQUIREMENT_H
#define WUPDATETHREAD_H #define WREQUIREMENT_H
#include "../../../common/WThreadedRunner.h" #include "WExportCommon.h"
#include "../../WExportKernel.h"
class WROIManagerFibers;
/** /**
* implements a thread that updates the fiber selection bit field * Base class for all possible kinds of requirements. Derive your own kind of requirement from this class. This allows easy checking of required
* features on a target system. Of course this is only useful for things checkable during runtime. You should avoid writing classes for checking
* weather some library is installed or not. This is checked by the linker on the target system.
*/ */
class OWKERNEL_EXPORT WUpdateThread: public WThreadedRunner class OWCOMMON_EXPORT WRequirement // NOLINT
{ {
public: public:
/**
* default constructor
*
* \param roiManager
*/
explicit WUpdateThread( boost::shared_ptr< WROIManagerFibers >roiManager );
/** /**
* destructor * Default constructor.
*/ */
virtual ~WUpdateThread(); WRequirement();
/** /**
* entry for the run command * Destructor.
*/ */
virtual void threadMain(); virtual ~WRequirement();
/** /**
* Return the value of the finished flag. * Checks if the requirement is fulfilled on the system. Implement this for your specific case.
*
* \return true if the specific requirement is fulfilled.
*/ */
inline bool isFinished(); virtual bool isComplied() const = 0;
protected: protected:
private: private:
boost::shared_ptr< WROIManagerFibers > m_roiManager; //!< stores pointer to the roi manager
bool m_myThreadFinished; //!< Has the thread finished?
}; };
bool WUpdateThread::isFinished() #endif // WREQUIREMENT_H
{
return m_myThreadFinished;
}
#endif // WUPDATETHREAD_H
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#ifndef WSHAREDASSOCIATIVECONTAINER_H #ifndef WSHAREDASSOCIATIVECONTAINER_H
#define WSHAREDASSOCIATIVECONTAINER_H #define WSHAREDASSOCIATIVECONTAINER_H
#include <utility>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include "WSharedObject.h" #include "WSharedObject.h"
...@@ -48,6 +50,16 @@ public: ...@@ -48,6 +50,16 @@ public:
*/ */
typedef typename T::iterator Iterator; typedef typename T::iterator Iterator;
/**
* The type of the elements
*/
typedef typename T::value_type value_type;
/**
* The type of the key used in this associative container
*/
typedef typename T::key_type key_type;
/** /**
* Default constructor. * Default constructor.
*/ */
...@@ -63,6 +75,54 @@ public: ...@@ -63,6 +75,54 @@ public:
*/ */
void clear(); void clear();
/**
* Return true if the container is empty. The sense and non-sense of this method in a multi threaded environment is questionable.
*
* \return true if empty
*/
bool empty() const;
/**
* The current size of the container. 0 if empty. The sense and non-sense of this method in a multi threaded environment is questionable.
*
* \return the size.
*/
size_t size() const;
/**
* The maximum size of a container.
*
* \return the maximum size
*/
size_t max_size() const;
/**
* Count elements with a specific key. The sense and non-sense of this method in a multi threaded environment is questionable.
*
* \param x the key
*
* \return the count, 0 if none found.
*/
size_t count( const key_type& x ) const;
/**
* Erases the element with the specified key.
*
* \param x the key
*
* \return the number of elements erased
*/
size_t erase( const key_type& x );
/**
* Inserts the specified element.
*
* \param x the element to add
*
* \return a pair containing the Iterator pointing to the inserted element and the bool is true if the element not existed before.
*/
std::pair< Iterator, bool > insert( const value_type& x );
protected: protected:
private: private:
}; };
...@@ -87,5 +147,47 @@ void WSharedAssociativeContainer< T >::clear() ...@@ -87,5 +147,47 @@ void WSharedAssociativeContainer< T >::clear()
w->get().clear(); w->get().clear();
} }
template < typename T >
bool WSharedAssociativeContainer< T >::empty() const
{
typename WSharedAssociativeContainer< T >::ReadTicket r = WSharedObject< T >::getReadTicket();
return r->get().empty();
}
template < typename T >
size_t WSharedAssociativeContainer< T >::size() const
{
typename WSharedAssociativeContainer< T >::ReadTicket r = WSharedObject< T >::getReadTicket();
return r->get().size();
}
template < typename T >
size_t WSharedAssociativeContainer< T >::max_size() const
{
typename WSharedAssociativeContainer< T >::ReadTicket r = WSharedObject< T >::getReadTicket();
return r->get().max_size();
}
template < typename T >
size_t WSharedAssociativeContainer< T >::count( const key_type& x ) const
{
typename WSharedAssociativeContainer< T >::ReadTicket r = WSharedObject< T >::getReadTicket();
return r->get().count( x );
}
template < typename T >
size_t WSharedAssociativeContainer< T >::erase( const key_type& x )
{
typename WSharedAssociativeContainer< T >::WriteTicket w = WSharedObject< T >::getWriteTicket();
return w->get().erase( x );
}
template < typename T >
std::pair< typename WSharedAssociativeContainer< T >::Iterator, bool > WSharedAssociativeContainer< T >::insert( const value_type& x )
{
typename WSharedAssociativeContainer< T >::WriteTicket w = WSharedObject< T >::getWriteTicket();
return w->get().insert( x );
}
#endif // WSHAREDASSOCIATIVECONTAINER_H #endif // WSHAREDASSOCIATIVECONTAINER_H
...@@ -54,6 +54,7 @@ public: ...@@ -54,6 +54,7 @@ public:
/** /**
* Class allowing thread-safe access to an object. It provides some convenience methods to read and write lock the access. * Class allowing thread-safe access to an object. It provides some convenience methods to read and write lock the access.
* OBSOLETE.
*/ */
class WSharedObjectAccess class WSharedObjectAccess
{ {
......
...@@ -94,9 +94,11 @@ public: ...@@ -94,9 +94,11 @@ public:
*/ */
virtual void compute( boost::shared_ptr< InputType const > input, JobType const& job ) = 0; virtual void compute( boost::shared_ptr< InputType const > input, JobType const& job ) = 0;
private: protected:
//! the input //! the input
boost::shared_ptr< InputType const > m_input; boost::shared_ptr< InputType const > m_input;
private:
}; };
template< class Input_T, class Job_T > template< class Input_T, class Job_T >
......
...@@ -38,66 +38,43 @@ namespace wmath ...@@ -38,66 +38,43 @@ namespace wmath
template< typename T > class WMatrix : public WValue< T > template< typename T > class WMatrix : public WValue< T >
{ {
public: public:
/**
* Produces a square matrix with the given number of components.
* The components will be set to zero if T is a type representing numbers.
*
* \param n Number of cols and rows in the matrix
*/
explicit WMatrix( size_t n );
/** /**
* Produces a matrix with the given number of components. * Produces a matrix with the given number of components.
* The components will be set to zero if T is a type representing numbers. * The components will be set to zero if T is a type representing numbers.
*
* \param nbRows number of rows in the matrix * \param nbRows number of rows in the matrix
* \param nbCols number of columns in the matrix * \param nbCols number of columns in the matrix
*/ */
explicit WMatrix( size_t nbRows, size_t nbCols ) explicit WMatrix( size_t nbRows, size_t nbCols );
: WValue< T >( nbRows * nbCols )
{
m_nbCols = nbCols;
}