OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | Private Types | Private Attributes | Friends | List of all members
wtracking::WThreadedTrackingFunction Class Reference

Implements a generalized multithreaded tracking algorithm. More...

#include <WThreadedTrackingFunction.h>

+ Inheritance diagram for wtracking::WThreadedTrackingFunction:

Classes

class  IndexType
 An index for seed positions. More...

Public Member Functions

 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.
virtual ~WThreadedTrackingFunction ()
 Destructor.
virtual bool getJob (JobType &job)
 The job generator.
virtual void compute (DataSetPtr input, JobType const &job)
 The calculation per job.
- Public Member Functions inherited from WThreadedJobs< WTrackingUtility::DataSetType, WTrackingUtility::JobType >
 WThreadedJobs (boost::shared_ptr< InputType const > input)
 Constructor.
virtual ~WThreadedJobs ()
 Destructor.
void operator() (std::size_t id, std::size_t numThreads, WBoolFlag const &shutdown)
 The threaded function operation.
virtual bool getJob (JobType &job)=0
 Abstract function for the job aquisition.
virtual void compute (boost::shared_ptr< InputType const > input, JobType const &job)=0
 Abstract function that performs the actual computation per job.

Private Types

typedef WTrackingUtility::JobType JobType
 the job type
typedef
WTrackingUtility::DataSetType 
DataSetType
 the dataset type
typedef
WTrackingUtility::DataSetPtr 
DataSetPtr
 a pointer to a dataset
typedef WGridRegular3D GridType
 the grid type
typedef boost::shared_ptr
< GridType
GridPtr
 a pointer to the grid
typedef WTrackingUtility::DirFunc DirFunc
 the direction calculation function
typedef boost::function< bool(DataSetPtr,
JobType &, DirFunc const &) > 
NextPositionFunc
 the path integration function
typedef boost::function< void(std::vector
< WVector3d > const &) > 
FiberVisitorFunc
 a visitor function for fibers
typedef boost::function< void(WVector3d
const &) > 
PointVisitorFunc
 a visitor function type for points
typedef WThreadedJobs
< DataSetType, JobType
Base
 the base class, a threaded job function
typedef WThreadedTrackingFunction This
 this type

Private Attributes

GridPtr m_grid
 a pointer to the grid
DirFunc m_directionFunc
 a function that returns the next direction
NextPositionFunc m_nextPosFunc
 a function that calculates the next position
FiberVisitorFunc m_fiberVisitor
 the fiber visitor
PointVisitorFunc m_pointVisitor
 the point visitor
std::size_t m_maxPoints
 the maximum number of points per forward/backward integration of a fiber
WSharedObject< IndexTypem_currentIndex
 the current index/seed position

Friends

class ::WThreadedTrackingFunctionTest
 make the test a friend

Additional Inherited Members

- Public Types inherited from WThreadedJobs< WTrackingUtility::DataSetType, WTrackingUtility::JobType >
typedef
WTrackingUtility::DataSetType 
InputType
 the input type
typedef WTrackingUtility::JobType JobType
 the job type
- Protected Attributes inherited from WThreadedJobs< WTrackingUtility::DataSetType, WTrackingUtility::JobType >
boost::shared_ptr< InputType
const > 
m_input
 the input

Detailed Description

Implements a generalized multithreaded tracking algorithm.

A function that calculates the direction and a function that calculates a new position have to be provided.

Output values can be retrieved via two visitor functions that get called per fiber tracked and per point calculated respectively.

There are a certain number n of seeds per direction, this meens n*n*n seeds per voxel. For every seed, m fibers get integrated. These two parameters are the seedPositions and seedsPerVoxel parameters of the constructor, respectively.

A 'cubic' region of the grid can be chosen for seeding. The v0 and v1 parameters of the constructor are the starting/target voxel coords. Example:

v0: 1, 1, 1 v1: 4, 5, 3

In this case, only voxels between coords 1 to 3 in the x-direction, the voxels 1 to 4 in y- and the voxels 1 to 2 in z-direction are used for seeding.

Note that voxels at the first (0) and last (grid->getNbCoords*()) position in any direction are invalid seeding voxels as they are partially outside of the grid.

Definition at line 142 of file WThreadedTrackingFunction.h.

Member Typedef Documentation

the base class, a threaded job function

Definition at line 175 of file WThreadedTrackingFunction.h.

a pointer to a dataset

Definition at line 154 of file WThreadedTrackingFunction.h.

the dataset type

Definition at line 151 of file WThreadedTrackingFunction.h.

the direction calculation function

Definition at line 163 of file WThreadedTrackingFunction.h.

