25 #ifndef WTHREADEDTRACKINGFUNCTION_H
26 #define WTHREADEDTRACKINGFUNCTION_H
33 #include <boost/array.hpp>
35 #include "../common/WSharedObject.h"
36 #include "../common/WThreadedJobs.h"
37 #include "../common/math/linearAlgebra/WVectorFixed.h"
38 #include "WDataSetSingle.h"
49 #if INTPTR_MAX == INT32_MAX
50 #define TRACKING_EPS 0.00001
52 #define TRACKING_EPS 0.0000001
64 typedef std::pair< WVector3d, WVector3d >
JobType;
77 typedef std::shared_ptr< WGridRegular3D >
Grid3DPtr;
149 friend class ::WThreadedTrackingFunctionTest;
200 std::size_t seedPositions = 1, std::size_t seedsPerPos = 1,
201 std::vector< int > v0 = std::vector< int >(),
202 std::vector< int > v1 = std::vector< int >() );
234 friend class ::WThreadedTrackingFunctionTest;
251 std::vector< int >
const& v1, std::size_t seedPositions,
252 std::size_t seedsPerPosition );
283 boost::array< std::size_t, 4 >
m_pos;
286 boost::array< std::size_t, 4 >
m_min;
289 boost::array< std::size_t, 4 >
m_max;
A data set consisting of a set of values based on a grid.
A grid that has parallelepiped cells which all have the same proportion.
Wrapper around an object/type for thread safe sharing of objects among multiple threads.
A threaded functor base class for producer-consumer-style multithreaded computation.
Test the WThreadedTrackingFunction class.
An index for seed positions.
boost::array< std::size_t, 4 > m_max
the maximum position in the seed space
boost::array< std::size_t, 4 > m_min
the minimum position in the seed space
bool m_done
true, iff there are no more seeds
GridPtr m_grid
a pointer to the grid
IndexType()
Construct an invalid index.
bool done()
Check if there aren't any more seed positions.
double m_offset
the relative (to the size of a voxel) distance between seeds
IndexType & operator++()
Increase the index by one, effectively generating the next seed position.
JobType job()
Create a job from this index.
boost::array< std::size_t, 4 > m_pos
the position in the seed space
Implements a generalized multithreaded tracking algorithm.
WTrackingUtility::JobType JobType
the job type
WTrackingUtility::DataSetPtr DataSetPtr
a pointer to a dataset
std::shared_ptr< GridType > GridPtr
a pointer to the grid
FiberVisitorFunc m_fiberVisitor
the fiber visitor
std::size_t m_maxPoints
the maximum number of points per forward/backward integration of a fiber
WTrackingUtility::DataSetType DataSetType
the dataset type
boost::function< void(std::vector< WVector3d > const &) > FiberVisitorFunc
a visitor function for fibers
WThreadedTrackingFunction(DataSetPtr dataset, DirFunc dirFunc, NextPositionFunc nextFunc, FiberVisitorFunc fiberVst, PointVisitorFunc pointVst, std::size_t seedPositions=1, std::size_t seedsPerPos=1, std::vector< int > v0=std::vector< int >(), std::vector< int > v1=std::vector< int >())
Constructor.
WThreadedTrackingFunction This
this type
virtual ~WThreadedTrackingFunction()
Destructor.
WTrackingUtility::DirFunc DirFunc
the direction calculation function
boost::function< bool(DataSetPtr, JobType &, DirFunc const &) > NextPositionFunc
the path integration function
NextPositionFunc m_nextPosFunc
a function that calculates the next position
boost::function< void(WVector3d const &) > PointVisitorFunc
a visitor function type for points
WSharedObject< IndexType > m_currentIndex
the current index/seed position
virtual void compute(DataSetPtr input, JobType const &job)
The calculation per job.
GridPtr m_grid
a pointer to the grid
WGridRegular3D GridType
the grid type
DirFunc m_directionFunc
a function that returns the next direction
virtual bool getJob(JobType &job)
The job generator.
WThreadedJobs< DataSetType, JobType > Base
the base class, a threaded job function
PointVisitorFunc m_pointVisitor
the point visitor
A class that provides untility functions and typedefs for tracking algorithms.
static bool onBoundary(Grid3DPtr grid, WVector3d const &pos)
Check if a point is on the boundary of the given grid, where boundary means a distance less then TRAC...
std::pair< WVector3d, WVector3d > JobType
define a job type for tracking algorithms
static bool followToNextVoxel(DataSetPtr dataset, JobType &job, DirFunc const &dirFunc)
A function that follows a direction until leaving the current voxel.
WDataSetSingle DataSetType
the dataset type
std::shared_ptr< WGridRegular3D > Grid3DPtr
a pointer to a regular 3d grid
std::shared_ptr< DataSetType const > DataSetPtr
a pointer to a dataset
static double getDistanceToBoundary(Grid3DPtr grid, WVector3d const &pos, WVector3d const &dir)
Calculate the distance from a given position to the nearest voxel boundary on the ray from the positi...
boost::function< WVector3d(DataSetPtr, JobType const &) > DirFunc
a function that calculates a direction to continue tracking