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

Private Types

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

Private Attributes

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

Friends

class ::WThreadedTrackingFunctionTest
 make the test a friend More...
 

Additional Inherited Members

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

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 146 of file WThreadedTrackingFunction.h.

Member Typedef Documentation

◆ Base

the base class, a threaded job function

Definition at line 179 of file WThreadedTrackingFunction.h.

◆ DataSetPtr

a pointer to a dataset

Definition at line 158 of file WThreadedTrackingFunction.h.

◆ DataSetType

the dataset type

Definition at line 155 of file WThreadedTrackingFunction.h.

◆ DirFunc

the direction calculation function

Definition at line 167 of file WThreadedTrackingFunction.h.

◆ FiberVisitorFunc

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

a visitor function for fibers

Definition at line 173 of file WThreadedTrackingFunction.h.

◆ GridPtr

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

a pointer to the grid

Definition at line 164 of file WThreadedTrackingFunction.h.

◆ GridType

the grid type

Definition at line 161 of file WThreadedTrackingFunction.h.

◆ JobType

the job type

Definition at line 152 of file WThreadedTrackingFunction.h.

◆ NextPositionFunc

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

the path integration function

Definition at line 170 of file WThreadedTrackingFunction.h.

◆ PointVisitorFunc

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

a visitor function type for points

Definition at line 176 of file WThreadedTrackingFunction.h.

◆ This

this type

Definition at line 182 of file WThreadedTrackingFunction.h.

Constructor & Destructor Documentation

◆ WThreadedTrackingFunction()

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 m_currentIndex, m_grid, and m_maxPoints.

◆ ~WThreadedTrackingFunction()

wtracking::WThreadedTrackingFunction::~WThreadedTrackingFunction ( )
virtual

Destructor.

Definition at line 187 of file WThreadedTrackingFunction.cpp.

Member Function Documentation

◆ compute()

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().

+ Here is the caller graph for this function:

◆ getJob()

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 m_currentIndex.

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

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ::WThreadedTrackingFunctionTest

friend class ::WThreadedTrackingFunctionTest
friend

make the test a friend

Definition at line 149 of file WThreadedTrackingFunction.h.

Member Data Documentation

◆ m_currentIndex

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

the current index/seed position

Definition at line 314 of file WThreadedTrackingFunction.h.

Referenced by getJob(), and WThreadedTrackingFunction().

◆ m_directionFunc

DirFunc wtracking::WThreadedTrackingFunction::m_directionFunc
private

a function that returns the next direction

Definition at line 299 of file WThreadedTrackingFunction.h.

Referenced by compute().

◆ m_fiberVisitor

FiberVisitorFunc wtracking::WThreadedTrackingFunction::m_fiberVisitor
private

the fiber visitor

Definition at line 305 of file WThreadedTrackingFunction.h.

Referenced by compute().

◆ m_grid

GridPtr wtracking::WThreadedTrackingFunction::m_grid
private

a pointer to the grid

Definition at line 296 of file WThreadedTrackingFunction.h.

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

◆ m_maxPoints

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

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

Definition at line 311 of file WThreadedTrackingFunction.h.

Referenced by compute(), and WThreadedTrackingFunction().

◆ m_nextPosFunc

NextPositionFunc wtracking::WThreadedTrackingFunction::m_nextPosFunc
private

a function that calculates the next position

Definition at line 302 of file WThreadedTrackingFunction.h.

Referenced by compute().

◆ m_pointVisitor

PointVisitorFunc wtracking::WThreadedTrackingFunction::m_pointVisitor
private

the point visitor

Definition at line 308 of file WThreadedTrackingFunction.h.

Referenced by compute().


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