typedef boost::function< void ( std::vector< WVector3d > const& ) > wtracking::WThreadedTrackingFunction::FiberVisitorFunc
private

a visitor function for fibers

Definition at line 169 of file WThreadedTrackingFunction.h.

typedef boost::shared_ptr< GridType > wtracking::WThreadedTrackingFunction::GridPtr
private

a pointer to the grid

Definition at line 160 of file WThreadedTrackingFunction.h.

the grid type

Definition at line 157 of file WThreadedTrackingFunction.h.

the job type

Definition at line 148 of file WThreadedTrackingFunction.h.

typedef boost::function< bool ( DataSetPtr, JobType&, DirFunc const& ) > wtracking::WThreadedTrackingFunction::NextPositionFunc
private

the path integration function

Definition at line 166 of file WThreadedTrackingFunction.h.

typedef boost::function< void ( WVector3d const& ) > wtracking::WThreadedTrackingFunction::PointVisitorFunc
private

a visitor function type for points

Definition at line 172 of file WThreadedTrackingFunction.h.

this type

Definition at line 178 of file WThreadedTrackingFunction.h.

Constructor & Destructor Documentation

wtracking::WThreadedTrackingFunction::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.

Parameters
datasetA pointer to a dataset.
dirFuncA direction calculation function.
nextFuncA position integration function.
fiberVstA visitor for fibers.
pointVstA visitor for points.
seedPositionsThe number of seed positions in every direction per voxel.
seedsPerPosThe number of fibers startet from every seed position.
v0A vector of starting voxel indices for every direction.
v1A vector of target voxel indices for every direction.

Definition at line 162 of file WThreadedTrackingFunction.cpp.

References WSharedObject< T >::getWriteTicket(), m_currentIndex, m_grid, and m_maxPoints.

wtracking::WThreadedTrackingFunction::~WThreadedTrackingFunction ( )
virtual

Destructor.

Definition at line 187 of file WThreadedTrackingFunction.cpp.

Member Function Documentation

void wtracking::WThreadedTrackingFunction::compute ( DataSetPtr  input,
JobType const &  job 
)
virtual

The calculation per job.

Parameters
inputThe input dataset.
jobThe job.

Definition at line 206 of file WThreadedTrackingFunction.cpp.

References m_directionFunc, m_fiberVisitor, m_maxPoints, m_nextPosFunc, and m_pointVisitor.

Referenced by WThreadedTrackingFunctionTest::testCompute().

bool wtracking::WThreadedTrackingFunction::getJob ( JobType job)
virtual

The job generator.

Parameters
jobThe next job (output).
Returns
false, iff there are no more jobs.

Definition at line 191 of file WThreadedTrackingFunction.cpp.

References WSharedObject< T >::getWriteTicket(), and m_currentIndex.

Referenced by WThreadedTrackingFunctionTest::testCompute(), and WThreadedTrackingFunctionTest::testGetJob().

Friends And Related Function Documentation

friend class ::WThreadedTrackingFunctionTest
friend

make the test a friend

Definition at line 145 of file WThreadedTrackingFunction.h.

Member Data Documentation

WSharedObject< IndexType > wtracking::WThreadedTrackingFunction::m_currentIndex
private

the current index/seed position

Definition at line 310 of file WThreadedTrackingFunction.h.

Referenced by getJob(), and WThreadedTrackingFunction().

DirFunc wtracking::WThreadedTrackingFunction::m_directionFunc
private

a function that returns the next direction

Definition at line 295 of file WThreadedTrackingFunction.h.

Referenced by compute().

FiberVisitorFunc wtracking::WThreadedTrackingFunction::m_fiberVisitor
private

the fiber visitor

Definition at line 301 of file WThreadedTrackingFunction.h.

Referenced by compute().

GridPtr wtracking::WThreadedTrackingFunction::m_grid
private

a pointer to the grid

Definition at line 292 of file WThreadedTrackingFunction.h.

Referenced by wtracking::WThreadedTrackingFunction::IndexType::job(), and WThreadedTrackingFunction().

std::size_t wtracking::WThreadedTrackingFunction::m_maxPoints
private

the maximum number of points per forward/backward integration of a fiber

Definition at line 307 of file WThreadedTrackingFunction.h.

Referenced by compute(), and WThreadedTrackingFunction().

NextPositionFunc wtracking::WThreadedTrackingFunction::m_nextPosFunc
private

a function that calculates the next position

Definition at line 298 of file WThreadedTrackingFunction.h.

Referenced by compute().

PointVisitorFunc wtracking::WThreadedTrackingFunction::m_pointVisitor
private

the point visitor

Definition at line 304 of file WThreadedTrackingFunction.h.

Referenced by compute().


The documentation for this class was generated from the following files: